PageSourceSearch

https://wbk-assets.webook.com/0.7.8/assets/@wbk/hotels-5c6KxmYL.js

js webook.com collected 2026-09-25 15:15:05 UTC 230,383 bytes, 5 lines download raw bytes

1import{P as z,T as h,B as D,t as A,D as H,e as ue,w as bs,x as ye,r as Ns,q as Hn,S as Bn,s as ws,f as ks,I as nt,d as $n,L as Zn,h as Ut,R as ne,l as fe,G as zn,u as be,o as Un,g as Vn,C as Gn,y as Ne,F as Lt,n as Ss,H as Xn,p as qn,M as Wn}from"./ui-Bq7l3oiK.js";import{W as Jn,al as Kn,M as Yn,q as Qn,a9 as Me,a as se,C as we,r as Dt,an as ea,ao as Mt,ak as Cs,s as Pt,o as Pe,ah as Is,U as Ls,aa as dt,af as Ee,ap as yt,a8 as Vt,k as ta,aq as _t,ad as sa,ac as na,j as Et,m as Ue,ar as aa,h as la,as as oa,E as jt}from"./svg-HUfKeBgT.js";import{j as e,e as V,u as Re,V as Z,U as Ae,I as Oe,C as pe,G as ra,P as Ot,W as Rt,Y as Ds,T as ia,i as at,s as Ze,H as ca,Z as da,R as ua,X as ma,w as ha}from"./hooks-BlLlWTp9.js";import{b as L,c as Ms,a as R,L as de,k as At,e as ga,n as va,T as ut,d as xa}from"./config-CNzyBjC_.js";import{r as g,g as fa,R as T,b as Ps,a as pa}from"../vendor-Cc9w-i99.js";import{a1 as ya,a2 as mt,a3 as _a,a4 as ja,a5 as ba,a6 as Na,a7 as Es,a8 as Os,a9 as Rs,aa as As,ab as Ts,ac as Fs,ad as wa,_ as ka,ae as Sa,af as Ca,ag as Ia}from"./queue-DaHNt4dN.js";import{u as W}from"./analytics-DE0c17Pa.js";import{C as U,u as La}from"./currency-B7PYjEev.js";import{u as Tt,F as Hs,C as re,a as Bs}from"../react-hook-form-D_m77UuM.js";import{useAuth as ht,AuthModal as Da}from"./auth-AbxUcDmb.js";import{P as Ma,W as Pa,u as $s,a as Gt,B as Ea}from"./payment-CMegBHo6.js";import{E as Oa}from"./logger-DfNVpG3P.js";import"./api-BgBdL-BO.js";var Ra=({className:t})=>{const{t:s}=L(["hotels_common"]),{logo:n}=Ms();return e.jsxs(z,{size:"XS",border:!1,className:A("mx-auto flex w-max items-center justify-center",t),surface:"level-1",children:[e.jsxs("div",{className:"text-text-secondary px-XS border-body-level-2 flex flex-col items-center justify-center ltr:border-r rtl:border-l",children:[n?e.jsx("img",{src:n,alt:"logo",width:24,height:7}):e.jsx(Qn,{width:24,height:7}),e.jsx(h,{variant:"label-M",color:"text-secondary",children:"Hotels"})]}),e.jsx(h,{variant:"body-XS",className:"px-XS",strong:!0,color:"text-tertiary",children:s("hotels_common:powered_by_alm")})]})},ke=Ra,Aa=({order:t,className:s})=>{const{t:n}=L(["hotels_common"]),a=t==null?void 0:t.reservation.orderNumber;return e.jsxs(z,{className:A("flex flex-col gap-6",s),children:[e.jsx(h,{variant:"heading-S",className:"font-semibold",children:n("hotels_common:need_help")}),(t==null?void 0:t.booking_status)!=="failed"&&e.jsxs(D,{theme:"action",shape:"text",className:"justify-start p-0",as:"a",href:`https://wa.me/+966533704256?text=${encodeURIComponent(n("hotels_common:whatsapp_message",{orderNumber:a}))}`,children:[e.jsx(Jn,{className:"h-5 w-5 shrink-0"}),e.jsx("span",{className:"underline",children:n("hotels_common:contact_us_by_whatsapp")})]}),e.jsxs(D,{theme:"action",shape:"text",className:"justify-start p-0",as:"a",href:"tel:+966920012117",children:[e.jsx(Kn,{className:"h-5 w-5 shrink-0"}),e.jsxs("div",{className:"underline",children:[e.jsx("span",{children:n("hotels_common:call_us")})," ",e.jsx("span",{dir:"ltr",className:"underline",children:"+966 92 001 2117"})]})]}),e.jsxs(D,{theme:"action",shape:"text",className:"justify-start p-0",as:"a",href:"mailto:[email protected]",children:[e.jsx(Yn,{className:"h-5 w-5 shrink-0"}),e.jsx("span",{className:"underline",children:n("hotels_common:contact_us_by_email")})]})]})},Ft=Aa,Xt=({time:t,locale:s})=>{if(!t)return"";const n=new Date(`1970-01-01T${t}Z`);return V(n,s,{hour:"numeric",minute:"2-digit",hour12:!0,timeZone:"UTC"})},Ta=Object.defineProperty,Fa=Object.defineProperties,Ha=Object.getOwnPropertyDescriptors,rt=Object.getOwnPropertySymbols,Zs=Object.prototype.hasOwnProperty,zs=Object.prototype.propertyIsEnumerable,qt=(t,s,n)=>s in t?Ta(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n,C=(t,s)=>{for(var n in s||(s={}))Zs.call(s,n)&&qt(t,n,s[n]);if(rt)for(var n of rt(s))zs.call(s,n)&&qt(t,n,s[n]);return t},P=(t,s)=>Fa(t,Ha(s)),Te=(t,s)=>{var n={};for(var a in t)Zs.call(t,a)&&s.indexOf(a)<0&&(n[a]=t[a]);if(t!=null&&rt)for(var a of rt(t))s.indexOf(a)<0&&zs.call(t,a)&&(n[a]=t[a]);return n},je=(t,s,n)=>new Promise((a,o)=>{var l=d=>{try{i(n.next(d))}catch(u){o(u)}},r=d=>{try{i(n.throw(d))}catch(u){o(u)}},i=d=>d.done?a(d.value):Promise.resolve(d.value).then(l,r);i((n=n.apply(t,s)).next())}),Ba=({checkInTime:t,checkOutTime:s,checkOutDate:n,checkInDate:a,numberOfNights:o,freeCancellationDate:l,bordered:r=!0})=>{const{t:i}=L("hotels_common"),{locale:d}=R(),{formattedCheckInDate:u,formattedCheckOutDate:c,formattedCheckInTime:m,formattedCheckOutTime:p}=g.useMemo(()=>{const x=a&&V(a,d,C({day:"2-digit",month:"short",year:"numeric"},typeof a!="string"?{timeZone:void 0}:{})),f=n&&V(n,d,C({day:"2-digit",month:"short",year:"numeric"}
1,typeof n!="string"?{timeZone:void 0}:{})),_=Xt({time:t,locale:d}),v=Xt({time:s,locale:d});return{formattedCheckInDate:x,formattedCheckOutDate:f,formattedCheckInTime:_,formattedCheckOutTime:v}},[d,a,n,t,s]);return e.jsxs(e.Fragment,{children:[e.jsxs(z,{className:A("flex items-center justify-between gap-1",!r&&"!p-0"),border:r,children:[e.jsxs("div",{children:[e.jsx(h,{variant:"body-S",color:"text-secondary",children:i("hotels_common:check_in")}),e.jsx(h,{variant:"label-M",children:u}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:m})]}),e.jsxs("div",{className:"relative z-0 flex grow items-center justify-center",children:[e.jsx(H,{className:"border-body-level-2 absolute -z-10 w-1/2 border border-dashed"}),o&&e.jsx("div",{className:"bg-body-level-2 rounded-XS px-2 py-1",children:e.jsx(h,{variant:"label-S",children:i("hotels_common:nights",{count:o})})})]}),e.jsxs("div",{children:[e.jsx(h,{variant:"body-S",color:"text-secondary",children:i("hotels_common:check_out")}),e.jsx(h,{variant:"label-M",children:c}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:p})]})]}),l&&e.jsxs(z,{className:"flex items-start justify-center gap-2 text-center",children:[e.jsx(Me,{className:"text-success mt-[5px] h-3 w-3 shrink-0"}),e.jsx(h,{as:"div",variant:"body-S",color:"success",children:i("hotels_common:free_cancellation_before",{date:V(l,d,{day:"numeric",month:"long",year:"numeric"})})})]})]})},qe=Ba,Us=t=>e.jsxs("svg",P(C({width:"48",height:"49",viewBox:"0 0 48 49",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:[e.jsx("path",{d:"M10.7016 37.8354H45.6V40.9551H9.32816L1.94531 32.9016L4.24688 30.7921L10.7016 37.8354Z",fill:"currentColor"}),e.jsx("path",{d:"M17.6761 40.2051L12.6113 48.5L11.28 47.689L9.94876 46.8757L15.0136 38.5784L17.6761 40.2051Z",fill:"currentColor"}),e.jsx("path",{d:"M35.2726 40.2051L40.3374 48.5L41.6687 47.689L42.9999 46.8757L37.9351 38.5784L35.2726 40.2051Z",fill:"currentColor"}),e.jsx("path",{d:"M28.408 20.1812L25.43 39.3088L22.3453 38.8285L25.3232 19.7009L28.408 20.1812Z",fill:"currentColor"}),e.jsx("path",{d:"M30.5752 0.759087C37.4743 1.97323 41.2817 6.57453 43.2554 11.087C44.2383 13.3342 44.7829 15.5869 45.052 17.4575C45.3154 19.2896 45.3323 20.8815 45.1715 21.7957L44.9009 23.3331L35.2062 21.6269L34.8373 21.0456L33.737 19.3193L32.1158 20.5666L31.5706 20.9871L21.488 19.2127L21.1215 18.6318L20.0212 16.9055L18.3977 18.1525L17.8525 18.5729L8.15772 16.8668L8.42825 15.3294C8.58308 14.4495 9.70069 10.1187 12.9667 6.33491C16.3211 2.4487 21.882 -0.770476 30.5752 0.759087ZM30.0342 3.83387C22.5176 2.51137 18.0315 5.24488 15.3303 8.37395C13.493 10.5025 12.4578 12.8565 11.9373 14.362L17.0432 15.2605L20.8214 12.358L23.3818 16.376L30.759 17.6743L34.5395 14.7722L37.0999 18.7902L42.1319 19.6758C42.1075 19.1716 42.0623 18.5735 41.9657 17.9021C41.7289 16.2553 41.2488 14.2826 40.3984 12.3381C38.7049 8.46604 35.6051 4.81427 30.0342 3.83387Z",fill:"currentColor"}),e.jsx("path",{d:"M27.8488 2.52349C27.0581 3.6704 25.8289 5.92985 24.6499 8.39573C23.473 10.8572 22.4134 13.3823 21.9218 15.041L20.4269 14.597L18.9316 14.1554C19.4946 12.2559 20.6396 9.55108 21.8361 7.04854C23.0305 4.55055 24.3453 2.11017 25.2808 0.753112L27.8488 2.52349Z",fill:"currentColor"}),e.jsx("path",{d:"M31.2909 3.12926C31.6425 4.47719 32.0267 7.02058 32.2931 9.74082C32.5589 12.4562 32.6929 15.1914 32.5888 16.9182L34.1455 17.0113L35.7017 17.1067C35.8209 15.1291 35.668 12.1959 35.3977 9.43519C35.1278 6.67951 34.725 3.93686 34.3089 2.34194L31.2909 3.12926Z",fill:"currentColor"})]})),Wt=t=>t.rank,Ve=t=>t.basePrice,$a=t=>{const s=t.map(Ve);return[Math.min(...s),Math.max(...s)]},bt=t=>t.basePriceNightlyRate,Za=t=>{const s=t.map(bt);return[Math.min(...s),Math.max(...s)]},Vs=t=>t.starRating,za=t=>{const s={};return t.forEach(n=>{const a=Vs(n);(a||a===0)&&(s[a]=(s[a]||0)+1)}),Object.entries(s).map(([n,a])=>({hotelClass:+n,hotels:a})).sort((n,a)=>a.hotelClass-n.hotelClass)},Nt=t=>{var s;return(s=t.review)==null?void 0:s.score},Gs=t=>{let s=Nt(t);return s=Math.floor(s||0),s=s===10?9:s,s},Ua=t=>{const s={};return t.forEach(n=>{var a,o,l;const r=Gs(n);s[r]={count:(((a=s[r])==null?void 0:a.count)||0)+1,description:((o=s[r])==null?void 0:o.description)||((l=n.review)==null?void 0:l.description)||""}}),Object.entries(s).map(([n,a])=>({hotelRating:+n,count:a.count,description:a.description})).sort((n,a)=>a.hotelRating-n.hotelRating)},Va=t=>t.name,Xs=t=>t.propertyType,Ga=t=>{const s={};return t.forEach(n=>{var a;const o=Xs(n);o!=null&&o.name&&(s[o.name]={count:(((a=s[o.name])==null?void 0:a.count)||0)+1,hotelPropertyType:o.id})}),Object.entries(s).map(([n,{count:a,hotelPropertyType:o}])=>({hotelPropertyType:{id:o,name:n},hotelsCount:a}))},qs=t=>t.facilities,Xa=t=>{const s={};return t.forEach(n=>{const a=qs(n);a==null||a.forEach(o=>{o.name&&(s[o.name]=o.id)})}),Object.entries(s).map(([n,a])=>({amenity:{id:a,name:n}}
1))},Ws=t=>t.brand,qa=t=>{const s={};return t.forEach(n=>{const a=Ws(n);a!=null&&a.name&&(s[a.name]=a.id)}),Object.entries(s).map(([n,a])=>({brand:{id:a,name:n}}))},Js=t=>t.area,Wa=t=>{const s={};return t.forEach(n=>{const a=Js(n);a!=null&&a.name&&(s[a.name]=a.id)}),Object.entries(s).map(([n,a])=>({district:{id:a,name:n}}))},Jt=t=>t.distanceInMeters,Ks=t=>t.freeCancellation,Ja=t=>t.filter(n=>!!Ks(n)),Ka={minPrice:(t,s,n)=>((new URLSearchParams(window.location.search).get("priceFilter")||n)==="price"?Ve(t):bt(t))>=s,maxPrice:(t,s,n)=>((new URLSearchParams(window.location.search).get("priceFilter")||n)==="price"?Ve(t):bt(t))<=s,propertyClass:(t,s)=>{const n=Vs(t);return Array.isArray(s)&&n?s.map(Number).includes(n):n===s},guestRating:(t,s)=>{const n=Gs(t);return Array.isArray(s)?s.map(Number).includes(n):n===s},propertyType:(t,s)=>{const n=Xs(t);return Array.isArray(s)&&n?s.map(a=>Number(a)).includes(n.id):(n==null?void 0:n.id)===Number(s)},amenity:(t,s)=>{const n=qs(t);return n?Array.isArray(s)?s.map(a=>Number(a)).some(a=>n.some(o=>o.id===a)):n.some(a=>a.id===Number(s)):!1},brand:(t,s)=>{const n=Ws(t);return Array.isArray(s)&&n?s.map(Number).includes(n.id):(n==null?void 0:n.id)===Number(s)},name:(t,s)=>{const n=Va(t);return n==null?void 0:n.toLowerCase().includes(s.toLowerCase())},popularFilters:t=>Ks(t)||!1,district:(t,s)=>{const n=Js(t);return n?Array.isArray(s)?s.map(Number).includes(n.id):n.id===Number(s):!1}},Ya={cheapest:(t,s)=>{const n=Ve(t),a=Ve(s);return n-a},rating:(t,s)=>{const n=Nt(t),a=Nt(s);return Number(a)-Number(n)},distance:(t,s)=>{const n=Jt(t),a=Jt(s);return Number(n)-Number(a)},popular:(t,s)=>{const n=Wt(t),a=Wt(s);return Number(a)-Number(n)}},oe=t=>t&&t.replace(/^http:\/\//i,"https://"),Qa=()=>e.jsxs("div",{className:"py-10",children:[e.jsx("section",{className:"container space-y-4 py-4",children:e.jsx("div",{className:"bg-body-dark/10 h-8 w-40 animate-pulse rounded-lg"})}),e.jsxs("section",{className:"container flex flex-col gap-6 p-4 xl:flex-row",children:[e.jsxs("div",{className:"grow space-y-6",children:[e.jsx("div",{className:"bg-body-dark/10 h-96 animate-pulse rounded-lg"}),e.jsx("div",{className:"bg-body-dark/10 h-64 animate-pulse rounded-lg"}),e.jsx("div",{className:"bg-body-dark/10 h-48 animate-pulse rounded-lg"})]}),e.jsx("div",{className:"hidden w-full max-w-[36%] shrink-0 grow space-y-6 xl:block",children:e.jsx("div",{className:"bg-body-dark/10 h-80 animate-pulse rounded-lg"})})]})]}),el=Qa,tl=({order:t,hotelDetails:s})=>{var n,a,o,l,r,i,d;const{t:u}=L(["hotels_common"]),{trackEvent:c}=W(),{bookingSource:m}=At(),p=t!=null&&t.hotel.address&&(t!=null&&t.hotel.city)?`${t==null?void 0:t.hotel.address}, ${t==null?void 0:t.hotel.city}`:(t==null?void 0:t.hotel.address)||(t==null?void 0:t.hotel.city),x=g.useMemo(()=>Ae({from:new Date(t.reservation.checkin),to:new Date(t.reservation.checkout),units:["day"]}),[t]),f=`https://maps.google.com/?q=${t==null?void 0:t.hotel.mapCoordinates.latitude},${t==null?void 0:t.hotel.mapCoordinates.longitude}`,_=g.useMemo(()=>{const v=b=>b.toISOString().replace(/[-:]/g,"").split(".")[0]+"Z",j=v(new Date(t.reservation.checkin)),y=v(new Date(t.reservation.checkout)),N=`Check in  ${t.hotel.hotelName}: ${t.reservation.checkin}`;return`https://calendar.google.com/calendar/render?action=TEMPLATE&dates=${j}/${y}&text=${encodeURIComponent(N)}`},[t]);return g.useEffect(()=>{c({event:"stays_confirmation_page_loaded",data:{booking_type:"hotel",location_name:t.hotel.city,hotel_name:t.hotel.hotelName,hotel_code:t.hotel.hotelId,package_id:t.packageId,checkin_date:t.reservation.checkin,checkout_date:t.reservation.checkout,rooms_count:t.reservation.rooms,room_type:t.selectedRoomInfo.roomOption.roomBasis,guests_count:t.reservation.children+t.reservation.adults,payment_method:"credit_card",price:t.fare.totalPrice,star_rating:t.hotel.star,booking_source:m}})},[t,m]),e.jsxs(z,{className:"space-y-8",children:[e.jsx(h,{variant:"heading-M",className:"font-semibold",children:u("hotels_common:booking_details")}),e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx(ue,{className:"rounded-M h-24 w-24 object-cover",src:oe((n=t.hotel.images)==null?void 0:n[0]),alt:t.hotel.hotelName}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-text-secondary flex items-center gap-1",children:[e.jsx(h,{variant:"body-S",children:u("hotels_common:hotel")}),!!parseInt(((a=t.hotel)==null?void 0:a.star)||"")&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"rtl:h-4",children:"•"}),e.jsx(ea,{className:"[&_path]:fill-text-secondary h-3 w-3 shrink-0"}),e.jsx("span",{children:t.hotel.star})]})]}),e.jsx(h,{variant:"label-L",children:t.hotel.hotelName}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:((o=t.hotel)==null?void 0:o.address)||`${(l=t.hotel)==null?void 0:l.city}, ${(r=t.hotel)==null?void 0:r.country}`})]})]}),s&&e.jsx("div",{className:"max-w-lg",children:e.jsx(qe,C({numberOfNights:x.day,checkInTime:s.checkinBeginTime,checkOutTime:s==null?void 0:s.checkoutTime,checkInDate:t.reservation.checkin,checkOutDate:t.reservation.checkout},((i=t.cancellationPolicies)==null?void 0:i.hasFreeCancellation)&&{freeCancellationDate:(d=t.cancellationPolicies.cancellationPolicyDetails)==null?void 0:d.dateFrom}))}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Mt,{className:"h-6 w-6 shrink-0"}),e.jsx("div",{className:"space-y-1",children:t.payment_status!=="on-hold"&&t.booking_status?e.jsxs(e.Fragment,{children:[e.jsx(h,{variant:"label-M",children:u("hotels_common:confirmation_number")}),e.jsx(h,{color:"text-secondary",children:t.reservation.orderNumber})]}):e.jsxs(e.Fragment,{children:[e.jsx(h,{children:u("hotels_common:retrieving")}),e.jsx(Cs,{className:"text-text-secondary h-4 w-4 shrink-0 animate-spin"})]})})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Pt,{className:"h-6 w-6 shrink-0"}),e.jsxs("div",{children:[e.jsx(h,{variant:"label-M",children:u("hotels_common:guests")}),e.jsxs(h,{variant:"body-S",color:"text-secondary",className:"flex items-center gap-1",children:[e.jsxs("span",{children:[u("hotels_common:adults",{count:t==null?void 0:t.reservation.adults}),","]}),!!(t!=null&&t.reservation.children)&&e.jsx(e.Fragment,{children:e.jsxs("span",{children:[u("hotels_common:child",{count:t==null?void 0:t.reservation.children}),","]})}),e.jsx("span",{children:u("hotels_common:rooms",{count:t==null?void 0:t.reservation.rooms})})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Pe,{className:"h-6 w-6 shrink-0"}),e.jsxs("div",{children:[e.jsx(h,{variant:"label-M",children:u("hotels_common:location")}),e.jsx(D,{theme:"transparent",shape:"text",className:"p-px text-left",as:de,target:"_blank",href:f,children:e.jsx(h,{variant:"link-M",color:"text-secondary",children:p})})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 lg:gap-6",children:[!!t.reservation.voucherUrl&&e.jsx(D,{theme:"action",shape:"outlined",as:"a",download:!0,href:t.reservation.voucherUrl,className:"w-full sm:max-w-56",children:u("hotels_common:download_confirmation")}),e.jsxs(D,{as:"a",href:_,target:"_blank",theme:"white",shape:"outlined",className:"w-full sm:max-w-56",children:[e.jsx(Is,{className:"h-6 w-6 shrink-0"}),u("hotels_common:add_to_calendar")]}),e.jsx(bs,{data:{title:t.hotel.hotelName,text:t.hotel.hotelName,url:window.location.href},render:({share:v})=>e.jsxs(D,{theme:"action",shape:"outlined",className:"w-full sm:max-w-56",onClick:v,children:[e.jsx(Ls,{className:"h-6 w-6 shrink-0"}),u("hotels_common:share_booking_details")]})})]})]})},sl=tl,nl=({order:t,className:s})=>{const[n,a]=g.useState(!1),{mutateAsync:o,error:l}=ja(),{isWebView:r}=Re(),{locale:i}=R(),{t:d}=L(["hotels_common"]),{trackEvent:u}=W(),c=g.useMemo(()=>{const p=new Date(t.reservation.checkin),x=new Date(t.reservation.checkout);return Ae({from:p,to:x,units:["day"]}).day},[t.reservation.checkin,t.reservation.checkout]),m=()=>je(null,null,function*(){a(!0),yield o({id:t.hotelReservationId,lang:i},{onError:p=>{u({event:"stays_error_occurred",data:{screen:"Confirmation",error_type:p.name,error_message:p.message}})}}),a(!1)});return e.jsxs("div",{className:s,children:[e.jsx(H,{type:"ticket_edges",className:"text-body-level-1"}),e.jsxs("div",{className:"border-paper bg-paper-level-1 relative -mt-1 space-y-4 p-4",children:[e.jsxs("div",{children:[e.jsx(h,{variant:"heading-M",children:d("hotels_common:invoice_summary")}
1),e.jsx(U,{originalPrice:t.fare.totalPrice,currency:t.fare.currency,className:"text-text-secondary"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(h,{className:"flex items-center gap-1",children:[e.jsx(h,{as:"span",color:"text-secondary",children:d("hotels_common:rooms",{count:t.reservation.rooms})}),e.jsx(we,{className:"h-3 w-3 shrink-0"}),e.jsx(h,{as:"span",variant:"body-S",children:d("hotels_common:nights",{count:c})})]}),e.jsx(U,{currencyClassName:"text-body-S",priceClassName:"text-body-S",originalPrice:t.fare.fareDetails.baseFare,currency:t.fare.currency})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(h,{className:"flex items-center gap-1",children:e.jsx(h,{as:"span",variant:"body-S",color:"text-secondary",children:d("hotels_common:vat_percentage")})}),e.jsx(U,{currencyClassName:"text-body-S text-text-secondary",priceClassName:"text-body-S text-text-secondary",originalPrice:t.fare.fareDetails.vat,currency:t.fare.currency})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between",children:[e.jsx(h,{variant:"body-L",strong:!0,children:d("hotels_common:total")}),e.jsx(U,{currencyClassName:"text-body-L",priceClassName:"text-body-L",originalPrice:t.fare.totalPrice,currency:t.fare.currency,changeable:!0})]}),(l==null?void 0:l.message)&&e.jsx(h,{color:"error",children:l.message}),!r&&e.jsxs(D,{theme:"action",shape:"outlined",className:"w-full",onClick:m,loading:n,disabled:t.payment_status==="on-hold",children:[e.jsx(Mt,{className:"h-6 w-6 shrink-0"}),e.jsx("span",{children:d("hotels_common:download_invoice")})]})]}),e.jsx(H,{type:"ticket_edges",className:"text-body-level-1 rotate-180"})]})},Kt=nl,al=({details:t})=>{const{t:s}=L(["hotels_common"]),n=g.useMemo(()=>{var a;return(a=t.policies)==null?void 0:a.filter(o=>{var l;return((l=o.category)==null?void 0:l.title)&&o.policyDetails})},[t.policies]);return n!=null&&n.length?e.jsx(z,{className:"border-paper space-y-2",children:e.jsx(ye,{contentClassName:"pt-2",defaultOpen:!0,trigger:e.jsxs(D,{theme:"transparent",className:"w-full justify-between p-px",shape:"text",children:[e.jsx(h,{variant:"heading-M",children:s("hotels_common:note_that")}),e.jsx(se,{className:"h-4 w-4 rotate-90 transition-all"})]}),children:e.jsx("div",{className:"pt-4",children:n.map((a,o)=>e.jsxs(g.Fragment,{children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx(h,{variant:"heading-S",children:a.category.title}),e.jsx("div",{className:"prose text-body-dark",dangerouslySetInnerHTML:{__html:a.policyDetails}})]}),o!==n.length-1&&e.jsx(H,{className:"my-6"})]},o))})})}):null},ll=al,ol=({id:t})=>{const[s,n]=g.useState(!0),{isWebView:a}=Re(),{locale:o}=R(),{t:l}=L(["hotels_common"]),{trackEvent:r}=W(),{data:i,isLoading:d,isError:u,error:c}=ya({lang:o,id:t},{refetchInterval:s?1e3*30:!1,refetchOnWindowFocus:s}),{data:m,isLoading:p}=mt({hotelId:String(i==null?void 0:i.hotel.hotelId),lang:o},{enabled:!!(i!=null&&i.hotel.hotelId)});return g.useEffect(()=>{((i==null?void 0:i.booking_status)==="processed"||(i==null?void 0:i.booking_status)==="failed")&&n(!1)},[i==null?void 0:i.booking_status]),g.useEffect(()=>{c&&r({event:"stays_error_occurred",data:{screen:"Confirmation",error_type:c.name,error_message:c.message}})},[c]),d||p?e.jsx(el,{}):!i||u?e.jsx("section",{className:"mx-auto max-w-xl p-4 pb-12",children:e.jsxs("div",{className:"space-y-8 shadow-md",children:[e.jsx(h,{color:"error",variant:"heading-M",className:"text-center",children:(c==null?void 0:c.message)||l("hotels_common:unknown_error")}),e.jsx("div",{className:"mx-auto w-full max-w-xs",children:e.jsx(D,{as:de,href:`/${o}`,theme:"action",shape:"outlined",className:"w-full text-lg",children:l("hotels_common:go_home")})})]})}):e.jsxs("section",{className:"container",children:[e.jsx("div",{className:"py-4",children:e.jsxs(D,{as:a?"button":de,to:`/${o}/profile/bookings/hotels`,theme:"secondary",shape:"text",className:"gap-2 px-px py-1",onClick:()=>{var x;a&&((x=window.ReactNativeWebView)==null||x.postMessage(JSON.stringify({eventName:"PAYMENTSUCCESS",source:"hotels",order:{order_id:i.reservation.orderNumber,total:i.fare.totalPrice}})))},children:[e.jsx(se,{className:"h-3 w-3 ltr:rotate-180"}),l("hotels_common:back_to_orders")]})}),e.jsxs("div",{className:"pb-6",children:[e.jsxs("div",{className:"xs:flex-row xs:items-center inline-flex flex-col-reverse gap-4",children:[i.booking_status==="failed"?e.jsx(h,{as:"h1",variant:"heading-XL",className:"lg:text-5xl",children:l("hotels_common:unable_to_complete_booking")}):i.booking_status==="approved"?e.jsx(h,{as:"h1",variant:"heading-XL",className:"lg:text-5xl",children:l("hotels_common:your_payment_has_been_received")}):e.jsx(h,{as:"h1",variant:"heading-XL",className:"lg:text-5xl",children:l("hotels_common:your_booking_is_confirmed")}),i.booking_status==="failed"?e.jsx(we,{className:"text-error h-10 w-10"}):e.jsx(Dt,{className:"h-14 w-14 text-transparent [&_path]:fill-green-500"})]}),i.booking_status==="failed"?e.jsx(h,{variant:"body-L",color:"text-secondary",children:l("hotels_common:refund_on_the_way",{amount:i.fare.totalPrice,currency:i.fare.currency})}):i.booking_status==="approved"?e.jsx(h,{variant:"body-L",color:"text-secondary",children:l("hotels_common:we_are_processing_your_booking")}):e.jsx(h,{variant:"body-L",color:"text-secondary",children:l("hotels_common:confirmation_email_sent",{email:i.contact.email})})]}),e.jsxs("div",{className:"flex flex-col pb-6 lg:gap-6 xl:flex-row",children:[e.jsxs("div",{className:"grow space-y-6",children:[e.jsx(sl,{order:i,hotelDetails:m}),e.jsx(Kt,{order:i,className:"block lg:hidden"}),m&&e.jsx(ll,{details:m})]}),e.jsx("div",{className:"mb-6 w-full shrink-0 grow space-y-6 lg:mb-0 xl:max-w-[36%]",children:e.jsxs("div",{className:"top-20 space-y-6 xl:sticky",children:[e.jsx(Kt,{order:i,className:"hidden lg:block"}),e.jsx(Ft,{order:i}),e.jsx(ke,{})]})})]})]})},gd=ol,rl=()=>e.jsxs("div",{className:"bg-body-dark/10 relative flex h-52 w-full max-w-sm animate-pulse flex-col items-start justify-start px-4 py-3",children:[e.jsx("div",{className:"bg-body absolute -left-2 -top-2 h-4 w-4 rotate-45"}),e.jsx("div",{className:"bg-body absolute -bottom-2 -left-2 h-4 w-4 rotate-45"}),e.jsx("div",{className:"bg-body absolute -right-2 -top-2 h-4 w-4 rotate-45"}),e.jsx("div",{className:"bg-body absolute -bottom-2 -right-2 h-4 w-4 rotate-45"}),e.jsx("div",{className:"bg-body absolute -left-2 top-1/2 h-4 w-4 translate-y-1/2 rotate-45"})]}),il=rl,cl=({status:t,className:s,showIcon:n=!0})=>{const{t:a}=L("hotels_common");return e.jsx("div",{className:s,children:t==="processed"?e.jsxs(h,{color:"success",variant:"label-S",className:"flex items-center gap-1",children:[n&&e.jsx(Me,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{children:a("hotels_common:booking_confirmed")})]}):t==="failed"?e.jsxs(h,{color:"error",variant:"label-S",className:"flex items-center gap-1",children:[n&&e.jsx(dt,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{children:a("hotels_common:booking_failed")})]}):e.jsxs(h,{variant:"label-S",className:"flex items-center gap-1 text-blue-500",children:[n&&e.jsx(Cs,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{children:a("hotels_common:confirming_your_booking")})]})})},dl=cl,ul=({order:t})=>{var s;const{locale:n}=R(),{t:a}=L(["hotels_common"]),{trackEvent:o}=W(),{checkInDate:l,checkOutDate:r}=g.useMemo(()=>({checkInDate:V(t.reservation.checkin,n,{day:"2-digit",month:"short",year:"numeric"}),checkOutDate:V(t.reservation.checkout,n,{day:"2-digit",month:"short",year:"numeric"})}),[t,n]);return e.jsxs(D,{className:"bg-body-level-1 relative flex w-full max-w-sm flex-col items-start justify-start px-4 py-3",theme:"transparent",shape:"text",as:de,to:`/profile/bookings/hotels/${t.hotelReservationId}`,onClick:()=>{o({event:"stays_bookings_card_clicked"})},children:[e.jsx("div",{className:"bg-body absolute -left-2 -top-2 h-4 w-4 rotate-45"}),e.jsx("div",{className:"bg-body absolute -bottom-2 -left-2 h-4 w-4 rotate-45"}),e.jsx("div",{className:"bg-body absolute -right-2 -top-2 h-4 w-4 rotate-45"}),e.jsx("div",{className:"bg-body absolute -bottom-2 -right-2 h-4 w-4 rotate-45"}),e.jsx("div",{className:"bg-body absolute -left-2 top-1/2 h-4 w-4 translate-y-1/2 rotate-45"}),e.jsxs("div",{className:"w-full space-y-4 text-start",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx(ue,{src:oe((s=t.hotel.images)==null?void 0:s[0]),alt:t.hotel.hotelName,className:"rounded-S h-20 w-20"}),e.jsxs("div",{children:[e.jsx(h,{variant:"label-M",children:t.hotel.hotelName}),e.jsxs(h,{variant:"body-S",color:"text-secondary",children:[!!t.hotel.city&&`${t.hotel.city},`," ",!!t.hotel.country&&`${t.hotel.country},`," ",t.hotel.address]})]})]}),e.jsxs("div",{children:[e.jsxs(h,{variant:"body-S",children:[l," - ",r]}),e.jsxs(h,{variant:"body-S",color:"text-secondary",children:[e.jsxs("span",{children:[a("hotels_common:booking_id"),":"]})," ",e.jsx("span",{children:t.reservation.orderNumber})]})]}),e.jsxs("div",{className:"flex w-full items-center justify-between gap-1 text-sm",children:[e.jsx(dl,{status:t.booking_status}),e.jsx(se,{className:"h-3 w-3 shrink-0 rtl:rotate-180"})]})]})]})},ml=ul,hl=({orders:t,title:s})=>e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-base capitalize",children:s}),e.jsx("ul",{className:"space-y-6",children:t.map(n=>e.jsx("li",{children:e.jsx(ml,{order:n})},n.reservation.orderNumber))})]}),Yt=hl,gl=()=>{const{locale:t}=R(),{t:s}=L("hotels_common"),{data:n,isLoading:a,error:o}=_a({lang:t}),{trackEvent:l}=W(),{pastHotelOrders:r,upcomingHotelOrders:i}=g.useMemo(()=>{const d=[],u=[];for(const c of n||[])c.reservation.checkin<Z(new Date,t,{day:"2-digit",month:"2-digit",year:"numeric"}).date?u.push(c):d.push(c);return{pastHotelOrders:u,upcomingHotelOrders:d}},[n,t]);return g.useEffect(()=>{const d=i.map(u=>u.hotelReservationId);l({event:"stays_bookings_tab_clicked",data:{active_bookings:d}})},[]),g.useEffect(()=>{o&&l({event:"stays_error_occurred",data:{screen:"Bookings",error_type:o.name,error_message:o.message}})},[o]),a?e.jsx("div",{className:"space-y-4 py-4",children:[1,2,3,4].map(d=>e.jsx(il,{},d))}):o?e.jsx("div",{className:"mx-auto max-w-xl p-4 pb-12",children:e.jsxs("div",{className:"space-y-8 shadow-md",children:[e.jsx(h,{color:"error",variant:"heading-M",className:"text-center",children:(o==null?void 0:o.message)||s("hotels_common:unknown_error")}),e.jsx("div",{className:"mx-auto w-full max-w-xs",children:e.jsx(D,{as:de,href:`/${t}`,theme:"action",shape:"outlined",className:"w-full text-lg",children:s("hotels_common:go_home")})})]})}):n!=null&&n.length?e.jsxs("div",{className:"space-y-10 px-0.5",children:[i.length>0&&e.jsx(Yt,{orders:i,title:s("hotels_common:upcoming_stays")}),r.length>0&&e.jsx(Yt,{orders:r,title:s("hotels_common:past_stays")})]}):e.jsxs("div",{className:"px-4 py-8 text-center",children:[e.jsx("div",{className:"mx-auto flex items-center justify-center rounded-full",children:e.jsx(Us,{className:"text-text-primary h-12 w-12"})}),e.jsx(h,{variant:"heading-L",className:"py-3",children:s("hotels_common:no_upcoming_stays")})]})}
1,vd=gl,ze=8,vl=4,Qt=20,xl=[{label:"under_one",value:"0",id:"child_age_under_one"}],fl=xl.concat(Array.from({length:11},(t,s)=>s+1).map(t=>({label:"years_old",value:t.toString(),id:`child_age_${t}`}))),pl=(t,s,n)=>{const a=t.reduce((x,f)=>x+f,0),o=s.reduce((x,f)=>x+f,0),l=a+o,r=[];n.forEach(x=>{x.forEach(f=>{r.push(f)})});const i=Math.max(t.length,Math.ceil(l/ze)),d=[],u=[],c=[];let m=a,p=0;for(let x=0;x<i;x++){if(x===i-1)d.push(m);else{const v=Math.min(m,ze);d.push(v),m-=v}const f=ze-d[x],_=Math.min(o-p,f);u.push(_),c.push(r.slice(p,p+_)),p+=_}return{adults:d,children:u,childrenAges:c}},yl=t=>e.jsx("svg",P(C({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 1.375C2 1.16789 2.16789 1 2.375 1H9.625C9.83211 1 10 1.16789 10 1.375V10.625C10 10.8321 9.83211 11 9.625 11H2.375C2.16789 11 2 10.8321 2 10.625V1.375ZM2.75 1.75V5.5H6.125C6.33211 5.5 6.5 5.66789 6.5 5.875V10.25H9.25V1.75H2.75ZM5.75 10.25V6.25H2.75V10.25H5.75Z",fill:"currentColor"})})),gt=t=>e.jsx("svg",P(C({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1 2.375C1 2.16789 1.16789 2 1.375 2H10.625C10.8321 2 11 2.16789 11 2.375V9.625C11 9.83211 10.8321 10 10.625 10H1.375C1.16789 10 1 9.83211 1 9.625V2.375ZM1.75 2.75V8.21967L2.85983 7.10984C2.93016 7.03951 3.02554 7 3.125 7H8.87263C8.97199 7 9.06729 7.03943 9.1376 7.10964L10.25 8.22042V2.75H1.75ZM10.2196 9.25L8.71746 7.75H3.28033L1.78033 9.25H10.2196Z",fill:"currentColor"})})),_l=t=>e.jsx("svg",P(C({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.5 3H13.5V6H16.5V13.875H17.25V15H0.75V13.875H1.5V6H4.5V3ZM4.5 7.125H2.625V13.875H4.5V7.125ZM5.625 13.875H6.75V10.5H11.25V13.875H12.375V4.125H5.625V13.875ZM13.5 13.875H15.375V7.125H13.5V13.875ZM10.125 13.875V11.625H7.875V13.875H10.125Z",fill:"currentColor"})})),jl=t=>e.jsxs("svg",P(C({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:[e.jsxs("g",{clipPath:"url(#clip0_11143_716)",children:[e.jsx("path",{d:"M11.0162 5.8613C10.4462 6.26365 9.75071 6.5 9 6.5C7.067 6.5 5.5 4.93299 5.5 3C5.5 2.2493 5.73634 1.5538 6.13868 0.983848C6.09292 0.982615 6.04701 0.981995 6.00096 0.981995C3.23011 0.981995 0.983887 3.22821 0.983887 5.99906C0.983887 8.76992 3.23011 11.0161 6.00096 11.0161C8.77181 11.0161 11.018 8.76992 11.018 5.99906C11.018 5.953 11.0174 5.90707 11.0162 5.8613Z",fill:"currentColor"}),e.jsx("path",{d:"M8.16667 2.66667L8.75 1.5L9.33333 2.66667L10.5 3.25L9.33333 3.83333L8.75 5L8.16667 3.83333L7 3.25L8.16667 2.66667Z",fill:"currentColor"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_11143_716",children:e.jsx("rect",{width:"12",height:"12",fill:"currentColor"})})})]})),Ys=t=>e.jsxs("svg",P(C({width:"66",height:"62",viewBox:"0 0 66 62",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:[e.jsx("path",{d:"M58 7L59.6334 12.3666L65 14L59.6334 15.6334L58 21L56.3666 15.6334L51 14L56.3666 12.3666L58 7Z",fill:"currentColor"}),e.jsx("path",{d:"M50.5 2L51.5501 5.44995L55 6.5L51.5501 7.55005L50.5 11L49.4499 7.55005L46 6.5L49.4499 5.44995L50.5 2Z",fill:"currentColor"}),e.jsx("path",{d:"M47.5 14L48.5501 17.4499L52 18.5L48.5501 19.5501L47.5 23L46.4499 19.5501L43 18.5L46.4499 17.4499L47.5 14Z",fill:"currentColor"}),e.jsx("path",{d:"M10.4782 51.2868H44.6495V54.3415H9.13334L1.9043 46.4558L4.15791 44.3903L10.4782 51.2868Z",fill:"currentColor"}),e.jsx("path",{d:"M17.3085 53.6071L12.3492 61.7292L11.0457 60.9351L9.74219 60.1388L14.7015 52.0143L17.3085 53.6071Z",fill:"currentColor"}),e.jsx("path",{d:"M34.5372 53.6071L39.4965 61.7292L40.8 60.9351L42.1035 60.1388L37.1442 52.0143L34.5372 53.6071Z",fill:"currentColor"}),e.jsx("path",{d:"M27.8154 34.0004L24.8995 52.7295L21.879 52.2592L24.7949 33.5302L27.8154 34.0004Z",fill:"currentColor"}),e.jsx("path",{d:"M29.939 14.9829C36.6943 16.1718 40.4223 20.6772 42.3549 25.0956C43.3174 27.2961 43.8506 29.5019 44.1141 31.3335C44.3721 33.1274 44.3886 34.6862 44.2311 35.5813L43.9662 37.0866L34.4734 35.416L34.1122 34.8468L33.0348 33.1565L31.4474 34.3778L30.9136 34.7896L21.0411 33.0522L20.6821 32.4833L19.6048 30.793L18.0151 32.0139L17.4813 32.4257L7.98849 30.7551L8.25338 29.2497C8.40499 28.3882 9.49931 24.1476 12.6972 20.4426C15.9818 16.6374 21.4268 13.4852 29.939 14.9829ZM29.4092 17.9937C22.0492 16.6987 17.6565 19.3753 
115.0116 22.4392C13.2126 24.5234 12.199 26.8283 11.6893 28.3024L16.6889 29.1823L20.3883 26.3402L22.8954 30.2745L30.1189 31.5458L33.8207 28.7041L36.3277 32.6384L41.2549 33.5055C41.231 33.0119 41.1867 32.4263 41.0921 31.7688C40.8602 30.1563 40.3901 28.2247 39.5575 26.3208C37.8993 22.5293 34.8641 18.9536 29.4092 17.9937Z",fill:"currentColor"}),e.jsx("path",{d:"M27.2677 16.7106C26.4935 17.8336 25.2899 20.046 24.1355 22.4605C22.9831 24.8707 21.9456 27.3432 21.4642 28.9673L20.0004 28.5326L18.5363 28.1002C19.0876 26.2402 20.2087 23.5918 21.3803 21.1414C22.5498 18.6954 23.8372 16.3059 24.7532 14.9771L27.2677 16.7106Z",fill:"currentColor"}),e.jsx("path",{d:"M30.6392 17.3037C30.9836 18.6236 31.3597 21.114 31.6205 23.7775C31.8809 26.4363 32.0121 29.1145 31.9101 30.8054L33.4343 30.8965L34.9582 30.9899C35.0749 29.0535 34.9252 26.1814 34.6605 23.4783C34.3962 20.78 34.0018 18.0945 33.5944 16.5328L30.6392 17.3037Z",fill:"currentColor"})]})),bl=t=>e.jsxs("svg",P(C({width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:[e.jsx("g",{clipPath:"url(#clip0_7491_54094)",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 3H30V16.5H27V6H9V30H15.75V33H6V3ZM12 9H24V12H12V9ZM12 15H19.5V18H12V15ZM24.75 22.5C22.6789 22.5 21 24.1789 21 26.25C21 28.3211 22.6789 30 24.75 30C25.7996 30 26.7463 29.5707 27.4286 28.8744C28.0929 28.1965 28.5 27.2723 28.5 26.25C28.5 24.1789 26.8211 22.5 24.75 22.5ZM18 26.25C18 22.5221 21.0221 19.5 24.75 19.5C28.4779 19.5 31.5 22.5221 31.5 26.25C31.5 27.5584 31.1267 28.7811 30.4821 29.8157L32.871 32.2851L30.7149 34.371L28.3704 31.9476C27.3244 32.6134 26.0817 33 24.75 33C21.0221 33 18 29.9779 18 26.25Z",fill:"currentColor"})}),e.jsx("defs",{children:e.jsx("rect",{width:"36",height:"36",fill:"white"})})]})),Se=t=>e.jsx("svg",P(C({width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:e.jsx("path",{d:"M2.22679 9.22608C2.06063 9.10046 2.02416 8.89377 2.12547 8.59794L2.97246 6.07723L0.808385 4.52104C0.557126 4.34273 0.451759 4.15631 0.520652 3.95368C0.585494 3.75916 0.775965 3.6619 1.08801 3.66595L3.74245 3.68216L4.54891 1.1493C4.64618 0.849408 4.79207 0.699463 4.99875 0.699463C5.20948 0.699463 5.35538 0.849408 5.45264 1.1493L6.2591 3.68216L8.91354 3.66595C9.22559 3.6619 9.41606 3.75916 9.4809 3.95368C9.54574 4.15631 9.44443 4.34273 9.19317 4.52104L7.02909 6.07723L7.87608 8.59794C7.97739 8.89377 7.94092 9.10046 7.77477 9.22608C7.60456 9.35577 7.39788 9.31119 7.14662 9.12882L4.99875 7.55237L2.85494 9.12882C2.60368 9.31119 2.39294 9.35577 2.22679 9.22608Z",fill:"currentColor"})})),Nl=t=>e.jsx("svg",P(C({xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none"},t),{children:e.jsx("path",{d:"M11.5014 9.16659H14.1666V2.83325H11.5014M11.5014 2.83325V8.99992L8.66949 14.4999H8.25929C7.44144 14.4999 6.81656 13.7697 6.94255 12.9612L7.3261 10.4999H3.8327C2.60888 10.4999 1.67237 9.40955 1.85648 8.19903L2.41417 4.53237C2.56278 3.55524 3.40251 2.83325 4.39038 2.83325H11.5014Z",stroke:"currentColor",strokeOpacity:"0.3",strokeWidth:"1.5",strokeLinejoin:"round"})})),wl=t=>e.jsx("svg",P(C({xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none"},t),{children:e.jsx("path",{d:"M4.49998 7.49984H1.83331V13.8332H4.49998M4.49998 13.8332V7.6665L7.33331 2.1665H7.74373C8.562 2.1665 9.1872 2.89674 9.06114 3.70524L8.6774 6.1665H12.1726C13.3971 6.1665 14.3341 7.25687 14.1498 8.46739L13.5919 12.1341C13.4432 13.1112 12.603 13.8332 11.6146 13.8332H4.49998Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})})),ce={location:"",city:"",checkInDate:void 0,checkOutDate:void 0,adults:[2],children:[0],childrenAges:[[]],sId:"",price:0,view:"list"},G=()=>{const{locale:t,search:s,push:n}=R();return{state:g.useMemo(()=>{const l=s.get("checkInDate"),r=s.get("checkOutDate"),i=s.get("location")||ce.location,d=s.get("city")||ce.city,u=l?new Date(new Date(V(l,"en")).setHours(0,0,0,0)):ce.checkInDate,c=r?new Date(new Date(V(r,"en")).setHours(0,0,0,0)):ce.checkOutDate,m=s.getAll("adults").length?s.getAll("adults").map(Number):ce.adults,p=s.getAll("children").length?s.getAll("children").map(Number):ce.children,x=s.getAll("childrenAges").filter(y=>y!=="").length?s.getAll("childrenAges").map(y=>y.split(",")):ce.childrenAges,f=s.get("sId")||ce.sId,_=Number(s.get("price"))||ce.price,v=s.get("view")||ce.view,j=s.get("isEvisa")==="true";return{location:i,city:d,checkInDate:u,checkOutDate:c,adults:m,children:p,childrenAges:x,sId:f,price:_,view:v,isEvisa:j}},[s]),setState:({data:l,path:r,reload:i})=>{const d=new URLSearchParams;for(const c in l){const m=c;l[m]!==void 0&&((typeof l[m]=="string"||typeof l[m]=="number")&&l[m]!==void 0&&d.set(m,l[m].toString()),l[m]instanceof Date&&d.set(m,Z(l[m],t,{month:"2-digit",day:"2-digit",timeZone:void 0}).date),Array.isArray(l[m])&&l[m].forEach(p=>{d.append(m,p.toString())}))}const u=`${r||`/${t}/hotels/search`}?${new URLSearchParams(d).toString()}`;i?window.location.href=u:n(u)}}},kl=t=>{var s=t,{label:n,value:a,placeholder:o,error:l,className:r,icon:i,valueClassName:d,valueTypographyVariant:u}=s,c=Te(s,["label","value","placeholder","error","className","icon","valueClassName","valueTypographyVariant"]);return e.jsxs("div",{className:"h-full w-full",children:[e.jsxs(D,P(C({className:A("border-paper bg-body/20 flex h-16 w-full items-center justify-start gap-2 border p-3 text-start",r),shape:"outlined",theme:"white",type:"button"},c),{children:[i,e.jsxs("div",{className:"space-y-1 lg:space-y-0",children:[n&&e.jsx(h,{variant:"body-S",color:"text-secondary",className:"whitespace-nowrap",children:n}),e.jsx(h,{as:"div",variant:u||"body-S",color:a?void 0:"text-secondary",className:A("text-start",d),children:a||o})]})]})),l&&e.jsx(h,{variant:"body-S",color:"error",children:l})]})},Ht=kl,Sl=({type:t})=>{const{t:s}=L(["hotels_common"]),{trackEvent:n}=W(),{control:a,watch:o,setValue:l,getValues:r}=Bs(),i=o("adults"),d=o("children"),u=o("childrenAges"),c=()=>{n({event:t==="detail"?"stays_details_rooms_selected":"stays_home_rooms_selected",data:{rooms_count:i.length+1}}),l("adults",[...i,1]),l("children",[...d,0]),l("childrenAges",[...u,[]])},m=x=>{n({event:t==="detail"?"stays_details_rooms_selected":"stays_home_rooms_selected",data:{rooms_count:i.length-1}}),l("adults",i.filter((f,_)=>_!==x)),l("children",d.filter((f,_)=>_!==x)),l("childrenAges",u.filter((f,_)=>_!==x))},p=[{label:s("hotels_common:adults"),description:s("hotels_common:adult_age"),min:1,key:"adults"},{label:s("hotels_common:children"),description:s("hotels_common:child_age"),min:0,key:"children"}];return e.jsxs("div",{className:"w-full space-y-8 md:pb-4",children:[i.map((x,f)=>{const _=d[f],v=ze-(x+_);return e.jsxs("div",{className:"w-full space-y-6",children:[e.jsxs("div",{className:"flex w-full items-center gap-3",children:[e.jsx(gt,{className:"h-6 w-6 shrink-0"}),e.jsxs("div",{children:[e.jsx(h,{children:s("hotels_common:room_number",{number:f+1})}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:s("hotels_common:max_guests",{count:ze})})]}),f>0&&e.jsx(D,{shape:"text",theme:"transparent",rounded:!0,onClick:()=>m(f),className:"ml-auto self-start px-px",children:e.jsx(we,{className:"h-4 w-4 shrink-0"})})]}),e.jsx("div",{className:"w-full space-y-6 md:space-y-4",children:p.map(j=>e.jsxs(g.Fragment,{children:[e.jsx("div",{className:"flex items-center justify-between gap-4",children:e.jsxs("div",{className:"flex w-full justify-between md:max-w-xs",children:[e.jsxs("div",{children:[e.jsx(h,{variant:"label-M",children:j.label}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:j.description})]}),e.jsx(re,{name:`${j.key}.${f}`,control:a,render:({field:{value:y}})=>e.jsxs("div",{className:"flex max-w-24 grow items-center gap-2",children:[e.jsx(D,{shape:"outlined",theme:"action",type:"button",onClick:()=>{const N=j.key==="children";l(`${j.key}.${f}`,y-1),n({event:t==="detail"?"stays_details_guests_selected":"stays_home_guests_selected",data:{adults_count:r("adults").reduce((b,S)=>b+S,0),children_count:r("children").reduce((b,S)=>b+S,0)}}),N&&(l(`childrenAges.${f}`,u[f].slice(0,-1)),n({event:t==="detail"?"stays_details_guests_child_age_selected":"stays_home_guests_child_age_selected",data:{children_ages:r("childrenAges")}}))},className:"h-[30px] w-[30px] shrink-0 p-0 text-lg font-bold",disabled:y===j.min,
1children:e.jsx("span",{className:"-mt-px",children:"-"})}),e.jsx("span",{className:"w-5 text-center",children:y}),e.jsx(D,{shape:"outlined",theme:"action",type:"button",className:"flex h-[30px] w-[30px] shrink-0 p-0 text-lg font-bold",onClick:()=>{const N=j.key==="children";l(`${j.key}.${f}`,y+1),n({event:t==="detail"?"stays_details_guests_selected":"stays_home_guests_selected",data:{adults_count:r("adults").reduce((b,S)=>b+S,0),children_count:r("children").reduce((b,S)=>b+S,0)}}),N&&(l(`childrenAges.${f}`,[...u[f],"0"]),n({event:t==="detail"?"stays_details_guests_child_age_selected":"stays_home_guests_child_age_selected",data:{children_ages:r("childrenAges")}}))},disabled:v<=0,children:e.jsx("span",{className:"-mt-px",children:e.jsx(Vt,{className:"h-3 w-3 shrink-0"})})})]})})]})}),j.key==="children"&&!!d[f]&&e.jsxs("div",{className:"flex-wrap justify-end space-y-4 md:flex md:gap-4 md:space-y-0",children:[e.jsx(h,{variant:"label-M",className:"md:hidden",children:s("hotels_common:children_age_at_checkout")}),Array.from({length:d[f]},(y,N)=>N).map(y=>e.jsxs("div",{className:"space-y-2 md:max-w-32",children:[e.jsxs(h,{variant:"label-M",className:"md:hidden",children:[s("hotels_common:child")," ",y+1]}),e.jsx(re,{name:`childrenAges.${f}.${y}`,control:a,render:({field:{value:N}})=>e.jsx(Bn,{placeholder:s("hotels_common:select_age"),options:fl.map(b=>P(C({},b),{text:s(`hotels_common:${b.label}`,{count:Number(b.value)})})),portal:!1,value:N,onChange:b=>{const S=u[f].map((w,k)=>k===y?b.value:w);l(`childrenAges.${f}`,S),n({event:t==="detail"?"stays_details_guests_child_age_selected":"stays_home_guests_child_age_selected",data:{children_ages:r("childrenAges")}})}},y)})]},y))]})]},j.key))}),f!==i.length-1&&e.jsx(H,{})]},f)}),i.length!==vl&&e.jsxs(D,{shape:"outlined",theme:"action",type:"button",className:"w-full gap-2 md:w-auto",onClick:c,children:[e.jsx(Vt,{className:"h-3 w-3 shrink-0"}),s("hotels_common:add_another_room")]})]})},Cl=Sl,Il=({type:t="start"})=>{const{t:s}=L(["hotels_common"]),{watch:n}=Bs(),a=n("adults"),o=n("children"),l=a.reduce((u,c)=>u+c,0),r=o.reduce((u,c)=>u+c,0),i=l+r,d=g.useMemo(()=>t==="start"?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(h,{as:"span",variant:"body-S",className:"line-clamp-1",children:s("hotels_common:guests",{count:i})}),e.jsx("span",{className:"rtl:h-4",children:"•"}),e.jsx(h,{as:"span",variant:"body-S",className:"line-clamp-1",children:s("hotels_common:rooms",{count:a.length})})]}):e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(gt,{className:"h-5 w-5 shrink-0"}),e.jsx(h,{as:"span",strong:!0,children:a.length})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(yt,{className:"h-5 w-5 shrink-0"}),e.jsx(h,{as:"span",strong:!0,children:i})]})]}),[i,a,s,t]);return e.jsx(Ns,{body:()=>e.jsx(Cl,{type:t}),sheet:{ignoreHistory:!0,title:e.jsxs(h,{variant:"heading-S",className:"text-center",children:[s("hotels_common:guests")," "]}),fullscreen:!0,cancel:void 0,action:void 0,customAction:({close:u})=>e.jsx(D,{theme:"action",className:"w-full",onClick:u,children:s("hotels_common:apply")})},popover:{cancel:!1,action:!1,className:"min-w-80 z-[999]",onWheel:u=>u.stopPropagation()},render:({open:u})=>e.jsx(Ht,{value:d,icon:t==="start"?e.jsx(yt,{className:"h-5 w-5 shrink-0"}):void 0,label:t==="start"?s("hotels_common:guests_and_rooms"):"",onClick:u,className:t==="detail"?"justify-center gap-1 rounded-none border-0 border-l rtl:border-r":""})})},Qs=Il,Ll=t=>{var s=t,{onChange:n,value:a,fromDate:o,dateType:l,searchType:r="start"}=s,i=Te(s,["onChange","value","fromDate","dateType","searchType"]);const{locale:d}=R(),{t:u}=L(["hotels_common"]),[c,m]=g.useState(a||[]),p=a==null?void 0:a.map(v=>v&&V(v,d,{weekday:r==="start"?"short":void 0,day:"2-digit",month:"short",timeZone:void 0})),x=o?p==null?void 0:p[1]:p==null?void 0:p[0],f=v=>{v&&(v.from||a!=null&&a[0])&&n([(v==null?void 0:v.from)||(a==null?void 0:a[0]),v.to])},_=()=>{m(a||[void 0,void 0])};return e.jsx(Ns,{body:()=>e.jsx(Dl,{value:a,fromDate:o,dateType:l,dates:c,setDates:m,handleSelect:f}),render:({open:v})=>e.jsx(Ht,P(C({},i),{placeholder:u("hotels_common:select"),icon:e.jsx(Is,{className:"h-5 w-5 shrink-0"}),value:r==="start"?x:p==null?void 0:p.join(" - "),onClick:v,valueClassName:A(i.valueClassName,r==="detail"?"font-bold":""),className:A(i.className,r==="detail"?"border-0":"")})),popover:{className:"min-w-[600px] z-[999]",action:!1,cancel:!1},sheet:{ignoreHistory:!0,action:void 0,cancel:void 0,title:e.jsx(h,{variant:"heading-S",className:"text-center",children:u("hotels_common:check_in_out")}),customAction:({close:v})=>e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx(D,{shape:"text",theme:"white",className:"-ml-4 underline underline-offset-2",onClick:_,children:u("hotels_common:reset_dates")}),e.jsx(D,{disabled:!c.length,onClick:()=>{c[0]&&f({from:c[0],to:c[1]}),v()},theme:"action",children:u("hotels_common:confirm")})]})}})},Dl=({value:t,fromDate:s,dateType:n,dates:a,setDates:o,handleSelect:l})=>(g.useEffect(()=>{o(t||[])},[]),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"block md:hidden",children:e.jsx(Pl,{value:t,fromDate:s,dateType:n,dates:a,onDatesChange:o})}),e.jsx("div",{className:"hidden md:block",children:e.jsx(Ml,{value:t,fromDate:s,dateType:n,onChange:l})})]})),Ml=({value:t,dateType:s,fromDate:n,onChange:a})=>{const{locale:o}=R();return e.jsx(ws,{className:"w-full pb-2 md:p-0",mode:"range",selected:{from:t==null?void 0:t[0],to:t==null?void 0:t[1]},lang:o,numberOfMonths:2,onSelect:a,defaultMonth:n?t==null?void 0:t[1]:t==null?void 0:t[0],weekStartsOn:0,min:1,max:28,startMonth:s==="check_out"?(t==null?void 0:t[0])||new Date:new Date})},Pl=({value:t,fromDate:s,dateType:n,dates:a,onDatesChange:o})=>{const{t:l}=L(["hotels_common"]),{locale:r}=R(),i=a==null?void 0:a.map(u=>u&&V(u,r,{weekday:"short",day:"2-digit",month:"short",timeZone:void 0})),d=u=>{u&&(u.from||t!=null&&t[0])&&o([(u==null?void 0:u.from)||(t==null?void 0:t[0]),u.to])};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-center gap-10 text-center",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{variant:"body-L",children:l("hotels_common:check_in")}),e.jsx(h,{color:"text-secondary",children:i!=null&&i[0]?i[0]:l("hotels_common:select_your_date")})]}),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-paper h-12 border"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{variant:"body-L",children:l("hotels_common:check_out")}
1),e.jsx(h,{color:"text-secondary",children:i!=null&&i[1]?i[1]:l("hotels_common:select_your_date")})]})]})]}),e.jsx(H,{className:"my-6 block"}),e.jsx(ws,{className:"w-full pb-2 md:p-0",mode:"range",selected:{from:a==null?void 0:a[0],to:a==null?void 0:a[1]},lang:r,numberOfMonths:1,value:a,onSelect:d,defaultMonth:s?a==null?void 0:a[1]:a==null?void 0:a[0],weekStartsOn:0,min:1,max:28,startMonth:n==="check_out"?(a==null?void 0:a[0])||new Date:new Date})]})},wt=Ll,El=({value:t,onChange:s,error:n})=>{var a;const{locale:o}=R(),[l,r]=g.useState(""),i=g.useRef(void 0),{t:d}=L(["hotels_common"]),{data:u,isLoading:c}=ba({lang:o}),{state:m}=G(),p=(l==null?void 0:l.length)>=3||(((a=t==null?void 0:t.city)==null?void 0:a.length)||0)>=3,{data:x,isFetching:f}=Na({search:l||(t==null?void 0:t.city),lang:o},{enabled:p,placeholderData:u}),_=g.useMemo(()=>x?[...x.hotels,...x.locations].find(b=>b.placeId===(t==null?void 0:t.location)||b.hotelId===Number(t==null?void 0:t.location))||x.locations.find(b=>b.city===(t==null?void 0:t.city)):null,[x,t]),v=g.useMemo(()=>{if(!_)return"";let N="";return _.city&&(N=_.city,_.country&&(N+=_.name&&_.city!==_.name?` (${_.country})`:` - ${_.country}`)),_.name&&_.city!==_.name&&(N.length>0?N+=` - ${_.name}`:(N=_.name,_.country&&_.name!==_.country&&(N+=` - ${_.country}`))),N},[_]),j=g.useMemo(()=>{var N,b;const S=!f&&!c&&!(x!=null&&x.hotels.length)&&!(x!=null&&x.locations.length);if(f||c)return[1,2,3,4].map(I=>({id:I.toString(),value:I.toString(),text:e.jsx("div",{className:"flex h-10 w-full items-center gap-2",children:e.jsxs("div",{className:"w-full space-y-2",children:[e.jsx("div",{className:"bg-body-dark/10 h-2 max-w-[50%] animate-pulse rounded-sm"}),e.jsx("div",{className:"bg-body-dark/10 h-2 max-w-[60%] animate-pulse rounded-sm"})]})}),disabled:!0}));if(S)return[];const w=((N=x==null?void 0:x.hotels)==null?void 0:N.map((I,O)=>{const M=m.isEvisa&&I.is_evisa_excluded;return{id:I.hotelId.toString(),value:I.hotelId.toString(),text:e.jsx("div",{className:"w-full",children:e.jsxs("div",{className:"flex w-full items-center gap-4",children:[e.jsx(_l,{className:"h-5 w-5 shrink-0"}),e.jsxs("div",{children:[e.jsx(h,{color:M?"notice":void 0,children:I.name}),M?e.jsx(h,{variant:"body-S",color:"notice",children:d("hotels_common:excluded_city_note",{city:I.city})}):e.jsxs(h,{variant:"body-S",color:"text-secondary",children:[I.city&&`${I.city},`," ",e.jsx("span",{children:I.country})]})]})]},O)})}}))||[];return[...((b=x==null?void 0:x.locations)==null?void 0:b.map((I,O)=>{const M=m.isEvisa&&I.is_evisa_excluded;return{id:I.placeId,value:I.placeId,text:e.jsx("div",{className:"w-full",children:e.jsxs("div",{className:"flex w-full items-center gap-4",children:[e.jsx(Pe,{className:"h-5 w-5 shrink-0"}),e.jsxs("div",{children:[e.jsx(h,{color:M?"notice":void 0,children:I.name}),M?e.jsx(h,{variant:"body-S",color:"notice",children:d("hotels_common:excluded_city_note",{city:I.city})}):e.jsxs(h,{variant:"body-S",color:"text-secondary",children:[I.city&&`${I.city},`," ",e.jsx("span",{children:I.country})]})]})]},O)})}}))||[],...w]},[f,x,c,m,d]),y=N=>{clearTimeout(i.current),i.current=setTimeout(()=>{const b=N.trim();r(b.length>=3?b:"")},300)};return g.useEffect(()=>{_&&s({location:(t==null?void 0:t.location)||(_==null?void 0:_.placeId)||"",city:_.city||_.country||""})},[_,t==null?void 0:t.location]),e.jsx(Hn,{sheet:{ignoreHistory:!0},menu:{className:"z-[999]"},className:"h-full w-full",render:({open:N})=>e.jsx(Ht,{label:d("hotels_common:where_to"),icon:e.jsx(Pe,{className:"h-5 w-5 shrink-0"}),error:n,value:v,onClick:()=>{r(""),N()}}),options:j,value:t==null?void 0:t.location,item:{className:"aria-disabled:bg-body"},onChange:N=>{s({location:N.value,city:(_==null?void 0:_.city)||(_==null?void 0:_.country)||""})},search:{placeholder:d("hotels_common:search_hotels"),onChange:y,loading:f},hideErrorSpace:!0})},Ol=El,Rl=({className:t,type:s="start",showSearchButton:n=!0,onFormSubmit:a,initialSearch:o,small:l=!1})=>{const{locale:r}=R(),{setState:i,state:d}=G(),{trackEvent:u}=W(),{t:c}=L(["hotels_common"]),m=o||d,p=g.useMemo(()=>pl(m.adults,m.children,m.childrenAges),[m.adults,m.children,m.childrenAges]),[x,f]=g.useState([m.checkInDate,m.checkOutDate]),_=Tt({defaultValues:{location:{location:m.location,city:m.city},checkInDate:m.checkInDate,checkOutDate:m.checkOutDate,adults:p.adults,children:p.children,childrenAges:p.childrenAges,sId:m.sId}}),v=y=>{f(y);const N=_.getValues("checkInDate"),b=_.getValues("checkOutDate");y[0]&&(N==null?void 0:N.getTime())!==y[0].getTime()&&u({event:"stays_home_check_in_date_selected",data:{checkin_date:y[0]}}),y[1]&&(b==null?void 0:b.getTime())!==y[1].getTime()&&u({event:"stays_home_check_out_date_selected",data:{checkout_date:y[1]}}),_.setValue("checkInDate",y[0]),_.setValue("checkOutDate",y[1]?y[1]:y[0]&&Oe({date:y[0],interval:"day",value:1}))},j=y=>{s==="detail"&&u({event:"stays_details_room_availability_clicked"}),a?a(y):i({data:P(C({},d),{sId:y.sId,checkInDate:y.checkInDate,checkOutDate:y.checkOutDate,location:y.location.location,city:y.location.city,adults:y.adults,children:y.children,childrenAges:y.childrenAges,price:Number(d.price)}),path:s==="detail"?`${window.location.pathname}/book`:void 0,reload:s==="detail"})};return e.jsx(Hs,P(C({},_),{children:e.jsxs("form",{className:A("group space-y-4 rounded-xl md:max-w-none",s==="start"&&"mx-auto max-w-md",t),id:"hotels-search-form","data-small":l,onSubmit:_.handleSubmit(j),children:[e.jsxs("div",{className:A("flex flex-col gap-4 [&_div]:w-full",s==="start"?"group-data-[small=false]:lg:flex-row":"flex-col"),children:[s==="start"&&e.jsx(re,{control:_.control,name:"location",rules:{required:c("hotels_common:validation.required"),validate:y=>y.location?!0:c("hotels_common:validation.required")},render:({field:{value:y,onChange:N},fieldState:{error:b}})=>e.jsx(Ol,{value:{location:y.location,city:d.city||m.city},onChange:S=>{y.location===S.location&&u({event:"stays_home_location_selected",data:{location_code:S.location,location_name:S.city}}),N(S)},error:b==null?void 0:b.message})}),e.jsxs("div",{className:"relative flex shrink-0 grow basis-1/3 [&>div]:w-full",children:[e.jsx(re,{control:_.control,name:"checkInDate",rules:{required:c("hotels_common:validation.required")}
1,render:({field:{onChange:y},fieldState:{error:N}})=>e.jsx(wt,{label:c("hotels_common:check_in_date"),value:x,onChange:b=>{v(b),y(b==null?void 0:b[0])},error:N==null?void 0:N.message,className:"w-full ltr:rounded-r-none ltr:border-r-0 rtl:rounded-l-none rtl:border-l-0"})}),e.jsx("span",{className:"bg-body-dark/10 absolute left-1/2 top-1/2 h-4 w-px -translate-x-1/2 -translate-y-1/2"}),e.jsx(re,{control:_.control,name:"checkOutDate",rules:{required:c("hotels_common:validation.required"),shouldUnregister:!0,validate:y=>{const N=_.getValues("checkInDate");return!N||!y?!0:y.getTime()<new Date(N).getTime()?c("hotels_common:validation.date_should_be_after",{date:V(new Date(N),r,{weekday:"short",day:"2-digit",month:"short",timeZone:void 0})}):!0}},render:({field:{onChange:y},fieldState:{error:N}})=>e.jsx(wt,{dateType:"check_out",label:c("hotels_common:check_out_date"),error:N==null?void 0:N.message,value:x,fromDate:(x==null?void 0:x[1])||(x==null?void 0:x[0])&&Oe({date:x==null?void 0:x[0],interval:"day",value:1}),onChange:b=>{v(b),y(b==null?void 0:b[1])},className:"w-full ltr:rounded-l-none ltr:border-l-0 rtl:rounded-r-none rtl:border-r-0 [&_svg]:hidden"})})]}),e.jsx(Qs,{}),n&&e.jsxs(D,{className:`hidden h-16 shrink-0 justify-center ${s==="start"?"hidden group-data-[small=false]:lg:flex":"hidden"}`,type:"submit",children:[e.jsx(Ee,{})," ",c("hotels_common:search")]})]}),n&&e.jsx("div",{className:`mx-auto pt-2 ${s==="detail"?"block":"group-data-[small=false]:lg:hidden"}`,children:e.jsx(D,{type:"submit",className:"h-11 w-full",children:s==="start"?e.jsxs(e.Fragment,{children:[e.jsx(Ee,{})," ",c("hotels_common:search_hotels")]}):c("hotels_common:select_room")})})]})}))},Ge=Rl,en=g.createContext({title:"",firstName:"",lastName:"",email:"",phone:"",country:pe[0],packageId:"",pId:"",sId:"",numberOfNights:1,mode:"room_selection",isLoading:!1,isFetching:!1,isRefetching:!1,isSelectPackageError:!1,isSearchError:!1,searchTimer:"",bookTimer:"",setSummary:()=>{},checkout:()=>je(null,null,function*(){}),setCheckoutLoading:()=>{}});function ee(){return g.useContext(en)}var Al=(t,s)=>t.filter(n=>{const{latitude:a,longitude:o}=n,l=a>=s.south&&a<=s.north,r=o>=s.west&&o<=s.east;return l&&r}),Tl=[{label:"popular",value:"popular"},{label:"lowest_price",value:"cheapest"},{label:"rating",value:"rating"},{label:"distance_from_center",value:"distance"}],Fl=[{label:"free_cancellation",value:"freeCancellation"}],es=[{label:"newest",value:"recent"},{label:"highest_rated",value:"highest"},{label:"lowest_rated",value:"lowest"}],it={sort:"popular",minPrice:0,maxPrice:0,priceFilter:"price",propertyClass:[],guestRating:[],name:"",popularFilters:[],propertyType:[],amenity:[],brand:[],district:[]},Ce=()=>{const{search:t,setSearch:s}=R(),n=g.useMemo(()=>{const l=Number(t.get("location"))?"distance":"popular",r=t.get("minPrice"),i=t.get("maxPrice"),d=t.getAll("propertyClass"),u=t.getAll("guestRating"),c=t.getAll("district"),m=t.get("sort")?t.get("sort"):l,p=t.getAll("popularFilters"),x=t.get("name")||it.name,f=t.get("priceFilter")||it.priceFilter,_=t.getAll("propertyType"),v=t.getAll("amenity"),j=t.getAll("brand");return{minPrice:r?Number(r):0,maxPrice:i?Number(i):0,propertyClass:d,guestRating:u,district:c,name:x,popularFilters:p,sort:m,priceFilter:f,propertyType:_,amenity:v,brand:j}},[t]);return{state:n,setState:(l,r)=>{const i=C(C(C({},r),n),l),d={};for(const u in i){const c=u,m=i[c];m&&(d[c]=m)}s(d,{replace:!0})},reset:l=>{const r={};for(const i in l){const d=i,u=l[d];u&&(r[d]=u)}s(r,{replace:!0})}}},Hl=function t(s,n){if(s===n)return!0;if(s&&n&&typeof s=="object"&&typeof n=="object"){if(s.constructor!==n.constructor)return!1;var a,o,l;if(Array.isArray(s)){if(a=s.length,a!=n.length)return!1;for(o=a;o--!==0;)if(!t(s[o],n[o]))return!1;return!0}if(s.constructor===RegExp)return s.source===n.source&&s.flags===n.flags;if(s.valueOf!==Object.prototype.valueOf)return s.valueOf()===n.valueOf();if(s.toString!==Object.prototype.toString)return s.toString()===n.toString();if(l=Object.keys(s),a=l.length,a!==Object.keys(n).length)return!1;for(o=a;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,l[o]))return!1;for(o=a;o--!==0;){var r=l[o];if(!t(s[r],n[r]))return!1}return!0}return s!==s&&n!==n};const We=fa(Hl),Bl="1.8.3";function ie(t,s){var n={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&s.indexOf(a)<0&&(n[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,a=Object.getOwnPropertySymbols(t);o<a.length;o++)s.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(t,a[o])&&(n[a[o]]=t[a[o]]);return n}function ts(t,s,n,a){function o(l){return l instanceof n?l:new n(function(r){r(l)})}
1return new(n||(n=Promise))(function(l,r){function i(c){try{u(a.next(c))}catch(m){r(m)}}function d(c){try{u(a.throw(c))}catch(m){r(m)}}function u(c){c.done?l(c.value):o(c.value).then(i,d)}u((a=a.apply(t,[])).next())})}function $l(t,s){t.src=s}const Zl=t=>{var s,n,a,o="The Google Maps JavaScript API",l="google",r="importLibrary",i="__ib__",d=document,u=window,c=u[l]||(u[l]={}),m=c.maps||(c.maps={}),p=new Set,x=new URLSearchParams,f=()=>s||(s=new Promise(async(_,v)=>{var j;await(n=d.createElement("script")),x.set("libraries",[...p]+"");for(a in t)x.set(a.replace(/[A-Z]/g,y=>"_"+y[0].toLowerCase()),t[a]);x.set("callback",l+".maps."+i),$l(n,"https://maps.googleapis.com/maps/api/js?"+x),m[i]=_,n.onerror=()=>s=v(Error(o+" could not load.")),n.nonce=((j=d.querySelector("script[nonce]"))==null?void 0:j.nonce)||"",d.head.append(n)}));m[r]?console.warn(o+" only loads once. Ignoring:",t):m[r]=(_,...v)=>p.add(_)&&f().then(()=>m[r](_,...v))},zl=t=>`The setOptions() function should only be called once. The options passed to the additional call (${JSON.stringify(t)}) will be ignored.`,Ul=t=>`The google.maps.importLibrary() function is already defined, and @googlemaps/js-api-loader will use the existing function instead of overwriting it. The options passed to setOptions (${JSON.stringify(t)}) will be ignored.`,Vl=()=>{},Gl=()=>{};let ss=!1;function Xl(t){if(ss){Vl(zl(t));return}Wl(t),ss=!0}async function ql(t){var s,n;if(!((n=(s=window==null?void 0:window.google)==null?void 0:s.maps)!=null&&n.importLibrary))throw new Error("google.maps.importLibrary is not installed.");return await google.maps.importLibrary(t)}function Wl(t){var n,a;const s=!!((a=(n=window.google)==null?void 0:n.maps)!=null&&a.importLibrary);s&&Gl(Ul(t)),s||Zl(t)}const le={NOT_LOADED:"NOT_LOADED",LOADING:"LOADING",LOADED:"LOADED",FAILED:"FAILED",AUTH_FAILURE:"AUTH_FAILURE"},Jl="GMP_visgl_rgmlibrary_v1_default",Kl=[`gmp_visgl_reactgooglemaps_v${Bl}`],Fe=T.createContext(null);let xe=le.NOT_LOADED,et;const kt=new Set;function tt(t){t!==xe&&(xe=t,kt.forEach(s=>s(xe)))}function Yl(){const[t,s]=g.useState({});return{mapInstances:t,addMapInstance:(l,r="default")=>{s(i=>Object.assign(Object.assign({},i),{[r]:l}))},removeMapInstance:(l="default")=>{s(r=>{var i=l;r[i];var d=ie(r,[typeof i=="symbol"?i:i+""]);return d})},clearMapInstances:()=>{s({})}}}function Ql(){const[t,s]=g.useState({});return{map3dInstances:t,addMap3DInstance:(l,r="default")=>{s(i=>Object.assign(Object.assign({},i),{[r]:l}))},removeMap3DInstance:(l="default")=>{s(r=>{var i=l;r[i];var d=ie(r,[typeof i=="symbol"?i:i+""]);return d})},clearMap3DInstances:()=>{s({})}}}function eo(t){const{onLoad:s,onError:n,apiKey:a,version:o,libraries:l=[],region:r,language:i,authReferrerPolicy:d,channel:u,solutionChannel:c,fetchAppCheckToken:m}=t,[p,x]=g.useState(xe),[f,_]=g.useReducer((y,N)=>y[N.name]?y:Object.assign(Object.assign({},y),{[N.name]:N.value}),{}),v=g.useMemo(()=>{const y={apiKey:a,version:o,libraries:l.join(","),region:r,language:i,authReferrerPolicy:d,channel:u,solutionChannel:c};return JSON.stringify(y)},[a,o,l,r,i,d,u,c]),j=g.useCallback(y=>ts(this,void 0,void 0,function*(){if(f[y])return f[y];const N=yield ql(y);return _({name:y,value:N}),N}),[f]);return g.useEffect(()=>(kt.add(x),x(xe),()=>{kt.delete(x)}),[]),g.useEffect(()=>{ts(this,void 0,void 0,function*(){var y,N;try{et&&et!==v&&console.warn("The Google Maps JavaScript API has already been loaded with different parameters. The new parameters will be ignored. If you need to use different parameters, please refresh the page.");const b=["core","maps",...l];if(!((N=(y=window.google)===null||y===void 0?void 0:y.maps)===null||N===void 0)&&N.importLibrary){et||tt(le.LOADED),yield Promise.all(b.map(w=>j(w))),s&&s();return}if(xe===le.LOADING||xe===le.LOADED){xe===le.LOADED&&s&&s();return}et=v,tt(le.LOADING);const S=Object.fromEntries(Object.entries({key:a,v:o,libraries:l,region:r,language:i,authReferrerPolicy:d}).filter(([,w])=>w!==void 0));u!==void 0&&u>=0&&u<=999&&(S.channel=String(u)),c===void 0?S.solutionChannel=Jl:c!==""&&(S.solutionChannel=c),Xl(S),yield Promise.all(b.map(w=>
1j(w))),tt(le.LOADED),s&&s()}catch(b){tt(le.FAILED),n?n(b):console.error("The Google Maps JavaScript API failed to load.",b)}})},[v,s,n,j,l]),g.useEffect(()=>{if(p!==le.LOADED)return;const y=google.maps.Settings.getInstance();m?y.fetchAppCheckToken=m:y.fetchAppCheckToken&&(y.fetchAppCheckToken=null)},[p,m]),{status:p,loadedLibraries:f,importLibrary:j}}function to(t){return g.useMemo(()=>t.disableUsageAttribution?null:Kl,[t.disableUsageAttribution])}const ns=t=>{const{children:s}=t,n=ie(t,["children"]),{mapInstances:a,addMapInstance:o,removeMapInstance:l,clearMapInstances:r}=Yl(),{map3dInstances:i,addMap3DInstance:d,removeMap3DInstance:u,clearMap3DInstances:c}=Ql(),{status:m,loadedLibraries:p,importLibrary:x}=eo(n),f=to(n),_=g.useMemo(()=>({mapInstances:a,addMapInstance:o,removeMapInstance:l,clearMapInstances:r,map3dInstances:i,addMap3DInstance:d,removeMap3DInstance:u,clearMap3DInstances:c,status:m,loadedLibraries:p,importLibrary:x,internalUsageAttributionIds:f}),[a,o,l,r,i,d,u,c,m,p,x,f]);return T.createElement(Fe.Provider,{value:_},s)};function so(t,s){for(const n of oo){const a=s[n],o=tn[n];g.useEffect(()=>{if(!t||!a)return;const l=google.maps.event.addListener(t,o,r=>{a(no(o,t,r))});return()=>l.remove()},[t,o,a])}}function no(t,s,n){var a;const o={type:t,map:s,detail:{},stoppable:!1,stop:()=>{}};if(ao.includes(t)){const l=o,r=s.getCenter(),i=s.getZoom(),d=s.getHeading()||0,u=s.getTilt()||0,c=s.getBounds();return(!r||!c||!Number.isFinite(i))&&console.warn("[createEvent] at least one of the values from the map returned undefined. This is not expected to happen. Please report an issue at https://github.com/visgl/react-google-maps/issues/new"),l.detail={center:(r==null?void 0:r.toJSON())||{lat:0,lng:0},zoom:i||0,heading:d,tilt:u,bounds:(c==null?void 0:c.toJSON())||{north:90,east:180,south:-90,west:-180}},l}else if(lo.includes(t)){if(!n)throw new Error("[createEvent] mouse events must provide a srcEvent");const l=o;return l.domEvent=n.domEvent,l.stoppable=!0,l.stop=()=>n.stop(),l.detail={latLng:((a=n.latLng)===null||a===void 0?void 0:a.toJSON())||null,placeId:n.placeId},l}return o}const tn={onBoundsChanged:"bounds_changed",onCenterChanged:"center_changed",onClick:"click",onContextmenu:"contextmenu",onDblclick:"dblclick",onDrag:"drag",onDragend:"dragend",onDragstart:"dragstart",onHeadingChanged:"heading_changed",onIdle:"idle",onIsFractionalZoomEnabledChanged:"isfractionalzoomenabled_changed",onMapCapabilitiesChanged:"mapcapabilities_changed",onMapTypeIdChanged:"maptypeid_changed",onMousemove:"mousemove",onMouseout:"mouseout",onMouseover:"mouseover",onProjectionChanged:"projection_changed",onRenderingTypeChanged:"renderingtype_changed",onTilesLoaded:"tilesloaded",onTiltChanged:"tilt_changed",onZoomChanged:"zoom_changed",onCameraChanged:"bounds_changed"},ao=["bounds_changed","center_changed","heading_changed","tilt_changed","zoom_changed"],lo=["click","contextmenu","dblclick","mousemove","mouseout","mouseover"],oo=Object.keys(tn);function Je(t,s){const n=g.useRef(t);return s(t,n.current)||(n.current=t),n.current}function ro(t,s,n){g.useEffect(t,[Je(s,n)])}function sn(t,s){ro(t,s,We)}const io=new Set(["backgroundColor","clickableIcons","controlSize","disableDefaultUI","disableDoubleClickZoom","draggable","draggableCursor","draggingCursor","fullscreenControl","fullscreenControlOptions","gestureHandling","headingInteractionEnabled","isFractionalZoomEnabled","keyboardShortcuts","mapTypeControl","mapTypeControlOptions","mapTypeId","maxZoom","minZoom","noClear","panControl","panControlOptions","restriction","rotateControl","rotateControlOptions","scaleControl","scaleControlOptions","scrollwheel","streetView","streetViewControl","streetViewControlOptions","styles","tiltInteractionEnabled","zoomControl","zoomControlOptions"]);function co(t,s){const n={},a=Object.keys(s);for(const o of a)io.has(o)&&(n[o]=s[o]);sn(()=>{t&&t.setOptions(n)},[n])}function nn(){var t;return((t=g.useContext(Fe))===null||t===void 0?void 0:t.status)||le.NOT_LOADED}function uo(t,s){const{viewport:n,viewState:a}=s,o=!!n;return g.useLayoutEffect(()=>{if(!t||!a)return;const{latitude:l,longitude:r,bearing:i,pitch:d,zoom:u}=a;t.moveCamera({center:{lat:l,lng:r},heading:i,tilt:d,zoom:u+1})},[t,a]),o}function mo(t){return!t||typeof t!="object"||!("lat"in t&&"lng"in t)?!1:Number.isFinite(t.lat)&&Number.isFinite(t.lng)}function an(t,s){if(!t||!s)return!1;const n=ct(t),a=ct(s);return!(n.lat!==a.lat||n.lng!==a.lng)}function ct(t){return mo(t)?t:t.toJSON()}function as(t){if("north"in t&&"south"in t&&"east"in t&&"west"in t)return t;
1const s=t.getNorthEast().toJSON(),n=t.getSouthWest().toJSON();return{north:s.lat,east:s.lng,south:n.lat,west:n.lng}}function ho(t,s){if(!t||!s)return!1;const n=as(t),a=as(s);return n.north===a.north&&n.south===a.south&&n.east===a.east&&n.west===a.west}function ln(t,s){if(!t||!s)return t===s;const n="getArray"in s?s.getArray():s;if(t.length!==n.length)return!1;for(let a=0;a<t.length;a++)if(!an(t[a],n[a]))return!1;return!0}function go(t,s){if(!t||!s)return t===s;const n="getArray"in s?s.getArray().map(a=>a.getArray()):s;if(t.length!==n.length)return!1;for(let a=0;a<t.length;a++)if(!ln(t[a],n[a]))return!1;return!0}function vo(t,s,n){const a=n.center?ct(n.center):null;let o=null,l=null;a&&Number.isFinite(a.lat)&&Number.isFinite(a.lng)&&(o=a.lat,l=a.lng);const r=Number.isFinite(n.zoom)?n.zoom:null,i=Number.isFinite(n.heading)?n.heading:null,d=Number.isFinite(n.tilt)?n.tilt:null;g.useLayoutEffect(()=>{if(!t)return;const u={};let c=!1;o!==null&&l!==null&&(s.current.center.lat!==o||s.current.center.lng!==l)&&(u.center={lat:o,lng:l},c=!0),r!==null&&s.current.zoom!==r&&(u.zoom=r,c=!0),i!==null&&s.current.heading!==i&&(u.heading=i,c=!0),d!==null&&s.current.tilt!==d&&(u.tilt=d,c=!0),c&&t.moveCamera(u)})}const xo=()=>{const t={position:"absolute",top:0,left:0,bottom:0,right:0,zIndex:999,display:"flex",flexFlow:"column nowrap",textAlign:"center",justifyContent:"center",fontSize:".8rem",color:"rgba(0,0,0,0.6)",background:"#dddddd",padding:"1rem 1.5rem"};return T.createElement("div",{style:t},T.createElement("h2",null,"Error: AuthFailure"),T.createElement("p",null,"A problem with your API key prevents the map from rendering correctly. Please make sure the value of the ",T.createElement("code",null,"APIProvider.apiKey")," prop is correct. Check the error-message in the console for further details."))};function St(){const[t,s]=g.useState(null),n=g.useCallback(a=>s(a),[s]);return[t,n]}function on(){return nn()===le.LOADED}function rn(){const[,t]=g.useReducer(s=>s+1,0);return t}function fo(t,s){const n=t.getCenter(),a=t.getZoom(),o=t.getHeading()||0,l=t.getTilt()||0,r=t.getBounds();(!n||!r||!Number.isFinite(a))&&console.warn("[useTrackedCameraState] at least one of the values from the map returned undefined. This is not expected to happen. Please report an issue at https://github.com/visgl/react-google-maps/issues/new"),Object.assign(s.current,{center:(n==null?void 0:n.toJSON())||{lat:0,lng:0},zoom:a||0,heading:o,tilt:l})}function po(t){const s=rn(),n=g.useRef({center:{lat:0,lng:0},heading:0,tilt:0,zoom:0});return g.useEffect(()=>{if(!t)return;const a=google.maps.event.addListener(t,"bounds_changed",()=>{fo(t,n),s()});return()=>a.remove()},[t,s]),n}class lt{static has(s){return this.entries[s]&&this.entries[s].length>0}static pop(s){return this.entries[s]&&this.entries[s].pop()||null}static push(s,n){this.entries[s]||(this.entries[s]=[]),this.entries[s].push(n)}}lt.entries={};function yo(t,s){const n=on(),[a,o]=g.useState(null),[l,r]=St(),i=po(a),{id:d,defaultBounds:u,defaultCenter:c,defaultZoom:m,defaultHeading:p,defaultTilt:x,reuseMaps:f,renderingType:_,colorScheme:v}=t,j=ie(t,["id","defaultBounds","defaultCenter","defaultZoom","defaultHeading","defaultTilt","reuseMaps","renderingType","colorScheme"]),y=t.zoom!==void 0||t.defaultZoom!==void 0,N=t.center!==void 0||t.defaultCenter!==void 0;!u&&(!y||!N)&&console.warn("<Map> component is missing configuration. You have to provide zoom and center (via the `zoom`/`defaultZoom` and `center`/`defaultCenter` props) or specify the region to show using `defaultBounds`. See https://visgl.github.io/react-google-maps/docs/api-reference/components/map#required"),!j.center&&c&&(j.center=c),!j.zoom&&Number.isFinite(m)&&(j.zoom=m),!j.heading&&Number.isFinite(p)&&(j.heading=p),!j.tilt&&Number.isFinite(x)&&(j.tilt=x);const b=j.internalUsageAttributionIds;b==null?j.internalUsageAttributionIds=s.internalUsageAttributionIds:j.internalUsageAttributionIds=[...s.internalUsageAttributionIds||[],...b];for(const w of Object.keys(j))j[w]===void 0&&delete j[w];const S=g.useRef(void 0);return g.useEffect(()=>{if(!l||!n)return;const{addMapInstance:w,removeMapInstance:k}=s,{mapId:I}=t,O=`${I||"default"}:${_||"default"}:${v||"LIGHT"}`;let M,E;if(f&&lt.has(O)?(E=lt.pop(O),M=E.getDiv(),l.appendChild(M),E.setOptions(j),setTimeout(()=>E.moveCamera({}),0)):(M=document.createElement("div"),M.style.height="100%",l.appendChild(M),E=new google.maps.Map(M,Object.assign(Object.assign(Object.assign({},j),_?{renderingType:_}:{}),v?{colorScheme:v}:{}))),o(E),w(E,d),u){const{padding:B}=u,X=ie(u,["padding"]);E.fitBounds(X,B)}else(!y||!N)&&E.fitBounds({east:180,west:-180,south:-90,north:90});if(S.current){const{mapId:B,cameraState:X}=S.current;B!==I&&E.moveCamera(X)}return()=>{S.current={mapId:I,cameraState:i.current},M.remove(),f?lt.push(O,E):google.maps.event.clearInstanceListeners(E),o(null),k(d)}},[l,n,d,t.mapId,t.renderingType,t.colorScheme]),[a,r,i]}const cn=T.createContext(null),dn=t=>{const{children:s,id:n,className:a,style:o}=t,l=g.useContext(Fe),r=nn();if(!l)throw new Error("<Map> can only be used inside an <ApiProvider> component.");const[i,d,u]=yo(t,l);vo(i,u,t),so(i,t),co(i,t);const c=uo(i,t),m=!!t.controlled;g.useEffect(()=>{if(i)return c&&i.setOptions({disableDefaultUI:!0}),(c||m)&&i.setOptions({gestureHandling:"none",keyboardShortcuts:!1}),()=>{i.setOptions({gestureHandling:t.gestureHandling,keyboardShortcuts:t.keyboardShortcuts})}},[i,c,m,t.gestureHandling,t.keyboardShortcuts]);const p=t.center?ct(t.center):null;let x=null,f=null;p&&Number.isFinite(p.lat)&&Number.isFinite(p.lng)&&(x=p.lat,f=p.lng);const _=g.useMemo(()=>{var y,N,b;return{center:{lat:x??0,lng:f??0},zoom:(y=t.zoom)!==null&&y!==void 0?y:0,heading:(N=t.heading)!==null&&N!==void 0?N:0,tilt:(b=t.tilt)!==null&&b!==void 0?b:0}},[x,f,t.zoom,t.heading,t.tilt]);g.useLayoutEffect(()=>{if(!i||!m)return;i.moveCamera(_);const y=i.addListener("bounds_changed",()=>{i.moveCamera(_)});return()=>y.remove()},[i,m,_]);const v=g.useMemo(()=>Object.assign({width:"100%",height:"100%",position:"relative",zIndex:c?-1:0},o),[o,c]),j=g.useMemo(()=>({map:i}),[i]);return r===le.AUTH_FAILURE?T.createElement("div",{style:Object.assign({position:"relative"},a?{}:v),className:a},T.createElement(xo,null)):T.createElement("div",Object.assign({ref:d,"data-testid":"map",style:a?void 0:v,className:a},n?{id:n}:{}),i?T.createElement(cn.Provider,{value:j},s):null)};dn.deckGLViewProps=!0;const ls=new Set;function _o(...t){const s=JSON.stringify(t);ls.has(s)||(ls.add(s),console.error(...t))}const He=(t=null)=>{const s=g.useContext(Fe),{map:n}=g.useContext(cn)||{};if(s===null)return _o("useMap(): failed to retrieve APIProviderContext. Make sure that the <APIProvider> component exists and that the component you are calling `useMap()` from is a sibling of the <APIProvider>."),null;const{mapInstances:a}=s;return t!==null?a[t]||null:n||a.default||null};function vt(t){const s=on(),n=g.useContext(Fe);return g.useEffect(()=>{!s||!n||n.importLibrary(t)},[s,n,t]),(n==null?void 0:n.loadedLibraries[t])||null}var pt;
1const{useLayoutEffect:jo,useRef:bo}=pa,No=(pt=g.useInsertionEffect)!==null&&pt!==void 0?pt:jo;function wo(){throw new Error("useEffectEvent: invalid call during rendering.")}function ko(t){const s=bo(wo);return No(()=>{s.current=t},[t]),(...n)=>s.current(...n)}const un=ko,So=()=>{};function F(t,s,n){const a=un(n??So),o=!!n;g.useEffect(()=>{if(!t||!s||!o)return;const l=google.maps.event.addListener(t,s,a);return()=>l.remove()},[t,s,o])}function Q(t,s,n){g.useEffect(()=>{t&&(t[s]=n)},[t,s,n])}const Co=()=>{};function Ct(t,s,n){const a=un(n??Co),o=!!n;g.useEffect(()=>{if(!t||!s||!o)return;const l=a;return t.addEventListener(s,l),()=>t.removeEventListener(s,l)},[t,s,o])}class Io{constructor(){this.renderedStyles=new Set,this.styleElement=null}getStyleElement(){return this.styleElement||(this.styleElement=document.createElement("style"),this.styleElement.setAttribute("data-rgm-anchor-styles",""),document.head.appendChild(this.styleElement)),this.styleElement}addAdvancedMarkerPointerEventsOverwrite(){if(this.renderedStyles.has("marker-pointer-events"))return;const s=this.getStyleElement();s.textContent+=`
2      gmp-advanced-marker[data-origin='rgm'] {
3        pointer-events: none !important;
4      }
5    `,this.renderedStyles.add("marker-pointer-events")}cleanup(){this.styleElement&&(this.styleElement.remove(),this.styleElement=null,this.renderedStyles.clear())}}const Lo=new Io;function Do(t,s){var n;if(!(!((n=google==null?void 0:google.maps)===null||n===void 0)&&n.version))return;const a=google.maps.version.split("."),o=parseInt(a[0],10),l=parseInt(a[1],10);return o>t||o===t&&l>=s}const Mo=T.createContext(null),Po={BOTTOM:["50%","100%"]},mn=g.forwardRef((t,s)=>{const{children:n,style:a,className:o,anchorPoint:l}=t,[r,i]=Oo(t),d=g.useMemo(()=>r?{marker:r}:null,[r]);return g.useImperativeHandle(s,()=>r,[r]),i?T.createElement(Mo.Provider,{value:d},Ps.createPortal(T.createElement(Eo,{anchorPoint:l,styles:a,className:o},n),i)):null});mn.displayName="AdvancedMarker";function It(t){return t.nodeType===Node.ELEMENT_NODE}const Eo=({children:t,styles:s,className:n})=>T.createElement("div",{className:n,style:s},t);function Oo(t){const[s,n]=g.useState(null),[a,o]=g.useState(null),l=He(),r=vt("marker"),{children:i,onClick:d,className:u,onMouseEnter:c,onMouseLeave:m,onDrag:p,onDragStart:x,onDragEnd:f,collisionBehavior:_,clickable:v,draggable:j,position:y,title:N,zIndex:b,anchorPoint:S,anchorLeft:w,anchorTop:k}=t,I=g.Children.count(i);return g.useEffect(()=>{if(!l||!r)return;const O=new r.AdvancedMarkerElement;O.map=l,n(O);let M=null;return I>0&&(M=document.createElement("div"),O.content=M,o(M)),()=>{O.map=null,M==null||M.remove(),n(null),o(null)}},[l,r,I]),g.useEffect(()=>{!(s!=null&&s.content)||!It(s.content)||I>0||(s.content.className=u??"")},[s,u,I]),Ro(s,S,w,k,I>0),Q(s,"position",y),Q(s,"title",N??""),Q(s,"zIndex",b),Q(s,"collisionBehavior",_),g.useEffect(()=>{s&&(j!==void 0?s.gmpDraggable=j:p||x||f?s.gmpDraggable=!0:s.gmpDraggable=!1)},[s,j,p,f,x]),g.useEffect(()=>{if(!s)return;const O=v!==void 0?v:!!d||!!c||!!m;s.gmpClickable=O,O&&(s!=null&&s.content)&&It(s.content)&&(s.content.style.pointerEvents="all",d&&(s.content.style.cursor="pointer"))},[s,v,d,c,m]),F(s,"click",d),F(s,"drag",p),F(s,"dragstart",x),F(s,"dragend",f),Ct(s==null?void 0:s.element,"mouseenter",c),Ct(s==null?void 0:s.element,"mouseleave",m),[s,a]}function Ro(t,s,n,a,o){g.useEffect(()=>{if(!t||!o)return;const l=Do(3,62),r=t.content;if(!(!r||!It(r))){if(n!==void 0||a!==void 0){l||console.warn(`AdvancedMarker: The anchorLeft and anchorTop props are only supported in Google Maps API version 3.62 and above. The current version is ${google.maps.version}.`),t.anchorLeft=n,t.anchorTop=a,s!==void 0&&console.warn("AdvancedMarker: the anchorPoint prop is ignored when anchorLeft and/or anchorTop are set.");return}if(s!==void 0){const[i,d]=s??Po.BOTTOM,u=`calc(-1 * ${i})`,c=`calc(-1 * ${d})`;l?(t.anchorLeft=u,t.anchorTop=c,r.style.transform=""):(r.style.transform=`translate(50%, 100%) translate(${u}, ${c})`,t.dataset.origin="rgm",Lo.addAdvancedMarkerPointerEventsOverwrite())}}},[t,s,n,a,o])}function Ao(t){var s,n,a;const{onClick:o,onDrag:l,onDragStart:r,onDragEnd:i,onMouseOver:d,onMouseOut:u,onRadiusChanged:c,onCenterChanged:m,center:p,defaultCenter:x,radius:f,defaultRadius:_}=t,v=ie(t,["onClick","onDrag","onDragStart","onDragEnd","onMouseOver","onMouseOut","onRadiusChanged","onCenterChanged","center","defaultCenter","radius","defaultRadius"]),[j,y]=g.useState(null),N=He(),b=Je(Object.assign(Object.assign({},v),{clickable:(s=v.clickable)!==null&&s!==void 0?s:!!o,draggable:(n=v.draggable)!==null&&n!==void 0?n:!!(l||r||i||m),editable:(a=v.editable)!==null&&a!==void 0?a:!!c}),We);return g.useEffect(()=>{if(!N){N===void 0&&console.error("<Circle> has to be inside a Map component.");return}const S=new google.maps.Circle(Object.assign(Object.assign({},b),{center:p??x,radius:f??_}));return S.setMap(N),y(S),()=>{S.setMap(null),y(null)}},[N]),F(j,"click",o),F(j,"drag",l),F(j,"dragstart",r),F(j,"dragend",i),F(j,"mouseover",d),F(j,"mouseout",u),F(j,"radiu
5s_changed",c?()=>{const S=j==null?void 0:j.getRadius();S!==void 0&&c(S)}:null),F(j,"center_changed",m?()=>{m(j==null?void 0:j.getCenter())}:null),g.useEffect(()=>{j&&j.setOptions(b)},[j,b]),g.useEffect(()=>{!j||!p||an(p,j.getCenter())||j.setCenter(p)},[j,p]),g.useEffect(()=>{!j||f===void 0||f!==j.getRadius()&&j.setRadius(f)},[j,f]),j}const To=g.forwardRef((t,s)=>{const n=Ao(t);return g.useImperativeHandle(s,()=>n,[n]),T.createElement(T.Fragment,null)});To.displayName="Circle";function Fo(t,s,n){if(s!=null&&typeof s!="object")throw new Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.");const a=t.style;if(n==null){if(s==null)return;for(const o in s)s.hasOwnProperty(o)&&os(a,o,s[o]);return}for(const o in n)n.hasOwnProperty(o)&&(s==null||!s.hasOwnProperty(o))&&(o.indexOf("--")===0?a.setProperty(o,""):o==="float"?a.cssFloat="":a[o]="");if(s!=null)for(const o in s){const l=s[o];s.hasOwnProperty(o)&&n[o]!==l&&os(a,o,l)}}function os(t,s,n){const a=s.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?a?t.setProperty(s,""):s==="float"?t.cssFloat="":t[s]="":a?t.setProperty(s,n):typeof n=="number"&&n!==0&&!Bo(s)?t[s]=n+"px":s==="float"?t.cssFloat=n:t[s]=(""+n).trim()}const Ho=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","scale","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]);function Bo(t){return Ho.has(t)}function rs(t){const s=t.getPaths(),n=[];for(let a=0;a<s.getLength();a++)n.push(s.getAt(a).getArray());return n}function $o(t){var s,n,a;const{onClick:o,onDrag:l,onDragStart:r,onDragEnd:i,onMouseOver:d,onMouseOut:u,onPathsChanged:c,polygon:m,encodedPaths:p,paths:x,defaultPaths:f}=t,_=ie(t,["onClick","onDrag","onDragStart","onDragEnd","onMouseOver","onMouseOut","onPathsChanged","polygon","encodedPaths","paths","defaultPaths"]),[v,j]=g.useState(null),y=He(),N=vt("geometry"),b=g.useRef(!1),S=Je(Object.assign(Object.assign({},_),{clickable:(s=_.clickable)!==null&&s!==void 0?s:!!o,draggable:(n=_.draggable)!==null&&n!==void 0?n:!!(l||r||i||c),editable:(a=_.editable)!==null&&a!==void 0?a:!!c}),We);return g.useEffect(()=>{if(!y){y===void 0&&console.error("<Polygon> has to be inside a Map component.");return}let w;if(m){w=m;const k=x??f;k&&Array.isArray(k)&&w.setPaths(k),w.setOptions(S)}else{const k=x??f,I=Object.assign({},S);k&&Array.isArray(k)&&(I.paths=k),w=new google.maps.Polygon(I)}return w.setMap(y),j(w),()=>{w.setMap(null),j(null)}},[y,m]),F(v,"click",o),F(v,"drag",l),F(v,"dragstart",r),F(v,"mouseover",d),F(v,"mouseout",u),F(v,"dragend",w=>{i==null||i(w),c&&v&&!b.current&&c(rs(v))}),g.useEffect(()=>{if(!v||!c)return;const w=[],k=v.getPaths();if(typeof k.getLength!="function"||typeof k.getAt!="function")return;const I=()=>{b.current||c(rs(v))},O=M=>{w.push(google.maps.event.addListener(M,"insert_at",I)),w.push(google.maps.event.addListener(M,"remove_at",I)),w.push(google.maps.event.addListener(M,"set_at",I))};for(let M=0;M<k.getLength();M++)O(k.getAt(M));return w.push(google.maps.event.addListener(k,"insert_at",M=>{O(k.getAt(M)),I()})),w.push(google.maps.event.addListener(k,"set_at",M=>{O(k.getAt(M)),I()})),w.push(google.maps.event.addListener(k,"remove_at",I)),()=>{w.forEach(M=>M.remove())}},[v,c,x,p,S.editable,S.draggable]),g.useEffect(()=>{v&&v.setOptions(S)},[v,S]),g.useEffect(()=>{if(!v||!x||!Array.isArray(x))return;const w=x[0],k=Array.isArray(w)?x:[x],I=v.getPaths();go(k,I)||(b.current=!0,v.setPaths(x),b.current=!1)},[v,x]),g.useEffect(()=>{if(!v||!p||!N)return;b.current=!0;const w=p.map(k=>N.encoding.decodePath(k));v.setPaths(w),b.current=!1},[v,p,N]),v}const Zo=g.forwardRef((t,s)=>{const n=$o(t);return g.useImperativeHandle(s,()=>n,[n]),T.createElement(T.Fragment,null)});Zo.displayName="Polygon";function zo(t){var s,n,a;const{onClick:o,onDrag:l,onDragStart:r,onDragEnd:i,onMouseOver:d,onMouseOut:u,onPathChanged:c,polyline:m,encodedPath:p,path:x,defaultPath:f}=t,_=ie(t,["onClick","onDrag","onDragStart","onDragEnd","onMouseOver","onMouseOut","onPathChanged","polyline","encodedPath","path","defaultPath"]),[v,j]=g.useState(null),y=He(),N=vt("geometry"),b=g.useRef(!1),S=Je(Object.assign(Object.assign({},_),{clickable:(s=_.clickable)!==null&&s!==void 0?s:!!o,draggable:(n=_.draggable)!==null&&n!==void 0?n:!!(l||r||i||c),editable:(a=_.editable)!==null&&a!==void 0?a:!!c}),We);return g.useEffect(()=>{if(!y){y===void 0&&console.error("<Polyline> has to be inside a Map component.");return}let w;if(m){w=m;const k=x??f;k&&Array.isArray(k)&&w.setPath(k),w.setOptions(S)}
5else{const k=x??f,I=Object.assign({},S);k&&Array.isArray(k)&&(I.path=k),w=new google.maps.Polyline(I)}return w.setMap(y),j(w),()=>{w.setMap(null),j(null)}},[y,m]),F(v,"click",o),F(v,"drag",l),F(v,"dragstart",r),F(v,"mouseover",d),F(v,"mouseout",u),F(v,"dragend",w=>{i==null||i(w),c&&v&&!b.current&&c(v.getPath().getArray())}),g.useEffect(()=>{if(!v||!c)return;const w=v.getPath();if(!w)return;const k=()=>{b.current||c(w.getArray())},I=[google.maps.event.addListener(w,"insert_at",k),google.maps.event.addListener(w,"remove_at",k),google.maps.event.addListener(w,"set_at",k)];return()=>{I.forEach(O=>O.remove())}},[v,c,x,p,S.editable,S.draggable]),g.useEffect(()=>{v&&v.setOptions(S)},[v,S]),g.useEffect(()=>{if(!v||!x)return;const w=v.getPath();ln(x,w)||(b.current=!0,v.setPath(x),b.current=!1)},[v,x]),g.useEffect(()=>{if(!v||!p||!N)return;b.current=!0;const w=N.encoding.decodePath(p);v.setPath(w),b.current=!1},[v,p,N]),v}const Uo=g.forwardRef((t,s)=>{const n=zo(t);return g.useImperativeHandle(s,()=>n,[n]),T.createElement(T.Fragment,null)});Uo.displayName="Polyline";const Vo={center:{lat:0,lng:0,altitude:0},range:0,heading:0,tilt:0,roll:0},Go=["center","range","heading","tilt","roll"];function Xo(t,s,n){const a=t[n];if(a!=null)if(n==="center"){const o=a;s.current.center=o.toJSON?o.toJSON():o}else s.current[n]=a}function qo(t){const s=rn(),n=g.useRef(Object.assign({},Vo));return g.useEffect(()=>{if(!t)return;const a=[];for(const o of Go){const l=`gmp-${o}change`,r=()=>{Xo(t,n,o),s()};t.addEventListener(l,r),a.push(()=>t.removeEventListener(l,r))}return()=>{for(const o of a)o()}},[t,s]),n}function Wo(t){const s=vt("maps3d"),[n,a]=g.useState(!1),[,o]=St(),[l,r]=St(),i=qo(l);return g.useEffect(()=>{customElements.whenDefined("gmp-map-3d").then(()=>{a(!0)})},[]),g.useEffect(()=>{if(!l)return;const{center:u,heading:c,tilt:m,range:p,roll:x,defaultCenter:f,defaultHeading:_,defaultTilt:v,defaultRange:j,defaultRoll:y,id:N,style:b,className:S,children:w,onCenterChanged:k,onHeadingChanged:I,onTiltChanged:O,onRangeChanged:M,onRollChanged:E,onCameraChanged:B,onClick:X,onSteadyChange:K,onAnimationEnd:Be,onError:$e,mode:Ke,gestureHandling:J}=t,ae=ie(t,["center","heading","tilt","range","roll","defaultCenter","defaultHeading","defaultTilt","defaultRange","defaultRoll","
5id","style","className","children","onCenterChanged","onHeadingChanged","onTiltChanged","onRangeChanged","onRollChanged","onCameraChanged","onClick","onSteadyChange","onAnimationEnd","onError","mode","gestureHandling"]),me=u??f,he=c??_,ge=m??v,Ye=p??j,Qe=x??y,ve=Object.assign({},ae);me&&(ve.center=me),he!==void 0&&(ve.heading=he),ge!==void 0&&(ve.tilt=ge),Ye!==void 0&&(ve.range=Ye),Qe!==void 0&&(ve.roll=Qe),Object.assign(l,ve)},[l]),[l,o,r,i,!!s&&n]}function Jo(t){return t?"toJSON"in t&&typeof t.toJSON=="function"?t.toJSON():t:null}function Ko(t,s,n){var a,o,l,r,i,d,u;const c=Jo(n.center),m=(a=c==null?void 0:c.lat)!==null&&a!==void 0?a:null,p=(o=c==null?void 0:c.lng)!==null&&o!==void 0?o:null,x=(l=c==null?void 0:c.altitude)!==null&&l!==void 0?l:null,f=(r=n.range)!==null&&r!==void 0?r:null,_=(i=n.heading)!==null&&i!==void 0?i:null,v=(d=n.tilt)!==null&&d!==void 0?d:null,j=(u=n.roll)!==null&&u!==void 0?u:null;g.useLayoutEffect(()=>{var y;if(!t)return;const N=s.current;m!==null&&p!==null&&(N.center.lat!==m||N.center.lng!==p||x!==null&&N.center.altitude!==x)&&(t.center={lat:m,lng:p,altitude:(y=x??N.center.altitude)!==null&&y!==void 0?y:0}),f!==null&&N.range!==f&&(t.range=f),_!==null&&N.heading!==_&&(t.heading=_),v!==null&&N.tilt!==v&&(t.tilt=v),j!==null&&N.roll!==j&&(t.roll=j)})}const is=["gmp-centerchange","gmp-headingchange","gmp-tiltchange","gmp-rangechange","gmp-rollchange"];function De(t,s){const n=t.center;let a;return n&&"toJSON"in n&&typeof n.toJSON=="function"?a=n.toJSON():n?a=n:a={lat:0,lng:0,altitude:0},{type:s,map3d:t,detail:{center:a,range:t.range||0,heading:t.heading||0,tilt:t.tilt||0,roll:t.roll||0}}}function Yo(t,s){const n=s;return{type:"gmp-click",map3d:t,detail:{position:s.position||null,placeId:n.placeId}}}function Qo(t,s){return{type:"gmp-steadychange",map3d:t,detail:{isSteady:s.isSteady}}}function er(t,s){const{onCenterChanged:n,onHeadingChanged:a,onTiltChanged:o,onRangeChanged:l,onRollChanged:r,onCameraChanged:i,onClick:d,onSteadyChange:u,onAnimationEnd:c,onError:m}=s;_e(t,"gmp-centerchange",n,De),_e(t,"gmp-headingchange",a,De),_e(t,"gmp-tiltchange",o,De),_e(t,"gmp-rangechange",l,De),_e(t,"gmp-rollchange",r,De),g.useEffect(()=>{if(!t||!i)return;const p=()=>{i(De(t,"camerachange"))};for(const x of is)t.addEventListener(x,p);return()=>{for(const x of is)t.removeEventListener(x,p)}},[t,i]),g.useEffect(()=>{if(!t||!d)return;const p=x=>{d(Yo(t,x))};return t.addEventListener("gmp-click",p),()=>t.removeEventListener("gmp-click",p)},[t,d]),g.useEffect(()=>{if(!t||!u)return;const p=x=>{u(Qo(t,x))};return t.addEventListener("gmp-steadychange",p),()=>t.removeEventListener("gmp-steadychange",p)},[t,u]),_e(t,"gmp-animationend",c,(p,x)=>({type:x,map3d:p})),_e(t,"gmp-error",m,(p,x)=>({type:x,map3d:p}))}function _e(t,s,n,a){g.useEffect(()=>{if(!t||!n)return;const o=()=>{n(a(t,s))};return t.addEventListener(s,o),()=>t.removeEventListener(s,o)},[t,s,n,a])}const tr=new Set(["bounds","defaultUIHidden","gestureHandling","internalUsageAttributionIds","maxAltitude","maxHeading","maxTilt","minAltitude","minHeading","minTilt","mode"]);function sr(t,s){const n=g.useMemo(()=>{const a={},o=Object.keys(s);for(const l of o){if(!tr.has(l))continue;const r=s[l];r!==void 0&&(a[l]=r)}return a},[s]);sn(()=>{t&&Object.assign(t,n)},[t,n])}const nr=T.createContext(null),ar={width:"100%",height:"100%",position:"relative"},lr=g.forwardRef((t,s)=>{const{children:n,id:a,className:o,style:l}=t,r=g.useContext(Fe);if(!r)throw new Error("<Map3D> can only be used inside an <APIProvider> component.");const{addMap3DInstance:i,removeMap3DInstance:d}=r,[u,c,m,p,x]=Wo(t);Ko(u,p,t),er(u,t),sr(u,t),g.useEffect(()=>{if(!u)return;const v=a??"default";return i(u,v),()=>{d(v)}},[u,a]),g.useImperativeHandle(s,()=>({map3d:u,flyCameraAround:v=>{u==null||u.flyCameraAround(v)},flyCameraTo:v=>{u==null||u.flyCameraTo(v)},stopCameraAnimation:()=>{u==null||u.stopCameraAnimation()}}),[u]);const f=g.useMemo(()=>Object.assign(Object.assign({},ar),l),[l]),_=g.useMemo(()=>({map3d:u}),[u]);return x?T.createElement("div",Object.assign({ref:c,"data-testid":"map-3d",style:o?void 0:f,className:o},a?{id:a}:{}),T.createElement("gmp-map-3d",{ref:m,style:{width:"100%",height:"100%"}},u&&T.createElement(nr.Provider,{value:_},n))):T.createElement("div",Object.assign({ref:c,"data-testid":"map-3d",style:o?void 0:f,className:o},a?{id:a}:{}))});lr.displayName="Map3D";const or=g.createContext(null),rr=g.forwardRef(function(s,n){const{children:a,onClick:o,position:l,altitudeMode:r,collisionBehavior:i,drawsWhenOccluded:d,extruded:u,label:c,sizePreserved:m,zIndex:p,title:x}=s,f=!!o,[_,v]=g.useState(null),[j,y]=g.useState(!1),N=g.useMemo(()=>{const w=document.createElement("div");return w.style.display="none",document.body.appendChild(w),w},[]);g.useEffect(()=>()=>N.remove(),[N]);const b=g.useCallback(w=>{v(w),typeof n=="function"?n(w):n&&(n.current=w)},[n]);Ct(_,"gmp-click",o),g.useLayoutEffect(()=>{if(j||!_||!N)return;for(;_.firstChild;)_.removeChild(_.firstChild);const w=Array.from(N.childNodes);for(const k of w){if(k.nodeType!==Node.ELEMENT_NODE)continue;const I=k,O=I.tagName.toLowerCase();if(O==="img"||O==="svg"){const M=document.createElement("template");M.content.appendChild(I.cloneNode(!0)),_.appendChild(M)}else _.appendChild(I.cloneNode(!0))}},[_,N,a,j]);const S=g.useMemo(()=>({marker:_,setContentHandledExternally:y}),[_]);return Q(_,"position",l),Q(_,"altitudeMode",r),Q(_,"collisionBehavior",i),Q(_,"drawsWhenOccluded",d),Q(_,"extruded",u),Q(_,"label",c),Q(_,"sizePreserved",m),Q(_,"zIndex",p),Q(_,"title",x??""),T.createElement(or.Provider,{value:S},f?T.createElement("gmp-marker-3d-interactive",{ref:b}):T.createElement("gmp-marker-3d",{ref:b}),Ps.createPortal(a,N))});rr.displayName="Marker3D";const ir=g.forwardRef(function(s,n){var a;const{children:o,headerContent:l,style:r,className:i,open:d=!0,position:u,anchor:c,anchorId:m,altitudeMode:p,lightDismissDisabled:x,autoPanDisabled:f,onClose:_}=s,[v,j]=g.useState(null),y=g.useRef(null);g.useImperativeHandle(n,()=>v,[v]),cr(v,d,_),Q(v,"open",d??!1),Q(v,"altitudeMode",p),Q(v,"lightDismissDisabled",x),Q(v,"autoPanDisabled",f);const N=(a=c??m)!==null&&a!==void 0?a:u;return Q(v,"positionAnchor",N),g.useLayoutEffect(()=>{v&&(Fo(v,r||null,y.current),y.current=r||null)},[v,r]),T.createElement("gmp-popover",{ref:j,className:i},l&&T.createElement("div",{slot:"header"},l),o)});ir.displayName="Popover";function cr(t,s,n){const a=g.useRef(void 0),o=g.useRef(s);g.useEffect(()=>{o.current=s},[s]),g.useEffect(()=>{if(!t||!n)return;const l=new MutationObserver(r=>{for(const i of r)if(i.type==="attributes"&&i.attributeName==="open"){const d=t.hasAttribute("open");a.current===!0&&!d&&o.current!==!1&&n(),a.current=d}});return l.observe(t,{attributes:!0,attributeFilter:["open"]}),a.current=t.hasAttribute("open"),()=>{l.disconnect()}},[t,n])}function dr(t){const[s,n]=g.useState(null),a=He(),{onClick:o,onDrag:l,onDragStart:r,onDragEnd:i,onMouseOver:d,onMouseOut:u}=t,c=ie(t,["onClick","onDrag","onDragStart","onDragEnd","onMouseOver","onMouseOut"]),{position:m,draggable:p}=c;return g.useEffect(()=>{if(!a){a===void 0&&console.error("<Marker> has to be inside a Map component.");return}const x=new google.maps.Marker(c);return x.setMap(a),n(x),()=>{x.setMap(null),n(null)}},[a]),g.useEffect(()=>{if(!s)return;const x=s,f=google.maps.event;return o&&f.addListener(x,"click",o),l&&f.addListener(x,"drag",l),r&&f.addListener(x,"dragstart",r),i&&f.addListener(x,"dragend",i),d&&f.addListener(x,"mouseover",d),u&&f.addListener(x,"mouseout",u),s.setDraggable(!!p),()=>{f.clearInstanceListeners(x)}},[s,p,o,l,r,i,d,u]),g.useEffect(()=>{s&&c&&s.setOptions(c)},[s,c]),g.useEffect(()=>{p||!m||!s||s.setPosition(m)},[p,m,s]),s}const ur=g.forwardRef((t,s)=>{const n=dr(t);return g.useImperativeHandle(s,()=>n,[n]),T.createElement(T.Fragment,null)});ur.displayName="Marker";function mr(t){var s,n,a;const{onClick:o,onDrag:l,onDragStart:r,onDragEnd:i,onMouseOver:d,onMouseOut:u,onBoundsChanged:c,bounds:m,defaultBounds:p}=t,x=ie(t,["onClick","onDrag","onDragStart","onDragEnd","onMouseOver","onMouseOut","onBoundsChanged","bounds","defaultBounds"]),[f,_]=g.useState(null),v=He(),j=Je(Object.assign(Object.assign({},x),{clickable:(s=x.clickable)!==null&&s!==void 0?s:!!o,draggable:(n=x.draggable)!==null&&n!==void 0?n:!!(l||r||i||c),editable:(a=x.editable)!==null&&a!==void 0?a:!!c}),We);return g.useEffect(()=>{if(!v){v===void 0&&console.error("<Rectangle> has to be inside a Map component.");return}const y=new google.maps.Rectangle(Object.assign(Object.assign({},j),{bounds:m??p}));return y.setMap(v),_(y),()=>{y.setMap(null),_(null)}},[v]),F(f,"click",o),F(f,"drag",l),F(f,"dragstart",r),F(f,"dragend",i),F(f,"mouseover",d),F(f,"mouseout",u),F(f,"bounds_changed",c?()=>{c(f==null?void 0:f.getBounds())}:null),g.useEffect(()=>{f&&f.setOptions(j)},[f,j]),g.useEffect(()=>{!f||!m||ho(m,f.getBounds())||f.setBounds(m)},[f,m]),f}const hr=g.forwardRef((t,s)=>{const n=mr(t);return g.useImperativeHandle(s,()=>n,[n]),T.createElement(T.Fragment,null)});hr.displayName="Rectangle";var gr=({onFinish:t,initialValues:s,id:n="guest-details"})=>{const{locale:a}=R(),{t:o}=L("hotels_common"),{handleSubmit:l,control:r,setValue:i,watch:d,formState:{errors:u}}=Tt({mode:"onBlur",defaultValues:s}),c=d("country"),m=g.useMemo(()=>[{text:o("hotels_common:guest_details.guest.mr"),value:"MR"},{text:o("hotels_common:guest_details.guest.ms"),value:"MS"},{text:o("hotels_common:guest_details.guest.mrs"),value:"MRS"}],[o]),p=x=>{t(x)};return e.jsx(z,{children:e.jsxs("form",{className:"space-y-6",id:n,onSubmit:l(p),children:[e.jsx(h,{variant:"heading-S",children:o("hotels_common:guest_details.who_is_checking_in")}
5),e.jsx(re,{control:r,name:"title",rules:{required:o("hotels_common:guest_details.guest.validations.required")},render:({field:{value:x,onChange:f},fieldState:{error:_}})=>e.jsx(ks,{type:"single",className:"data-[state=off]:border-paper data-[state=off]:text-text-secondary max-w-20",options:m,btnProps:{phill:!0},activeBtnProps:{theme:"action",shape:"text",phill:!0,className:"bg-body text-body-dark border"},value:x,onChange:f,error:_==null?void 0:_.message})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row [&_div]:w-full",children:[e.jsx(re,{control:r,name:"firstName",rules:{required:o("hotels_common:guest_details.first_name.validations.required"),maxLength:{value:30,message:o("hotels_common:guest_details.first_name.validations.maxLength")},pattern:{value:new RegExp("^(?!\\s)[a-zA-Z\\s]*(?<!\\s)$","i"),message:o("hotels_common:guest_details.first_name.validations.pattern")}},render:({field:{value:x,onChange:f},fieldState:{error:_}})=>e.jsx(nt,{label:e.jsx(h,{className:"font-semibold",children:o("hotels_common:guest_details.first_name.label")}),value:x,onChange:f,error:_==null?void 0:_.message})}),e.jsx(re,{name:"lastName",control:r,rules:{required:o("hotels_common:guest_details.last_name.validations.required"),maxLength:{value:30,message:o("hotels_common:guest_details.last_name.validations.maxLength")},minLength:{value:2,message:o("hotels_common:guest_details.last_name.validations.minLength")},pattern:{value:new RegExp("^(?! )[a-zA-Z\\s]*(?<! )$","i"),message:o("hotels_common:guest_details.last_name.validations.pattern")}},render:({field:{value:x,onChange:f},fieldState:{error:_}})=>e.jsx(nt,{label:e.jsx(h,{className:"font-semibold",children:o("hotels_common:guest_details.last_name.label")}),value:x,onChange:f,error:_==null?void 0:_.message})})]}),e.jsx(re,{control:r,name:"email",rules:{required:o("hotels_common:guest_details.email.validations.required"),pattern:{value:ra,message:o("hotels_common:validation.email.invalid")}},render:({field:{value:x,onChange:f},fieldState:{error:_}})=>e.jsx(nt,{type:"email",label:e.jsxs("div",{children:[e.jsx(h,{className:"font-semibold",children:o("hotels_common:guest_details.email.label")}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:o("hotels_common:guest_details.email.description")})]}),value:x,onChange:f,error:_==null?void 0:_.message})}),e.jsx(re,{name:"phone",control:r,rules:{required:o("hotels_common:guest_details.contact_details.empty"),validate:x=>{var f,_,v;const j=(f=c==null?void 0:c.mobile_starts_with)==null?void 0:f.length;if(x!=null&&x.includes(" "))return o("hotels_common:guest_details.contact_details.invalid");if(j){const y=(_=c==null?void 0:c.mobile_starts_with)==null?void 0:_.some(b=>x==null?void 0:x.startsWith(b)),N=(x==null?void 0:x.length)&&(x==null?void 0:x.length)>=Number((v=c==null?void 0:c.phone_number_lengths)==null?void 0:v[0]);return y&&N||o("hotels_common:guest_details.contact_details.invalid")}}},render:({field:{value:x}})=>{var f;return e.jsx($n,{lang:a,label:e.jsx(h,{className:"font-semibold",children:o("hotels_common:guest_details.contact_details.label")}),country:c,mobile:x||"",onChange:(_,v)=>{i(_==="country"?"country":"phone",v)},error:(f=u==null?void 0:u.phone)==null?void 0:f.message})}})]})]})})},hn=gr,vr=({showReset:t=!0,className:s,onReset:n})=>{const{locale:a}=R(),{t:o}=L(["hotels_common"]),{state:l}=G(),{reset:r}=Ce(),i=()=>{r(P(C({},l),{checkInDate:l.checkInDate?Z(l.checkInDate,a,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:void 0}).date:"",checkOutDate:l.checkOutDate?Z(l.checkOutDate,a,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:void 0}).date:""}))};return e.jsxs("div",{className:A("space-y-6",s),children:[e.jsx(bl,{className:"h-9 w-9"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{variant:"heading-M",children:o("hotels_common:no_results_found")}),e.jsx(h,{color:"text-secondary",children:o("hotels_common:no_results_found_description")})]}),t&&e.jsx(D,{shape:"outlined",theme:"action",onClick:n||i,children:o("hotels_common:reset_filters")})]})},xt=vr,gn=({hotels:t,filterState:s})=>({filteredHotels:g.useMemo(()=>{const a=[];for(const o of t){let l=!0;for(const[r,i]of Object.entries(s)){if((!i||!Array.isArray(i)||!i.length)&&typeof i!="number"&&r!=="name")continue;const d=Ka[r];if(!(d!=null&&d(o,i,r==="minPrice"||r==="maxPrice"?s.priceFilter:void 0))&&i){l=!1;break}}l&&a.push(o)}return a.sort(Ya[s.sort])},[t,s])}),xr=t=>{var s=t,{value:n,onChange:a,options:o,className:l,limit:r=5,allowSelectAll:i,selectAllLabel:d,showMoreLabel:u,showLessLabel:c}=s,m=Te(s,["value","onChange","options","className","limit","allowSelectAll","selectAllLabel","showMoreLabel","showLessLabel"]);const{t:p}=L(["hotels_common"]),[x,f]=g.useState(!1),_=o.slice(0,x?o.length:r),v=j=>{n.includes(j)?a(n.filter(y=>y!==j)):a([...n,j])};return e.jsxs("div",{children:[i&&e.jsx(Vn,{checked:n.length===o.length,groupClassName:"[&>div]:justify-between [&>div]:flex-row-reverse",label:d||p("hotels_common:select_all"),onChange:j=>{a(j?o.map(y=>y.value):[])}}),e.jsxs("ul",P(C({className:A("space-y-4",l)},m),{children:[_.map(j=>e.jsx("li",{children:e.jsx(Gn,{groupClassName:"[&>label]:gap-3",checked:n.includes(j.value),onChange:()=>v(j.value),label:j.text},j.value)},j.value)),o.length>r&&e.jsx(D,{type:"button",shape:"outlined",theme:"action",onClick:()=>f(!x),className:"text-body-S px-3 py-2",children:x?c||p("hotels_common:show_less"):u||p("hotels_common:show_more")})]}))]})},Ie=xr,fr=6,pr=({value:t,onChange:s,hotels:n})=>{const{t:a}=L(["hotels_common"]),o=g.useMemo(()=>za(n),[n]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(h,{variant:"heading-XS",children:a("hotels_common:property_class")}),e.jsx(Ie,{limit:fr,value:t.propertyClass.map(String),options:o.map(({hotelClass:l,hotels:r})=>({text:e.jsxs("div",{className:"flex grow items-center justify-between",children:[e.jsxs(h,{className:"flex items-center gap-1",children:[e.jsx("span",{children:l||a("hotels_common:unrated")}),!!l&&e.jsx("span",{children:a("hotels_common:star")}),e.jsx("span",{className:"flex items-center gap-px",children:Array.from({length:l}).map((i,d)=>e.jsx(Se,{className:"text-text-secondary h-4 w-4 shrink-0"},d))})]}),e.jsx(h,{color:"text-secondary",variant:"body-XS",children:r})]}),value:String(l)}
5)),onChange:l=>s(P(C({},t),{propertyClass:l}))})]})},vn=pr,yr=t=>{var s=t,{render:n}=s,a=Te(s,["render"]);const[o,l]=g.useState(a.value);return e.jsxs(e.Fragment,{children:[e.jsx(Un,P(C({},a),{onValueChange:l,value:o})),n==null?void 0:n(o)]})},_r=yr,jr=({value:t,hotels:s,priceFilter:n,count:a,onChange:o})=>{const{t:l}=L(["hotels_common"]),r=g.useMemo(()=>{const m=$a(s),p=Za(s);return{priceRanges:m,averagePriceRanges:p}},[s]),{minPrice:i,maxPrice:d,priceRanges:u}=g.useMemo(()=>{const m=n==="price"?r.priceRanges[0]:r.averagePriceRanges[0],p=n==="price"?r.priceRanges[1]:r.averagePriceRanges[1],x=n==="price"?r.priceRanges:r.averagePriceRanges;return{minPrice:m,maxPrice:p,priceRanges:t.minPrice&&t.maxPrice?[t.minPrice,t.maxPrice]:x}},[r.averagePriceRanges,r.priceRanges,n,t.maxPrice,t.minPrice]),c=m=>{o(C(C({},t),m))};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(h,{variant:"heading-XS",children:l("hotels_common:price")}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(ks,{type:"single",value:t.priceFilter,onChange:m=>{c({priceFilter:m,minPrice:m==="price"?r.priceRanges[0]:r.averagePriceRanges[0],maxPrice:m==="price"?r.priceRanges[1]:r.averagePriceRanges[1]})},options:[{text:l("hotels_common:total_for_stay"),value:"price"},{text:l("hotels_common:average_per_night"),value:"averagePrice"}],className:"data-[state=off]:border-paper data-[state=off]:text-text-secondary max-w-fit",btnProps:{phill:!0},activeBtnProps:{theme:"action",shape:"text",phill:!0,className:"bg-body text-body-dark border"}}),e.jsx(_r,{value:u,onValueCommit:m=>{m[0]===u[0]&&m[1]===u[1]?c({minPrice:0,maxPrice:0}):c({minPrice:m[0],maxPrice:m[1]})},minStepsBetweenThumbs:1,min:i,max:d,render:m=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(U,{originalPrice:Math.round((m==null?void 0:m[0])||0),className:"text-xs font-medium"}),e.jsx(h,{variant:"label-S",color:"text-secondary",children:l("hotels_common:properties",{count:a})}),e.jsx(U,{originalPrice:Math.round((m==null?void 0:m[1])||0),className:"text-xs font-medium"})]})},u.join("-"))]})]})},xn=jr,br=({value:t,hotels:s,onChange:n})=>{const{t:a}=L(["hotels_common"]),{freeCancellation:o}=g.useMemo(()=>({freeCancellation:Ja(s)}),[s]),l=r=>{n(C(C({},t),r))};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(h,{variant:"heading-XS",children:a("hotels_common:popular_filters")}),e.jsx(Ie,{value:t.popularFilters,options:Fl.map(({label:r,value:i})=>({text:e.jsxs("div",{className:"flex grow items-center justify-between",children:[e.jsx(h,{className:"flex items-center gap-1",children:e.jsx("span",{children:a(`hotels_common:${r}`)})}),e.jsx(h,{color:"text-secondary",variant:"body-XS",children:o.length})]}),value:i})),onChange:r=>{l({popularFilters:r})}})]})},fn=br,Nr=({value:t,onChange:s,hotels:n})=>{const{t:a}=L(["hotels_common"]),o=g.useMemo(()=>Ga(n),[n]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(h,{variant:"heading-XS",children:a("hotels_common:property_type")}),e.jsx(Ie,{value:t.propertyType.map(String),showMoreLabel:a("hotels_common:view_all_property_types"),options:o.map(({hotelPropertyType:l,hotelsCount:r})=>({text:e.jsxs("div",{className:"flex grow items-center justify-between",children:[e.jsx(h,{className:"flex items-center gap-1",children:l.name}),e.jsx(h,{color:"text-secondary",variant:"body-XS",children:r})]}),value:String(l.id)})),onChange:l=>s(P(C({},t),{propertyType:l}))})]})},pn=Nr,wr=({value:t,onChange:s,hotels:n})=>{const{t:a}=L(["hotels_common"]),o=g.useMemo(()=>Xa(n),[n]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(h,{variant:"heading-XS",children:a("hotels_common:amenities")}),e.jsx(Ie,{value:t.amenity.map(String),showMoreLabel:a("hotels_common:view_all_amenities"),options:o.map(({amenity:l})=>({text:e.jsx("div",{className:"flex grow items-center justify-between",children:e.jsx(h,{className:"flex items-center gap-1",children:l.name})}),value:String(l.id)})),onChange:l=>s(P(C({},t),{amenity:l}))})]})},yn=wr,kr=({value:t,onChange:s,hotels:n})=>{const{t:a}=L(["hotels_common"]),o=g.useMemo(()=>qa(n),[n]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(h,{variant:"heading-XS",children:a("hotels_common:brand")}
5),e.jsx(Ie,{value:t.brand.map(String),showMoreLabel:a("hotels_common:view_all_brands"),options:o.map(({brand:l})=>({text:e.jsx("div",{className:"flex grow items-center justify-between",children:e.jsx(h,{className:"flex items-center gap-1",children:l.name})}),value:String(l.id)})),onChange:l=>s(P(C({},t),{brand:l}))})]})},_n=kr,Sr=({value:t,onChange:s,hotels:n})=>{const{t:a}=L(["hotels_common"]),o=g.useMemo(()=>Wa(n),[n]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(h,{variant:"heading-XS",children:a("hotels_common:districts")}),e.jsx(Ie,{value:t.district.map(String),showMoreLabel:a("hotels_common:view_all_districts"),options:o.map(({district:l})=>({text:e.jsx("div",{className:"flex grow items-center justify-between",children:e.jsx(h,{className:"flex items-center gap-1",children:l.name})}),value:String(l.id)})),onChange:l=>s(P(C({},t),{district:l}))})]})},jn=Sr,Cr=6,Ir=({value:t,onChange:s,hotels:n})=>{const{t:a}=L(["hotels_common"]),o=g.useMemo(()=>Ua(n),[n]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(h,{variant:"heading-XS",children:a("hotels_common:guest_rating")}),e.jsx(Ie,{limit:Cr,value:t.guestRating.map(String),options:o.map(({hotelRating:l,count:r,description:i})=>({text:e.jsxs("div",{className:"flex grow items-center justify-between",children:[e.jsx(h,{className:"flex items-center gap-1",children:e.jsx("span",{children:l?`${l.toFixed(1)}+ ${i||""}`:a("hotels_common:unrated")})}),e.jsx(h,{color:"text-secondary",variant:"body-XS",children:r})]}),value:String(l)})),onChange:l=>s(P(C({},t),{guestRating:l}))})]})},bn=Ir,Lr=({hotels:t,value:s,onChange:n,count:a})=>{const{state:o}=Ce(),{t:l}=L(["hotels_common"]),r=d=>{n(C(C({},s),d))},i=o.priceFilter;return e.jsxs("div",{children:[e.jsx("div",{className:"border-paper border-b pb-6",children:e.jsx(xn,{value:s,hotels:t,priceFilter:i,count:a,onChange:r})}),e.jsxs("div",{className:"border-paper space-y-4 border-b py-6",children:[e.jsx(h,{variant:"heading-XS",className:"font-semibold",children:l("hotels_common:search_by_name")}),e.jsx(nt,{startIcon:e.jsx(Ee,{className:"text-text-secondary h-5 w-5 shrink-0 translate-x-1/3 translate-y-1/2 rtl:-translate-x-1/3"}),placeholder:l("hotels_common:search_by_name_placeholder"),value:s.name,onChange:d=>r({name:d})})]}),e.jsx("div",{className:"border-paper border-b py-6",children:e.jsx(vn,{value:s,onChange:r,hotels:t})}),e.jsx("div",{className:"border-paper border-b py-6",children:e.jsx(bn,{value:s,onChange:r,hotels:t})}),e.jsx("div",{className:"border-paper border-b py-6",children:e.jsx(pn,{value:s,onChange:r,hotels:t})}),e.jsx("div",{className:"border-paper space-y-4 border-b py-6",children:e.jsx(fn,{value:s,onChange:r,hotels:t})}),e.jsx("div",{className:"border-paper space-y-4 border-b py-6",children:e.jsx(yn,{value:s,onChange:r,hotels:t})}),e.jsx("div",{className:"border-paper space-y-4 py-6",children:e.jsx(jn,{value:s,onChange:r,hotels:t})}),e.jsx("div",{className:"border-paper space-y-4 py-6",children:e.jsx(_n,{value:s,onChange:r,hotels:t})})]})},Nn=Lr,Dr=["filters","price","propertyClass","guestRating","propertyType","popularFilters","amenity","brand","district"],Mr=({hotels:t,value:s,onChange:n,count:a,options:o=Dr,render:l})=>{const[r,i]=g.useState(s),{t:d}=L(["hotels_common"]),u=g.useMemo(()=>[{id:"filters",label:e.jsx(sa,{className:"h-5 w-5"}),filter:e.jsx(Nn,{hotels:t,value:r,onChange:i,count:a})},{id:"price",label:d("hotels_common:price"),filter:e.jsx(xn,{value:r,onChange:i,priceFilter:r.priceFilter,count:a,hotels:t})},{id:"propertyClass",label:d("hotels_common:property_class"),filter:e.jsx(vn,{value:r,onChange:i,hotels:t})},{id:"guestRating",label:d("hotels_common:guest_rating"),filter:e.jsx(bn,{value:r,onChange:i,hotels:t})},{id:"propertyType",label:d("hotels_common:property_type"),filter:e.jsx(pn,{value:r,onChange:i,hotels:t})},{id:"popularFilters",label:d("hotels_common:popular_filters"),filter:e.jsx(fn,{value:r,onChange:i,hotels:t})},{id:"amenity",label:d("hotels_common:amenities"),filter:e.jsx(yn,{value:r,onChange:i,hotels:t})},{id:"district",label:d("hotels_common:districts"),filter:e.jsx(jn,{value:r,onChange:i,hotels:t})},{id:"brand",label:d("hotels_common:brand"),filter:e.jsx(_n,{value:r,onChange:i,hotels:t})}].filter(({id:c})=>o==null?void 0:o.includes(c)),[t,i,a,d,r,o]);return e.jsx(be,{className:"py-1",options:{dragFree:!0},children:u.map(({id:c,label:m,filter:p})=>e.jsx(Pr,{id:c,onFilterChange:i,onChange:n,label:m,filter:p,value:s,filters:r,render:l},c))})},Pr=({label:t,filter:s,value:n,filters:a,id:o,onChange:l,onFilterChange:r,render:i})=>{const{t:d}=L(["hotels_common"]),u=g.useRef(null),c=g.useMemo(()=>{const m=!!n.minPrice||!!n.maxPrice,p=!!n.propertyClass.length,x=!!n.guestRating.length,f=!!n.propertyType.length,_=!!n.popularFilters.length,v=!!n.amenity.length,j=!!n.brand.length,y=!!n.district.length;return{price:m,propertyClass:p,guestRating:x,propertyType:f,popularFilters:_,filters:m||p||f||_||v||j||y,amenity:v,brand:j,district:y}},[n]);return e.jsx("div",{className:"relative shrink-0 [&:not(:only-child)]:[&:not(:last-child)]:me-3",children:e.jsx(ne,{ignoreHistory:!0,ref:u,render:({open:m})=>e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:A("bg-primary-400 absolute -top-1 right-0 z-10 h-3 w-3 rounded-full text-center",c[o]?"block":"hidden")}),i?i({onClick:()=>{m(),r(n)},label:t}):e.jsx(D,{shape:"outlined",theme:"action",phill:!0,onClick:()=>{m(),r(n)},children:e.jsx(h,{variant:"label-S",color:"text-secondary",children:t})})]}),body:()=>s,title:d("hotels_common:filter_by"),cancel:!1,action:{onClick:()=>{var m;l(a),(m=u.current)==null||m.close()},label:d("hotels_common:apply"),className:"w-full"}})})},ot=Mr,Er=({hotel:t,currency:s,onClick:n})=>{var a,o,l,r,i;const{t:d}=L("hotels_common"),{locale:u}=R(),{state:c,setState:m}=G(),p=()=>{n?n():m({data:P(C({},c),{price:t.basePrice}),path:`/${u}/hotels/${t.hotelId}`})};return e.jsx(z,{surface:"level-1",className:"relative overflow-hidden !p-0 shadow-xl",children:e.jsxs(D,{theme:"transparent",onClick:p,className:"!p-S w-full flex-wrap items-start justify-start gap-6",children:[e.jsx(ue,{width:112,height:160,className:"rounded-XS xs:grow-0 h-40 w-28 grow object-cover",alt:t.name,src:oe(t.thumbnailUrl)}),e.jsxs("div",{className:"space-y-2 text-start",children:[e.jsxs(h,{variant:"body-S",className:"flex items-center gap-1",color:"text-secondary",children:[e.jsx("span",{children:(a=t.propertyType)==null?void 0:a.name}),!!t.starRating&&e.jsx("span",{className:"text-body-XS rtl:h-4",children:"•"}),e.jsx("span",{className:"flex items-center gap-px",children:Array.from({length:t.starRating||0}).map((x,f)=>e.jsx(Se,{className:"text-text-secondary h-2.5 w-2.5 shrink-0"},f))})]}),e.jsx(h,{variant:"heading-XS",children:t.name}),e.jsxs(h,{variant:"body-S",color:"text-secondary",children:[t.distanceInMeters,d("hotels_common:cross_selling.map.m_from_center")]}),(!!((o=t.review)!=null&&o.score)||((l=t.review)==null?void 0:l.score)===0)&&e.jsxs("div",{className:"flex items-center gap-1 lg:self-end",children:[e.jsx(h,{variant:"body-S",strong:!0,className:"rounded-XS bg-action text-action-contrast inline-flex h-[26px] w-[26px] items-center justify-center",children:e.jsx("span",{children:t.review.score<10?t.review.score.toFixed(1):t.review.score})}),e.jsxs(h,{color:"text-secondary",variant:"body-S",className:"flex items-center gap-1",children:[e.jsx("span",{children:(r=t.review)==null?void 0:r.description}),(i=t.review)!=null&&i.count?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-body-XS rtl:h-4",children:"•"}),e.jsx("span",{children:d("hotels_common:reviews",{count:t.review.count})})]}):null]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(h,{variant:"body-S",color:"text-secondary",children:d("contentful_common:starts_from")}
5),e.jsx(U,{originalPrice:t.basePrice,currency:s})]})]})]})})},Or=Er,Rr=({price:t,currency:s,isSelected:n})=>e.jsxs("div",{className:A("group relative rounded-lg px-3 py-1.5 font-semibold shadow-md transition-all duration-200",n?"bg-action text-action-contrast z-10 scale-110 shadow-lg":"bg-primary text-primary-contrast hover:bg-action hover:text-action-contrast shadow-md hover:shadow-lg"),children:[e.jsx(U,{originalPrice:t,currency:s}),e.jsx("div",{className:A("absolute left-1/2 top-full h-0 w-0 -translate-x-1/2 border-8 border-transparent transition-all duration-200",n?"border-t-action":"border-t-primary group-hover:border-t-action")})]}),Ar=Rr,Tr=({hotels:t,selectedHotelId:s,onHotelSelect:n,onSelectedHotelClick:a,highlightedHotelId:o,defaultCenter:l={lat:24.7136,lng:46.6753},defaultZoom:r=12,currency:i,mapId:d,minZoom:u=8,maxZoom:c=18,restriction:m})=>{const[p,x]=g.useState(null),[f,_]=g.useState(l),[v,j]=g.useState(r),[y,N]=g.useState(null);g.useEffect(()=>{_(l)},[l]);const b=g.useMemo(()=>{if(!y)return[];const k=Al(t,y);return v>=c?k:k.slice(0,10)},[t,y,v,c]),S=g.useCallback(k=>{const I=k.detail.center,O=k.detail.zoom,M=k.detail.bounds;I&&_(I),O!==void 0&&j(O),M&&N({north:M.north,south:M.south,east:M.east,west:M.west})},[]),w=g.useCallback(k=>{x(k),n(k.hotelId)},[n]);return e.jsxs("div",{className:"relative z-0 h-full w-full",children:[e.jsx(dn,{mapId:d,colorScheme:"DARK",mapTypeControl:!1,gestureHandling:"greedy",streetViewControl:!1,fullscreenControl:!1,zoomControl:!1,disableDefaultUI:!0,clickableIcons:!1,className:"h-full w-full",onClick:()=>x(null),center:f,zoom:v,minZoom:u,maxZoom:c,restriction:m,onBoundsChanged:S,children:b.filter(k=>k.latitude&&k.longitude).map(k=>e.jsx(mn,{position:{lat:k.latitude,lng:k.longitude},onClick:()=>w(k),children:e.jsx(Ar,{price:k.basePrice,currency:i,isSelected:s===k.hotelId||o===k.hotelId})},k.hotelId))}),p&&e.jsx("div",{className:"absolute bottom-4 left-1/2 z-10 w-full max-w-[736px] -translate-x-1/2 px-4",children:e.jsx(Or,{hotel:p,currency:i,onClick:a?()=>a(p):void 0})})]})},cs=Tr,Fr=({onReset:t})=>{const{t:s}=L("hotels_common"),{locale:n}=R(),{state:a}=G(),{reset:o}=Ce(),l=g.useRef(null),r=()=>{o(P(C({},a),{checkInDate:a.checkInDate?Z(a.checkInDate,n,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:void 0}).date:"",checkOutDate:a.checkOutDate?Z(a.checkOutDate,n,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:void 0}).date:""}))};return g.useEffect(()=>{l.current&&l.current.open()},[]),e.jsx(ne,{ref:l,ignoreHistory:!0,size:"xl",customAction:({close:i})=>e.jsxs(e.Fragment,{children:[e.jsx(D,{shape:"outlined",theme:"action",onClick:i,children:s("hotels_common:cancel")}),e.jsxs(D,{theme:"action",onClick:t||r,children:[e.jsx(Ee,{className:"h-6 w-6 shrink-0"}),e.jsx(h,{variant:"heading-XS",children:s("hotels_common:cross_selling.map.refine_your_search")})]})]}),body:()=>e.jsx(xt,{className:"flex flex-col items-center justify-center text-center",showReset:!1})})},ds=Fr,Hr=t=>{const{hotelResults:s,isLoading:n,defaultCenter:a,mode:o}=t,{t:l}=L("hotels_common"),{map:r}=va(),{search:i,locale:d}=R(),{trackEvent:u}=W(),{state:c,setState:m}=G(),{state:p,setState:x}=Ce(),[f,_]=g.useState("list"),[v,j]=g.useState(it),y=g.useRef(void 0),N=g.useMemo(()=>o==="static"?f:i.get("view")==="map"?"map":"list",[o,i,f]),b=o==="static"?v:p,[S,w]=g.useState(),[k]=g.useState(),I=g.useMemo(()=>(s==null?void 0:s.hotels)||[],[s==null?void 0:s.hotels]),O=(s==null?void 0:s.currency)||"SAR",{filteredHotels:M}=gn({hotels:I,filterState:b}),E=g.useMemo(()=>{if(a)return a;if(I.length>0){const J=I.filter(ae=>ae.latitude&&ae.longitude);if(J.length>0){const ae=J.reduce((he,ge)=>he+ge.latitude,0)/J.length,me=J.reduce((he,ge)=>he+ge.longitude,0)/J.length;return{lat:ae,lng:me}}}return{lat:24.7136,lng:46.6753}},[a,I]),B=J=>{o==="static"?j(ae=>C(C({},ae),J)):(x(J,P(C({},c),{checkInDate:c.checkInDate?Z(c.checkInDate,d,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:void 0}).date:"",checkOutDate:c.checkOutDate?Z(c.checkOutDate,d,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:void 0}).date:""})),u({event:"stays_results_filter_applied",data:J}))},X=g.useCallback(J=>{w(J)},[]),K=()=>{o==="static"?_("list"):c.view==="map"&&(m({data:P(C({},c),{view:"list"})}),x(p,P(C({},c),{checkInDate:c.checkInDate?Z(c.checkInDate,d,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:void 0}).date:"",checkOutDate:c.checkOutDate?Z(c.checkOutDate,d,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:void 0}).date:"",view:"list"})))},Be=()=>{var J;o==="static"&&(_("map"),(J=y.current)==null||J.open())},$e=()=>{j(it)},Ke=o==="static"&&t.showViewToggle!==!1;return e.jsxs("div",{className:"flex flex-col gap-4",children:[Ke&&e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsx(h,{variant:"heading-XS",children:l("hotels_common:cross_selling.hotels_available",{count:M.length})}),N==="list"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(D,{shape:"outlined",theme:"action",className:"border-paper",onClick:Be,children:[e.jsx(_t,{className:"h-5 w-5 shrink-0"}),e.jsx(h,{color:"action",variant:"heading-XXS",children:l("hotels_common:cross_selling.map.map_view")})]}),e.jsx(ot,{hotels:I,value:b,onChange:B,count:M.length,options:["filters"],render:({onClick:J,label:ae})=>e.jsx(D,{shape:"outlined",theme:"action",className:"border-paper px-2",onClick:J,children:e.jsx(h,{color:"action",children:ae})})})]})]}),N==="list"||o==="static"?o==="static"?t.children(M,$e):t.children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:A("absolute top-0 z-10 bg-gradient-to-b from-black/70 via-black/50 to-black/5 pb-6 lg:static lg:bg-none","container"),children:e.jsx(ot,{hotels:I,value:b,onChange:B,count:M.length})}),e.jsx(ns,{apiKey:r.apiKey,children:e.jsxs("div",{className:"relative h-[calc(100svh-190px)] max-h-screen w-full md:h-[calc(100svh-210px)] lg:h-[c
5alc(100svh-360px)]",children:[n?e.jsx("div",{className:"absolute inset-0 z-30 flex items-center justify-center bg-black/30 backdrop-blur-sm",children:e.jsx("div",{className:"bg-body flex items-center rounded-lg p-6 shadow-lg",children:e.jsx(Ut,{width:40,className:"text-primary"})})}):(s==null?void 0:s.hotels.length)===0||M.length===0?e.jsx(ds,{}):null,e.jsx(D,{className:"absolute top-14 z-20 p-2 lg:top-6 ltr:right-4 lg:ltr:right-6 rtl:left-4 lg:rtl:left-6",theme:"action",onClick:K,children:e.jsx(we,{})}),e.jsx(cs,{hotels:M,currency:O,selectedHotelId:S,onHotelSelect:X,highlightedHotelId:k,defaultCenter:E,defaultZoom:12,mapId:r.mapId})]})})]}),e.jsx(ne,{ref:y,ignoreHistory:!0,size:"7xl",onClose:K,title:l("hotels_common:cross_selling.map.map_view"),action:!1,cancel:!1,body:()=>e.jsxs("div",{className:"relative space-y-4",children:[e.jsx(ot,{hotels:I,value:b,onChange:B,count:M.length}),e.jsx(ns,{apiKey:r.apiKey,children:e.jsxs("div",{className:"relative h-[400px] w-full lg:h-[500px]",children:[n?e.jsx("div",{className:"absolute inset-0 z-30 flex items-center justify-center bg-black/30 backdrop-blur-sm",children:e.jsx("div",{className:"bg-body flex items-center rounded-lg p-6 shadow-lg",children:e.jsx(Ut,{width:40,className:"text-primary"})})}):(s==null?void 0:s.hotels.length)===0||M.length===0?e.jsx(ds,{onReset:$e}):null,e.jsx(cs,{hotels:M,currency:O,selectedHotelId:S,onHotelSelect:X,onSelectedHotelClick:o==="static"?t.onSelectedHotelClick:void 0,highlightedHotelId:k,defaultCenter:E,defaultZoom:11,mapId:r.mapId})]})})]})})]})},wn=Hr,Br=({className:t})=>{const{appLoadingComponent:s}=ga();return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:"body{overflow:hidden}"}),e.jsx("section",{className:A("container flex max-w-screen-2xl flex-col gap-4 overflow-hidden px-0 pb-12 pt-20","lg:mt-0 lg:flex-row lg:overflow-visible lg:px-6 lg:pb-8",t),children:e.jsx("div",{className:"flex h-[calc(100svh-150px)] grow flex-col items-center justify-center space-y-1 rounded-xl lg:h-auto lg:min-h-[500px]",children:s||e.jsxs(e.Fragment,{children:[e.jsx(ta,{className:"h-20 w-52 md:h-32 md:w-72 md:py-4"}),e.jsx(Zn,{})]})})})]})},ft=Br,$r=({className:t,showSearch:s=!1,reload:n=!1,onReload:a,initialSearch:o,onSearch:l})=>{const{setState:r,state:i}=G(),{t:d}=L(["hotels_common"]),{trackEvent:u}=W(),c=o||i,[m,p]=g.useState([c.checkInDate,c.checkOutDate]),x=Tt({defaultValues:{location:c.location,checkInDate:c.checkInDate,checkOutDate:c.checkOutDate,adults:c.adults,children:c.children,childrenAges:c.childrenAges,sId:c.sId}}),f=v=>{p(v);const j=x.getValues("checkInDate"),y=x.getValues("checkOutDate");v[0]&&(j==null?void 0:j.getTime())!==v[0].getTime()&&u({event:"stays_details_check_in_date_selected",data:{checkin_date:v[0]}}),v[1]&&(y==null?void 0:y.getTime())!==v[1].getTime()&&u({event:"stays_details_check_out_date_selected",data:{checkout_date:v[1]}}),x.setValue("checkInDate",v[0]),x.setValue("checkOutDate",v[1])},_=v=>{l?l(v):(n&&(a==null||a()),r({data:P(C({},i),{checkInDate:v.checkInDate,checkOutDate:v.checkOutDate,location:v.location,adults:v.adults,children:v.children,childrenAges:v.childrenAges,sId:v.sId,price:Number(i.price)}),path:n?`${window.location.pathname}/book`:window.location.pathname,reload:n}))};return e.jsx(Hs,P(C({},x),{children:e.jsx("form",{className:A("block space-y-4 rounded-xl pb-6 md:hidden md:pb-0",t),onSubmit:x.handleSubmit(_),id:"details-search-form",children:e.jsxs("div",{className:"border-paper rounded-S flex border first:grow [&>div]:w-full",children:[e.jsx(re,{control:x.control,name:"checkInDate",rules:{required:d("hotels_common:validation.required")},render:({field:{onChange:v},fieldState:{error:j}})=>e.jsx(wt,{value:m,onChange:y=>{f(y),v(y==null?void 0:y[0])},error:j==null?void 0:j.message,searchType:"detail",className:"gap-1",valueTypographyVariant:"body-M"})}),e.jsx("div",{className:"!w-1/3 shrink-0",children:e.jsx(Qs,{type:"detail"})}),s&&e.jsx("div",{className:"flex !w-min max-w-20 shrink-0 justify-end",children:e.jsx(D,{type:"submit",shape:"text",className:"px-2",children:e.jsx(Ee,{className:"h-6 w-6 shrink-0"})})})]})})}))},Bt=$r,Zr=({hotel:t,type:s="listing",sId:n,cardPosition:a,onChange:o,search:l})=>{var r,i,d,u,c,m;const{trackEvent:p}=W(),{t:x}=L(["hotels_common"]),{locale:f}=R(),{state:_,setState:v}=G(),{state:j}
5=Ce(),y=l||_,N=y.checkInDate&&Ae({from:y.checkInDate,to:y.checkOutDate,units:["day"]}),b=j.priceFilter==="averagePrice",S=()=>{o?o(t):v({data:P(C({},y),{sId:n,price:t.basePrice}),path:`/${f}/hotels/${t.hotelId}`}),p({event:"stays_results_card_selected",data:{location_code:y.location,location_name:y.city,rooms_count:y.adults.length,guests_count:y.adults.reduce((w,k)=>w+k,0)+y.children.reduce((w,k)=>w+k,0),children_ages:y.childrenAges,hotel_name:t.name,hotel_code:t.hotelId,price:b?t.basePriceNightlyRate:t.basePrice,star_rating:t.starRating,card_position:a}})};return e.jsx(D,{className:"block w-full px-0 py-4 text-start",theme:"transparent",shape:"text",onClick:S,children:e.jsxs("div",{className:A("flex items-start lg:items-stretch",s==="similar_stays"?"flex-col gap-2":"gap-6"),children:[e.jsx(ue,{width:150,height:150,className:A("rounded-M aspect-1 object-cover",s==="similar_stays"?"w-full":"w-28 lg:w-40"),alt:t.name,src:oe(t.thumbnailUrl)}),e.jsxs("div",{className:"flex w-full flex-col justify-between space-y-2 lg:space-y-0",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(h,{variant:"body-S",className:"flex items-center gap-1",color:"text-secondary",children:[e.jsx("span",{children:(r=t.propertyType)==null?void 0:r.name}),!!t.starRating&&e.jsx("span",{className:"text-body-XS rtl:h-4",children:"•"}),e.jsx("span",{className:"flex items-center gap-px",children:Array.from({length:t.starRating||0}).map((w,k)=>e.jsx(Se,{className:"text-text-secondary h-2.5 w-2.5 shrink-0"},k))})]}),e.jsx(h,{variant:"heading-XS",children:t.name}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:t.address}),t.freeCancellation&&e.jsxs(h,{variant:"body-S",color:"success",className:A("hidden",s==="similar_stays"?"":"items-center gap-1.5 lg:flex"),children:[e.jsx(Me,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{children:x("hotels_common:free_cancellation")})]})]}),e.jsxs("div",{className:A("flex w-full flex-col items-start gap-2",(i=t.review)!=null&&i.score?"justify-between":"justify-end",s==="similar_stays"?"space-y-1":"lg:flex-row lg:text-end"),children:[(!!((d=t.review)!=null&&d.score)||((u=t.review)==null?void 0:u.score)===0)&&e.jsxs("div",{className:"flex items-center gap-1 lg:self-end",children:[e.jsx(h,{variant:"body-S",strong:!0,className:"rounded-XS bg-action text-action-contrast inline-flex h-[26px] w-[26px] items-center justify-center",children:e.jsx("span",{children:t.review.score<10?t.review.score.toFixed(1):t.review.score})}),e.jsxs(h,{color:"text-secondary",variant:"body-S",className:"flex items-center gap-1",children:[e.jsx("span",{children:(c=t.review)==null?void 0:c.description}),(m=t.review)!=null&&m.count?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-body-XS rtl:h-4",children:"•"}),e.jsx("span",{children:x("hotels_common:reviews",{count:t.review.count})})]}):null]})]}),e.jsxs("div",{children:[t.showDiscount&&e.jsxs("div",{className:"flex items-center gap-1 lg:justify-end",children:[t.discountPriceNightlyRate&&t.discountPrice&&e.jsx(U,{className:"text-text-secondary line-through",originalPrice:b?t.discountPriceNightlyRate+t.basePriceNightlyRate:t.discountPrice+t.basePrice}),t.discountPercentage&&e.jsx("div",{className:"rounded-XS bg-success-900 my-1.5 w-8 px-1 py-0.5 text-center",children:e.jsxs(h,{variant:"body-XS",className:A(s==="similar_stays"?"hidden":""),children:[t.discountPercentage,"%"]})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(U,{originalPrice:b?t.basePriceNightlyRate:t.basePrice,className:A(s==="similar_stays"?"":"w-full lg:justify-end"),priceClassName:"text-body-M lg:text-heading-S",currencyClassName:"text-body-M lg:text-heading-S"}),e.jsxs(h,{variant:"body-S",color:"text-secondary",className:A(s==="similar_stays"?"block":"hidden"),children:["/ ",x("hotels_common:total_for_nights",{count:N==null?void 0:N.day})]})]}),e.jsxs(h,{variant:"body-XS",color:"text-secondary",children:[b?x("hotels_common:average_per_night"):x("hotels_common:total_for_nights",{count:N==null?void 0:N.day})," ","(",x("hotels_common:vat_included"),")"]})]}),e.jsx(h,{variant:"body-S",color:t.freeCancellation?"success":"error",className:"flex items-center gap-1 lg:hidden",children:t.freeCancellation&&e.jsxs(e.Fragment,{children:[e.jsx(Me,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{children:x("hotels_common:free_cancellation")})]})})]})]})]})})},kn=Zr,zr=({poster:t,carousel:s,className:n})=>{const a=s||[t];return e.jsx(be,{rootClassName:n,className:"aspect-1 mx-auto max-w-[600px]",thumbClassName:"mx-auto max-w-[600px] pt-2",thumbs:a.length>1?({scrollTo:o,selectedIndex:l})=>e.jsx("div",{className:"flex gap-2",children:a.map((r,i)=>e.jsxs("button",{className:"aspect-1 relative shrink-0 overflow-hidden rounded-lg","aria-label":r.title,onClick:()=>o(i),children:[i!==l&&e.jsx("div",{className:"bg-body/70 absolute inset-0 z-10"}),e.jsx(fe,{className:"relative block h-20 w-20 object-cover",title:r.title,src:oe(r.src)})]},r.src+i))}):void 0,children:a.map((o,l)=>e.jsx("div",{className:"aspect-1 mr-1 shrink-0 basis-full",children:e.jsx("figure",{className:"h-full w-full",children:e.jsx(fe,{className:"h-full w-full overflow-hidden rounded-lg object-cover",title:o.title,src:oe(o.src)})})},o.src+l))})},Ur=zr,Vr=({hotel:t,small:s=!1})=>{const{t:n}=L("hotels_common"),[a,o]=g.useState(0),l=g.useMemo(()=>{var u,c;return((c=(u=t.imageCategories)==null?void 0:u.filter(m=>{var p;return!!((p=m.images)!=null&&p.length)}))==null?void 0:c.flatMap(m=>m.images.filter(p=>!!p.url).map(p=>({title:p.description||"",src:oe(p.url)}))))||[]},[t]),r=l.slice(0,2),i=l.slice(2,4),d=l.length>2;return l.length?l.length<=1?e.jsxs(e.Fragment,{children:[e.jsx(fe,{className:"aspect-3 hidden w-full rounded-md object-cover object-center md:block",src:l[0].src,alt:l[0].title}),e.jsx(fe,{className:"mx-auto w-full max-w-md rounded-md object-cover object-center md:hidden",src:l[0].src,alt:l[0].title})]}):e.jsxs(e.Fragment,{children:[e.jsx(zn,{startIndex:a,render:({open:u})=>e.jsxs("div",{"data-images":l.length,className:`relative hidden gap-2 ${s?"":"sm:flex"}`,children:[r.map((c,m)=>e.jsx(D,{onClick:()=>{u(),o(m)},theme:"white",className:"relative aspect-[1/1] max-h-[400px] w-full flex-1 bg-transparent hover:bg-transparent [&:nth-child(1)]:basis-[20%] [&:nth-child(2)]:basis-[20%]",children:e.jsx(fe,{src:c.src,className:"absolute inset-0 h-full w-full cursor-pointer rounded-md object-cover",alt:c.title})},m)),i.length>1&&e.jsx("div",{className:"hidden flex-1 space-y-2 md:block",children:i.map((c,m)=>e.jsx(D,{onClick:()=>{u(),o(m+2)},theme:"white",className:"aspect-1 relative max-h-[196px] w-full flex-1 bg-transparent hover:bg-transparent",children:e.jsx(fe,{src:c.src,className:"absolute inset-0 h-full w-full cursor-pointer rounded-md object-cover",alt:c.title})},m+2))}),d&&e.jsx(D,{theme:"white",shape:"solid","data-images":l.length,className:"absolute bottom-2 text-xs capitalize data-[images=4]:md:hidden ltr:right-7 rtl:left-7",onClick:()=>{u(),o(r.length+i.length)},children:n("hotels_common:see_all_photos",{number:l.length})})]}),slides:l}),e.jsx(Ur,{className:s?"":"sm:hidden",poster:{src:l[0].src,title:l[0].title},carousel:l})]}):null},Sn=Vr,Gr=({option:t,cardPosition:s,onOptionSelect:n})=>{var a,o,l,r,i;const{locale:d,params:u}=R(),{t:c}=L("hotels_common"),{trackEvent:m}=W(),{setSummary:p,pId:x,hotelId:f,hotelDetails:_,numberOfNights:v}=ee(),{state:j}=G(),y=g.useMemo(()=>{const I=j.adults.reduce((M,E)=>M+E,0),O=j.children.reduce((M,E)=>M+E,0);return I+O},[j.adults,j.children]),N=(a=t.cancellationPolicies)==null?void 0:a.hasFreeCancellation,b=(l=(o=t.cancellationPolicies)==null?void 0:o.cancellationPolicyDetails)==null?void 0:l.dateFrom,S=(i=(r=t.cancellationPolicies)==null?void 0:r.cancellationPolicyDetails)==null?void 0:i.cancellationFee,w=b?Ot(Rt(b).getTime(),Date.now()):!1,k=()=>{m({event:"stays_room_selected",data:{location_code:j.location,location_name:j.city,hotel_name:_==null?void 0:_.name,hotel_code:f,card_position:s,room_type:t.roomBasis,price:t.packageRateInfo.total,guests_count:y,star_rating:_==null?void 0:_.starRating,checkin:j.checkInDate,checkout:j.checkOutDate,nb_guests:y,room_name:t.roomBasis,hotel_id:(u==null?void 0:u.id)||"",destination:(_==null?void 0:_.location.address)||`${_==null?void 0:_.location.city}, ${_==null?void 0:_.location.country}`}}),n?n(t):p({packageId:t.packageId,pId:x,mode:"guest_details"}),Ds()};return e.jsxs("div",{className:"flex flex-col justify-between space-y-4 lg:flex-row lg:space-y-0",children:[e.jsxs("div",{className:"flex flex-col justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-1 md:flex-col md:items-start md:justify-start",children:[e.jsx(h,{variant:"label-L",children:c(`hotels_common:${t.roomBasis}`)}),e.jsxs(h,{variant:"body-S",className:"flex items-center gap-1",children:[e.jsx(Pt,{className:"h-3 w-3 shrink-0"}),c("hotels_common:fits",{count:y})]})]}),e.jsxs("div",{className:"flex max-w-lg items-start gap-2",children:[N?e.jsx(Me,{className:"text-success mt-1 h-3 w-3 shrink-0"}):w?e.jsx(dt,{className:"text-error mt-1.5 h-3 w-3 shrink-0"}):e.jsx(na,{className:"mt-2 h-3 w-3 shrink-0 text-blue-500"}),b?e.jsx(h,{as:"div",variant:"body-S",color:N?"success":w?"error":"text-secondary",children:N?c("hotels_common:free_cancellation_before",{date:V(b,d,{day:"numeric",month:"long",year:"numeric"})}
5):w?c("hotels_common:non_refundable"):S?e.jsx(ut,{i18nKey:"hotels_common:cancellation_with_fees",ns:"hotels_common",values:{date:V(b,d,{day:"numeric",month:"long",year:"numeric"})},children:e.jsx(U,{originalPrice:S,currency:t.packageRateInfo.currency,className:"inline-flex",priceClassName:"text-body-S relative rtl:top-1"})}):null}):null]})]}),e.jsxs("div",{className:"flex shrink-0 flex-row justify-between gap-4 lg:flex-col",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(U,{originalPrice:t.packageRateInfo.total,className:"lg:justify-end"}),e.jsxs(h,{variant:"body-XS",color:"text-secondary",children:[c("hotels_common:total_for_nights",{count:v})," ",c("hotels_common:vat_included")]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(D,{theme:"action",onClick:k,children:c("hotels_common:book")})})]})]})},Xr=Gr,qr=({templateData:t})=>{const{t:s}=L("hotels_common"),{hotelDetails:n}=ee(),a=g.useMemo(()=>{var l;return(l=t.imageCategories)==null?void 0:l.flatMap(r=>r.images)},[t.imageCategories]),o=g.useMemo(()=>{var l,r;return[t.roomSize?{icon:e.jsx(yl,{className:"h-3 w-3 shrink-0"}),title:s("hotels_common:room_size",{size:t.roomSize})}:null,{icon:(l=t.roomBedGroups)!=null&&l.bedGroup?e.jsx(gt,{className:"h-3 w-3 shrink-0"}):null,title:((r=t.roomBedGroups)==null?void 0:r.bedGroup)||null}]},[t,s]);return e.jsx(ne,{title:e.jsxs("div",{className:"text-center",children:[e.jsx(h,{variant:"label-L",children:t.templateTitle}),e.jsx(h,{variant:"label-XS",color:"text-secondary",children:n==null?void 0:n.name})]}),render:({open:l})=>e.jsx(D,{shape:"text",theme:"transparent",className:"p-px",onClick:l,children:e.jsx(h,{variant:"link-S",children:s("hotels_common:more_room_info")})}),action:!1,cancel:!1,bodyClassName:"p-0",body:()=>{var l,r;return e.jsxs(e.Fragment,{children:[!!(a!=null&&a.length)&&e.jsx(be,{dots:!0,children:a.map(i=>e.jsx(ue,{src:oe(i==null?void 0:i.url),className:"relative max-h-48 shrink-0 basis-full object-cover"},i==null?void 0:i.id))}),e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(h,{variant:"heading-M",children:t.templateName}),e.jsx("ul",{className:"space-y-2",children:o.map((i,d)=>i&&e.jsxs("li",{className:"flex items-center gap-1",children:[i.icon,e.jsx(h,{variant:"body-S",children:i.title})]},d))})]}),e.jsx(H,{}),(l=t.facilityCategories)!=null&&l.length?e.jsx(h,{variant:"heading-S",children:s("hotels_common:amenities")}):null,e.jsx("div",{className:"space-y-4",children:(r=t.facilityCategories)==null?void 0:r.map((i,d)=>{var u;return e.jsxs("div",{className:"flex gap-3",children:[e.jsx("img",{src:i.icon_url,alt:i.name,className:"h-6 w-6 shrink-0 invert"}),e.jsxs("div",{className:"space-y-2",children:[i.name&&e.jsx(h,{variant:"label-S",children:i.name}),!!((u=i.facilities)!=null&&u.length)&&e.jsx("ul",{className:"space-y-1",children:i.facilities.map(c=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(Dt,{className:"h-4 w-4 shrink-0 text-transparent"}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:c.name})]},c.id))})]})]},d)})})]})]})}})},Wr=qr,Jr=({room:t,roomsNumber:s,pkgRoomsNumber:n})=>{var a,o,l,r,i;const{t:d}=L("hotels_common"),u=t.numberOfAdults,c=t.kidsAges.length,m=u+c;return e.jsxs("div",{className:`flex gap-3 px-6 pb-6 md:pt-0 ${n===1?"pt-6":""}`,children:[e.jsx(ue,{src:oe((r=(l=(o=(a=t.templateData.imageCategories)==null?void 0:a[0])==null?void 0:o.images)==null?void 0:l[0])==null?void 0:r.url),className:`rounded-M h-28 w-28 shrink-0 object-cover ${n===1?"hidden md:block":""}`}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsxs(h,{variant:"label-L",children:[s>1?`${s} x`:""," ",t.roomName]}),e.jsxs(h,{variant:"body-S",className:"lowercase",children:[d("hotels_common:for")," ",d("hotels_common:adults",{count:u}),c>0&&`, ${d("hotels_common:child",{count:c})}`]})]}),e.jsxs(h,{variant:"body-S",color:"text-secondary",className:"flex items-center gap-1",children:[e.jsx(gt,{className:"h-3 w-3 shrink-0"}),(i=t.templateData.roomBedGroups)!=null&&i.bedGroup?`${t.templateData.roomBedGroups.bedGroup} - `:"",d("hotels_common:fits",{count:m})]}),e.jsx(Wr,{templateData:t.templateData})]})]})},Kr=Jr,Yr=({pkg:t,packageIndex:s,onOptionSelect:n})=>{var a;const{t:o}=L("hotels_common"),{numberOfNights:l}=ee(),r=g.useMemo(()=>t.options.sort((u,c)=>u.packageRateInfo.total-c.packageRateInfo.total)[0].packageRateInfo.total,[t.options]),i=g.useMemo(()=>{var u;return(u=t.rooms[0].templateData.imageCategories)==null?void 0:u.flatMap(c=>{var m;return(m=c.images)==null?void 0:m.map(p=>p)})},[t.rooms]),d=g.useMemo(()=>{const u={};
5return t.rooms.forEach(c=>{const m=`${c.templateId}-${c.numberOfAdults}-${c.kidsAges.length}`;u[m]||(u[m]=P(C({},c),{count:0})),u[m].count++}),Object.values(u)},[t]);return e.jsxs(z,{className:"!p-0",children:[t.rooms.length===1&&i&&e.jsx(be,{dots:!0,rootClassName:"block md:hidden",children:i.map(u=>e.jsx(ue,{src:oe(u==null?void 0:u.url),height:192,className:"rounded-XS relative max-h-48 shrink-0 basis-full object-cover"},u==null?void 0:u.id))}),e.jsxs(h,{variant:"heading-XS",className:`px-6 pb-4 pt-6 md:block ${t.rooms.length===1?"hidden":""}`,children:[t.rooms.length>1?`${t.rooms.length} x`:""," ",t.packageName]}),e.jsx("div",{className:"flex flex-wrap gap-6",children:d.map(u=>e.jsx(Kr,{room:u,roomsNumber:u.count,pkgRoomsNumber:t.rooms.length},u.templateId))}),!!((a=t.options)!=null&&a.length)&&e.jsx(ye,{defaultOpen:s===0,trigger:e.jsxs(D,{shape:"text",theme:"transparent",className:"rounded-b-XS flex w-full items-center justify-between p-6",children:[e.jsxs("div",{className:"group-data-[state=open]:hidden",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(h,{variant:"body-S",color:"text-secondary",children:o("hotels_common:from")}),e.jsx(U,{originalPrice:r})]}),e.jsxs(h,{variant:"body-XS",color:"text-secondary",children:[o("hotels_common:total_for_nights",{count:l})," ","(",o("hotels_common:vat_included"),")"]})]}),e.jsxs(h,{variant:"body-S",className:"flex items-center justify-end gap-1 group-data-[state=open]:w-full",children:[e.jsx("span",{className:"group-data-[state=closed]:block group-data-[state=open]:hidden",children:o("hotels_common:view_options")}),e.jsx("span",{className:"group-data-[state=open]:block group-data-[state=closed]:hidden",children:o("hotels_common:hide_options")}),e.jsx(se,{className:"h-3 w-3 shrink-0 rotate-90 transition-all group-data-[state=open]:-rotate-90"})]})]}),className:"bg-body-level-1 divide-paper rounded-b-XS border-body-level-1 data-[state=open]:border-paper group divide-y border-t data-[state=open]:bg-transparent",children:t.options.map((u,c)=>e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-6",children:e.jsx(Xr,{option:u,cardPosition:c+1,onOptionSelect:n})},c),c!==t.options.length-1&&e.jsx(H,{})]}))})]})},Qr=Yr,ei=({packages:t,initialSearch:s,onOptionSelect:n,small:a=!1,onSearch:o})=>{const{t:l}=L("hotels_common");return e.jsxs("div",{"data-small":a,className:"w-full space-y-0 data-[small=false]:lg:space-y-6",children:[!!(t!=null&&t.length)&&e.jsx(h,{as:"h1",variant:"heading-XL",className:"hidden group-data-[small=false]:lg:block",children:l("hotels_common:choose_rooms")}),e.jsxs("div",{className:"space-y-6 pb-6",children:[e.jsx("div",{className:"mt-6",children:e.jsx(Bt,{onSearch:o,showSearch:!0,className:`p-0 ${a?"md:block":"md:hidden"} `,initialSearch:s})}),t!=null&&t.length?e.jsx("div",{className:"space-y-6 overflow-hidden",children:t==null?void 0:t.map((r,i)=>e.jsx(Qr,{pkg:r,packageIndex:i,onOptionSelect:n?d=>n(P(C({},d),{packageName:r.packageName})):void 0},`${r.packageName}${i}`))}):e.jsxs("div",{className:"w-full space-y-6 pb-6",children:[e.jsx(Us,{className:"h-12 w-12"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{variant:"heading-M",children:l("hotels_common:no_rooms_found")}),e.jsx(h,{color:"text-secondary",children:l("hotels_common:no_rooms_found_description")})]})]})]})]})},Cn=ei,ti=({initialSearch:t,onSubmit:s})=>{const{t:n}=L("hotels_common"),{locale:a}=R(),{guests:o,fromDate:l,toDate:r,rooms:i}=g.useMemo(()=>{const d=t==null?void 0:t.adults.reduce((m,p)=>m+p,0),u=t==null?void 0:t.children.reduce((m,p)=>m+p,0);return{guests:d+u,rooms:t==null?void 0:t.adults.length,fromDate:V((t==null?void 0:t.checkInDate)||new Date,a,{month:"short",day:"2-digit",timeZone:void 0}),toDate:V((t==null?void 0:t.checkOutDate)||Oe({date:new Date,value:1,interval:"day"}),a,{month:"short",day:"2-digit",timeZone:void 0})}},[t,a]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{variant:"heading-M",children:n("hotels_common:cross_selling.stay_in_comfort")}),e.jsx(h,{color:"text-secondary",children:n("hotels_common:cross_selling.stay_in_comfort_description")})]}),e.jsxs(z,{border:!1,surface:"level-1",className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{variant:"label-S",color:"text-secondary",children:n("hotels_common:cross_selling.hotel_near_venue",{venue:t.venue})}),e.jsx(h,{variant:"label-S",children:n("hotels_common:cross_selling.search_info",{from:l,to:r,rooms:i,guests:o})})]}),e.jsx(ne,{action:{label:n("hotels_common:cross_selling.update_search"),className:"w-full",type:"submit",form:"hotels-search-form"},cancel:!1,ignoreHistory:!0,size:"2xl",render:({open:d})=>e.jsx(D,{shape:"text",onClick:d,children:e.jsx(h,{variant:"body-S",strong:!0,children:n("hotels_common:cross_selling.change")})}),title:n("hotels_common:cross_selling.update_hotel_search"),body:({close:d})=>e.jsx(Ge,{small:!0,initialSearch:{location:t.location,city:t.city,adults:t.adults,children:t.children,childrenAges:t.childrenAges,checkInDate:t.checkInDate,checkOutDate:t.checkOutDate,sId:t.sId},className:"max-w-none",showSearchButton:!1,onFormSubmit:u=>{s(P(C({},u),{location:u.location.location,city:u.location.city})),d()}})})]})]})},si=ti,ni=()=>e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"bg-body-level-1 aspect-[1/1] max-h-[400px] w-full animate-pulse rounded-lg"}),e.jsx("div",{className:"flex gap-2 overflow-hidden",children:Array.from({length:10}).map((t,s)=>e.jsx("div",{className:"bg-body-level-1 h-20 w-20 shrink-0 animate-pulse rounded-lg"},s))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"bg-body-level-1 h-8 w-8 animate-pulse rounded"}),e.jsx("div",{className:"bg-body-level-1 h-2 w-2/3 animate-pulse rounded-md"})]})]}),ai=ni,li=({hotelId:t,search:s,onOptionSelect:n})=>{const[a,o]=g.useState(!0),{locale:l}=R(),[r,i]=g.useState(s),{data:d,isLoading:u,isRefetching:c}=Ts({lang:l,checkIn:r.checkInDate?Z(r.checkInDate,l,{day:"2-digit",month:"2-digit",year:"numeric",timeZone:void 0}).date:"",checkOut:r.checkOutDate?Z(r.checkOutDate,l,{day:"2-digit",month:"2-digit",year:"numeric",timeZone:void 0}).date:"",hotelId:t,roomsInfo:r.adults.map((_,v)=>{var j;return{adultsCount:_,kidsAges:(j=r.childrenAges[v])!=null&&j.filter(y=>y!=="").length?r.childrenAges[v].map(Number):[]}})}),{data:m,isLoading:p,error:x}=Fs({id:(d==null?void 0:d.pId)||"",lang:l},{enabled:!!(d!=null&&d.pId)&&!c,refetchInterval:a?2e3:!1,refetchOnWindowFocus:a});return g.useEffect(()=>{(m!=null&&m.pollingStatus&&(m==null?void 0:m.pollingStatus)!=="IN_PROGRESS"||x)&&o(!1)},[m]),p||u||c||(m==null?void 0:m.pollingStatus)==="IN_PROGRESS"&&!(m!=null&&m.packages.length)?e.jsx(ft,{}):e.jsx(Cn,{onSearch:_=>i(_),packages:m==null?void 0:m.packages,initialSearch:r,onOptionSelect:_=>n==null?void 0:n(P(C({},_),{pId:d==null?void 0:d.pId,sId:d==null?void 0:d.sId})),small:!0})},oi=li,ri=({id:t,mode:s,search:n,onOptionSelect:a,onHotelSelect:o})=>{var l,r,i,d,u,c,m;const{t:p}=L("hotels_common"),{locale:x}=R(),{data:f,isLoading:_}=mt({hotelId:t,lang:x}),{data:v,isLoading:j}=As({hotelId:t,lang:x}),y=_||j;return s==="details"?e.jsx(e.Fragment,{children:y?e.jsx(ai,{}):e.jsxs("div",{className:"space-y-6",children:[!!f&&e.jsx(Sn,{hotel:f,small:!0}),(((l=v==null?void 0:v.aggregates)==null?void 0:l.averageRating)||((r=v==null?void 0:v.aggregates)==null?void 0:r.summary))&&e.jsxs("div",{className:"flex items-center gap-2",children:[((i=v==null?void 0:v.aggregates)==null?void 0:i.averageRating)&&e.jsx("div",{className:"bg-body-dark text-body-light rounded p-1",children:e.jsx(h,{variant:"body-M",strong:!0,children:(d=v==null?void 0:v.aggregates)==null?void 0:d.averageRating})}),!!((u=v==null?void 0:v.aggregates)!=null&&u.summary)&&e.jsx(h,{variant:"link-S",children:p("hotels_common:cross_selling:based_on_reviews",{reviews:(c=v==null?void 0:v.aggregates)==null?void 0:c.summary,count:(m=v==null?void 0:v.aggregates)==null?void 0:m.reviewCount})})]})]})}):e.jsx(oi,{hotelId:t,search:n,onOptionSelect:N=>{a(N),f&&o(C({id:t},f))}})},ii=ri,ci=({hotel:t,search:s,onOptionSelect:n,onHotelSelect:a,render:o,ref:l})=>{const[r,i]=g.useState("details"),{t:d}=L("hotels_common");return t?e.jsx(ne,{render:o,ref:l,cancel:!1,action:r==="details"?{className:"w-full",label:d("hotels_common:cross_selling.select_rooms"),onClick:()=>i("room_selection")}:!1,title:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-center gap-px",children:Array.from({length:t.starRating||0}).map((u,c)=>e.jsx(Se,{className:"text-text-secondary h-2.5 w-2.5 shrink-0"},c))}),e.jsx(h,{variant:"heading-L",children:t.name}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:t.address})]}),body:()=>e.jsx(ii,{id:t.hotelId.toString(),mode:r,search:s,onOptionSelect:n,onHotelSelect:a})}):null},us=ci,di=({search:t,onOptionSelect:s,onHotelSelect:n,pollingEnabled:a,onPollingChange:o,onSearch:l})=>{var r,i;const{t:d}=L("hotels_common"),{locale:u}=R(),[c,m]=g.useState(),p=g.useRef(null),{data:x,isLoading:f,isRefetching:_,error:v}=Os({lang:u,checkIn:t.checkInDate?Z(t.checkInDate,u,{day:"2-digit",month:"2-digit",year:"numeric",timeZone:void 0}).date:"",checkOut:t.checkOutDate?Z(t.checkOutDate,u,{day:"2-digit",month:"2-digit",year:"numeric",timeZone:void 0}).date:"",geoLocation:t.location?void 0:t.geoLocation,placeId:t.location&&isNaN(Number(t.location))?t.location:void 0,hotelId:t.location&&!isNaN(Number(t.location))?t.location:void 0,roomsInfo:t.adults.map((w,k)=>{var I;return{adultsCount:w,kidsAges:(I=t.childrenAges[k])!=null&&I.filter(O=>O!=="").length?t.childrenAges[k].map(Number):[]}})},{enabled:!!t.checkInDate&&!!t.checkOutDate}),{data:j,isLoading:y,error:N}=Rs({lang:u,id:(x==null?void 0:x.sId)||""},{enabled:!!(x!=null&&x.sId)&&!_,refetchInterval:a?2e3:!1,refetchOnWindowFocus:a}),b=w=>{m(w),p.current&&p.current.open()};g.useEffect(()=>{(j!=null&&j.searchStatus&&(j==null?void 0:j.searchStatus)!=="IN_PROGRESS"&&a||v||N)&&o(!1)},[j,v,N,a]);const S=f||y||_||(j==null?void 0:j.searchStatus)==="IN_PROGRESS"&&!(j!=null&&j.hotels.length);return e.jsxs(e.Fragment,{children:[e.jsx(si,{initialSearch:P(C({},t),{sId:(x==null?void 0:x.sId)||""}),onSubmit:w=>{l(w),o(!0)}}),S?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"bg-body-level-1 h-4 w-1/2 animate-pulse rounded-md"}),e.jsx("div",{className:"bg-body-level-1 h-4 w-8 animate-pulse rounded-md"})]}),Array.from({length:2}).map((w,k)=>e.jsx("div",{className:"bg-body-level-1 rounded-M h-40 animate-pulse"},k))]}):j!=null&&j.hotels.length?e.jsxs(e.Fragment,{children:[e.jsx(wn,{mode:"static",hotelResults:j,isLoading:y,onSelectedHotelClick:b,defaultCenter:t.geoLocation?{lat:(r=t.geoLocation)==null?void 0:r.latitude,lng:(i=t.geoLocation)==null?void 0:i.longitude}:void 0,showViewToggle:!0,children:(w,k)=>e.jsx(e.Fragment,{children:w.length===0?e.jsx("div",{className:"container py-6",children:e.jsx(xt,{onReset:k})}):e.jsx("div",{className:"divide-body-level-1 divide-y",children:w.map((I,O)=>e.jsx(us,{render:({open:M})=>e.jsx(kn,{search:t,hotel:I,sId:(x==null?void 0:x.sId)||"",cardPosition:O+1,onChange:M},I.hotelId),onHotelSelect:n,onOptionSelect:s,search:t,hotel:I},I.hotelId))})})}),e.jsx(us,{ref:p,onHotelSelect:n,onOptionSelect:s,search:t,hotel:c})]}):e.jsx(h,{className:"text-text-secondary flex justify-center",children:d("hotels_common:no_available_hotels")})]})},ui=di,ms=(t,s)=>t&&s?`${t}, ${s}`:t||s,hs=(t,s)=>`https://maps.google.com/?q=${t},${s}`,mi=(t,s="country")=>{const n=t==null?void 0:t.replace("+","");return pe.find(a=>
5s==="dial"?a.dial_code===n:a.code===t)||pe[0]},hi=({initialSearch:t,onFinish:s,onRemove:n,hotel:a,onReview:o})=>{const{user:l}=ht(),{t:r}=L("hotels_common"),[i,d]=g.useState(!0),{locale:u}=R(),[c,m]=g.useState(t),[p,x]=g.useState(),[f,_]=g.useState(),{data:v,isLoading:j}=Es({pId:(p==null?void 0:p.pId)||"",sId:(p==null?void 0:p.sId)||"",hotelId:(f==null?void 0:f.id)||"",packageId:(p==null?void 0:p.packageId)||"",lang:u},{enabled:!!(p!=null&&p.packageId)&&!!(p!=null&&p.pId)&&!!(p!=null&&p.sId)&&!a}),y=g.useMemo(()=>c.adults.reduce((S,w)=>S+w,0)+c.children.reduce((S,w)=>S+w,0),[c]);g.useEffect(()=>{v!=null&&v.hotelReservationId&&o({hotelReservationId:v==null?void 0:v.hotelReservationId})},[v==null?void 0:v.hotelReservationId]);const N=S=>{s(S)},b=g.useMemo(()=>{var S,w,k,I,O,M,E,B,X;const K=(a==null?void 0:a.travelers[0].gender)||(l==null?void 0:l.gender);return{thumbnailUrl:oe(((S=a==null?void 0:a.hotel.images)==null?void 0:S[0])||(f==null?void 0:f.thumbnailUrl)),name:(a==null?void 0:a.hotel.hotelName)||(f==null?void 0:f.name),checkInDate:(a==null?void 0:a.reservation.checkin)||c.checkInDate,checkOutDate:(a==null?void 0:a.reservation.checkout)||c.checkOutDate,location:a?ms(a.hotel.city,a.hotel.country):ms((w=f==null?void 0:f.location)==null?void 0:w.city,(k=f==null?void 0:f.location)==null?void 0:k.country),googleMapsUrl:a?hs(a.hotel.mapCoordinates.latitude,a.hotel.mapCoordinates.longitude):hs(((I=f==null?void 0:f.location)==null?void 0:I.latitude)||0,((O=f==null?void 0:f.location)==null?void 0:O.longitude)||0),packageName:(a==null?void 0:a.selectedRoomInfo.rooms[0].name)||(p==null?void 0:p.packageName),rooms:(a==null?void 0:a.reservation.rooms)||c.adults.length,numberOfNights:Ae({from:new Date((a==null?void 0:a.reservation.checkin)||c.checkInDate||""),to:new Date((a==null?void 0:a.reservation.checkout)||c.checkOutDate||""),units:["day"]}).day,title:K==="male"?"MR":K==="female"?"MS":"MRS",firstName:(a==null?void 0:a.travelers[0].firstName)||(l==null?void 0:l.first_name),lastName:(a==null?void 0:a.travelers[0].lastName)||(l==null?void 0:l.last_name),email:(a==null?void 0:a.contact.email)||(l==null?void 0:l.email),phone:((E=(M=a==null?void 0:a.contact.phones)==null?void 0:M[0])==null?void 0:E.phone)||(l==null?void 0:l.cell_number),country:mi(((X=(B=a==null?void 0:a.contact.phones)==null?void 0:B[0])==null?void 0:X.areaCode)||(l==null?void 0:l.cell_country_code),a?"dial":"country")}},[a,f,p,c,l]);return e.jsxs("div",{className:"space-y-4",children:[j?e.jsx("div",{className:"bg-body-level-1 h-96 w-full animate-pulse rounded-lg"}):!v&&!a?null:e.jsxs(e.Fragment,{children:[e.jsx(Et,{children:e.jsxs(Ue.div,{className:"bg-body-level-1 mb-8 scroll-mt-20 space-y-4 rounded-lg p-4",initial:{opacity:0}
5,whileInView:{opacity:1},viewport:{once:!0},transition:{duration:.6},ref:S=>{S&&ia(S.id)},id:"selected-hotel-package",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Dt,{className:"text-success [&>path]:stroke-body-level-1 h-4 w-4 shrink-0"}),e.jsx(h,{color:"text-secondary",className:"lg:text-body-L",children:r("hotels_common:cross_selling.selected_stay")})]}),e.jsx(D,{shape:"text",theme:"primary",type:"button",onClick:()=>{x(void 0),n()},children:r("hotels_common:cross_selling.change")})]}),e.jsxs(z,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx(ue,{className:"rounded-M h-11 w-11 object-cover",src:b.thumbnailUrl,alt:b.name}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{variant:"label-M",children:b.name}),e.jsx(h,{variant:"body-XS",color:"text-secondary",children:r("hotels_common:cross_selling.guests",{count:y})})]})]}),e.jsx(qe,{bordered:!1,numberOfNights:b.numberOfNights,checkInTime:(f==null?void 0:f.checkinBeginTime)||"",checkOutTime:(f==null?void 0:f.checkoutTime)||"",checkInDate:b.checkInDate,checkOutDate:b.checkOutDate}),e.jsxs("div",{className:"flex items-center",children:[e.jsx(Pe,{className:"h-4 w-4 shrink-0"}),e.jsx(D,{shape:"text",theme:"action",as:de,target:"_blank",href:b.googleMapsUrl,children:e.jsx(h,{variant:"link-S",children:b.location})})]}),e.jsx(H,{}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:r("hotels_common:rooms")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(h,{children:[b.rooms," x"]}),e.jsx(h,{variant:"body-XS",children:b.packageName})]})]})]})}),e.jsx(hn,{initialValues:{title:(b==null?void 0:b.title)||"",firstName:(b==null?void 0:b.firstName)||"",lastName:(b==null?void 0:b.lastName)||"",email:(b==null?void 0:b.email)||"",phone:(b==null?void 0:b.phone)||"",country:(b==null?void 0:b.country)||""},onFinish:S=>N({hotelReservationId:(v==null?void 0:v.hotelReservationId)||"",travelers:[{firstName:S.firstName,lastName:S.lastName,title:S.title}],areaCode:S.country.dial_code,phone:S.phone,email:S.email}),id:"hotel-form"})]}),!p&&!a&&e.jsx(ui,{pollingEnabled:i,onPollingChange:d,search:c,onOptionSelect:x,onHotelSelect:_,onSearch:m})]})},xd=hi,gi=(t,s)=>{const n=t.replace(s||"","");return n.startsWith("/")?n:`/${n}`},vi={condition:"condition",service:"service",location:"location",neighborhood:"neighborhood",value:"value",comfort:"comfort",cleanliness:"cleanliness",amenities:"amenities",rooms:"rooms",valueForMoney:"value_for_money",propertyCondition:"property_condition"},st=t=>{var s;return(s=t==null?void 0:t.metric)==null?void 0:s.rating},gs=t=>{var s;return(s=t==null?void 0:t.detail)==null?void 0:s.submittedDate},xi={lowest:(t,s)=>{const n=st(t),a=st(s);return Number(n)-Number(a)},highest:(t,s)=>{const n=st(t),a=st(s);return Number(a)-Number(n)},recent:(t,s)=>{const n=gs(t),a=gs(s),o=n?new Date(n).getTime():0,l=a?new Date(a).getTime():0;return isNaN(o)||isNaN(l)?0:l-o}},fi=({title:t,className:s,titleClassName:n})=>e.jsxs(e.Fragment,{children:[t&&e.jsx(h,{variant:"heading-L",className:n,children:t}),e.jsx(z,{className:A("rounded-L bg-body relative z-10 mx-auto max-w-lg space-y-6 pt-6 lg:max-w-none lg:py-8",s),children:e.jsx(Ge,{})})]}),pi=fi,Xe=60*15,yi=60*12,_i=({children:t,hotelId:s,selectedPackage:n,sI
5d:a,pId:o,summaryState:l,isLoading:r,isFetching:i,isRefetching:d,isSearchError:u,isSelectPackageError:c,isSelectPackageSuccess:m})=>{const{t:p}=L("hotels_common"),{user:x}=ht({autoFetch:!0}),{setSearch:f,push:_,locale:v,baseUrl:j}=R(),{state:y,setState:N}=G(),{data:b,isLoading:S}=mt({hotelId:s,lang:v}),[w,k]=g.useState(),{bookingSource:I}=At(),{mutateAsync:O,error:M}=Ia(),{paymentMethod:E,onApplePayPayment:B,error:X}=$s({applePay:{onPaymentAuthorized:Qe,onPaymentSuccess:ve,onPaymentFailed:()=>{k($=>P(C({},$),{loading:!1}))}}}),[K,Be]=g.useState(at("searchTimer")||""),[$e,Ke]=g.useState(at("bookTimer")||""),J=g.useMemo(()=>y.checkInDate&&Ae({from:y.checkInDate,to:y.checkOutDate,units:["day"]}).day||1,[y.checkInDate,y.checkOutDate]),ae=$=>{var Y;const q=P(C(C(C({},y),l),$),{checkInDate:y.checkInDate?Z(y.checkInDate,v,{day:"2-digit",month:"2-digit",year:"numeric",timeZone:void 0}).date:"",checkOutDate:y.checkOutDate?Z(y.checkOutDate,v,{day:"2-digit",month:"2-digit",year:"numeric",timeZone:void 0}).date:""}),te={};for(const Fn in q){const Le=Fn;Le==="country"?te[Le]=((Y=q[Le])==null?void 0:Y.code)||"":q[Le]&&(te[Le]=q[Le])}f(C({},te))},me=g.useMemo(()=>({net_after_discount:(n==null?void 0:n.fare.totalPrice)||0,net:(n==null?void 0:n.fare.totalPrice)||0,gross:(n==null?void 0:n.fare.fareDetails.baseFare)||0,gross_after_discount:(n==null?void 0:n.fare.fareDetails.baseFare)||0}),[n]);g.useEffect(()=>{const $=at("searchTimer"),Y=new Date().getTime(),q=Y.toString();a&&a!==y.sId?(Ze("searchTimer",q),Be(q),N({data:P(C({},y),{sId:a}),path:window.location.pathname})):a===y.sId&&(!$||Number($)+Xe*1e3<=Y)&&(Ze("searchTimer",q),Be(q))},[y,a]),g.useEffect(()=>{if(m&&!i){const $=new Date().getTime().toString();Ze("bookTimer",$),Ke($)}},[m,i]);const he=()=>je(null,null,function*(){return ge()}),ge=()=>je(null,null,function*(){const $=(me==null?void 0:me.net_after_discount)>0;if((E==null?void 0:E.type)==="apple_pay"&&$)return Ye();An()}),Ye=()=>je(null,null,function*(){var $;try{yield B({totals:me})}catch(Y){const q=Y;if(k(te=>P(C({},te),{loading:!1})),($=q==null?void 0:q.message)!=null&&$.includes("JSON"))return k(te=>P(C({},te),{error:new Error(p("hotels_common:missing_url_message"))}));k(te=>P(C({},te),{error:q}))}});function Qe(){return je(this,null,function*(){const $=zt();k({error:null,loading:!0});try{return yield O($)}catch(Y){throw k(q=>P(C({},q),{error:Y})),Y}})}function ve({order_id:$}){_(`/${v}/payment-success/hotels/${ua($)}`)}const An=()=>je(null,null,function*(){var $;try{const Y=zt();k({error:null,loading:!0});const q=yield O(Y);if(!q.redirect_url)throw new Oa({error:new Error(p("hotels_common:missing_url_message")),name:"CheckoutNoRedirectUrlException"});const te=window.location.search||"";ha({name:"last_book_page",value:gi(window.location.pathname+te,j),expiration:.01}),window.location.href=q.redirect_url}catch(Y){const q=Y;if(k(te=>P(C({},te),{loading:!1})),($=q==null?void 0:q.message)!=null&&$.includes("JSON"))return k(te=>P(C({},te),{error:new Error(p("hotels_common:missing_url_message"))}));k(te=>P(C({},te),{error:q}))}}),zt=()=>{var $;return{redirect:window.origin+`/${v}/payment-success/hotels`,redirect_failed:`${window.origin}/${v}/payment-failed/hotels`,booking_source:I,lang:v,entity_payment_method_id:E==null?void 0:E.entity_payment_method_id,payment_method:(E==null?void 0:E.type)||"",hotelReservationId:(n==null?void 0:n.hotelReservationId)||"",travelers:[{firstName:l.firstName,lastName:l.lastName,title:l.title}],email:l.email,areaCode:(($=l==null?void 0:l.country)==null?void 0:$.dial_code)||"",phone:l.phone,is_wallet:!1}},Tn=$=>{k(Y=>P(C({},Y),{loading:$}))};return e.jsx(en.Provider,{value:P(C({},l),{sId:a,pId:o,country:l.country||pe[0],packageId:l.packageId,numberOfNights:J,user:x,hotelDetails:b,selectedPackage:n,hotelId:s,isLoading:S||r,isFetching:i,isRefetching:d,isSearchError:u,isSelectPackageError:c,searchTimer:K,bookTimer:$e,checkoutError:(w==null?void 0:w.error)||M||X,checkoutLoading:(w==null?void 0:w.loading)||!1,checkout:he,setSummary:ae,setCheckoutLoading:Tn}),children:t})},ji=_i,bi=()=>{const{t}=L("hotels_common"),{setSummary:s,title:n,firstName:a,lastName:o,email:l,phone:r,country:i}=ee();return e.jsxs("div",{className:"w-full space-y-0 pb-6 lg:space-y-6",children:[e.jsx(h,{as:"h1",variant:"heading-XL",className:"hidden lg:block",children:t("hotels_common:guest_details.title")}),e.jsx("div",{className:"pb-6",children:e.jsx(hn,{initialValues:{title:n,firstName:a,lastName:o,email:l,phone:r,country:i},onFinish:d=>{s(P(C({},d),{mode:"payment"}))}})})]})},Ni=bi,wi=()=>{const[t,s]=g.useState(!1),{selectedPackage:n,numberOfNights:a}=ee(),{t:o}=L(["hotels_common"]),l=e.jsxs("div",{className:"line-clamp-2 text-start md:px-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-1",children:[e.jsx(h,{variant:"body-XS",color:"text-secondary",children:o("hotels_common:total_to_pay")}),e.jsx(se,{className:"block h-3 w-3 shrink-0 rotate-90 lg:hidden"})]}
5),e.jsx(U,{originalPrice:(n==null?void 0:n.fare.totalPrice)||0,currency:n==null?void 0:n.fare.currency})]});return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden lg:block",children:l}),e.jsx(qn,{className:"bg-body/10 relative z-[99] mb-[9px] flex h-screen w-screen items-end p-0 backdrop-blur-sm [&>div]:p-0",align:"start",open:t,onOpenChange:r=>s(r),onClick:()=>s(!1),content:e.jsxs(Ue.div,{className:"bg-body relative z-50 mx-auto w-full overflow-hidden",initial:{height:0},animate:{height:t?"auto":0},onClick:r=>r.stopPropagation(),children:[e.jsx("div",{className:"flex justify-end p-1",children:e.jsx("button",{className:"text-text-secondary m-1 flex items-center justify-center rounded-full p-2 font-bold",onClick:()=>s(!1),"aria-label":"Close Hotel Ticket Summary",children:e.jsx(we,{className:"h-3 w-3"})})}),e.jsxs("div",{className:"h-full max-h-[calc(100vh-260px)] space-y-6 overflow-y-auto px-4 pt-2",children:[e.jsx(h,{variant:"heading-M",children:o("hotels_common:summary")}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(h,{variant:"heading-XS",children:n==null?void 0:n.selectedRoomInfo.rooms[0].name}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(h,{variant:"body-S",className:"flex items-center gap-1",children:[o("hotels_common:rooms",{count:n==null?void 0:n.selectedRoomInfo.rooms.length}),e.jsx(we,{className:"h-3 w-3 shrink-0"}),o("hotels_common:nights",{count:a})]}),e.jsx(U,{originalPrice:(n==null?void 0:n.fare.totalPrice)||0,currency:n==null?void 0:n.fare.currency})]})]}),e.jsx(H,{className:"border-dashed"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(h,{variant:"body-L",children:[e.jsx(h,{as:"span",children:o("hotels_common:total")})," ",e.jsxs(h,{as:"span",color:"text-secondary",children:["(",o("hotels_common:vat_included"),")"]})]}),e.jsx(U,{originalPrice:(n==null?void 0:n.fare.totalPrice)||0,currency:n==null?void 0:n.fare.currency,changeable:!0,className:"text-body-S"})]})]})]})]}),children:e.jsx("div",{className:"w-full max-w-[33%] text-start md:max-w-[40%] lg:hidden",children:e.jsx(D,{type:"button",theme:"action",shape:"text",className:"focus:ring-input-border h-12 shrink-0 p-1",children:e.jsx("div",{className:"flex w-full justify-between gap-2",children:l})})})})]})},ki=wi,Si=()=>{const{t}=L(["hotels_common"]),{mode:s}=ee(),{trackEvent:n}=W(),a=()=>{n({event:"stays_guest_details_continue_clicked"}),Ds()};return e.jsx(Lt,{"data-visible":s!=="payment"&&s!=="room_selection",className:"bg-body bottom-0 translate-y-60 transition-transform data-[visible=true]:translate-y-0 lg:bottom-5",children:e.jsx("div",{className:"lg:container",children:e.jsxs("div",{className:"lg:rounded-M bg-body border-paper lg:bg-body-level-2 flex items-center gap-4 border-t p-5 transition-colors lg:border-none lg:p-6",children:[e.jsx(ki,{}),e.jsx("div",{className:"w-full grow lg:max-w-xs ltr:ml-auto rtl:mr-auto",children:e.jsx(D,{type:s==="guest_details"?"submit":"button",form:s==="guest_details"?"guest-details":void 0,className:"mx-auto h-12 w-full max-w-sm gap-2 whitespace-nowrap py-3 text-center font-semibold lg:mx-0",theme:"action",onClick:a,children:t("hotels_common:next_payment")})})]})})})},Ci=Si,Ii=({text:t,onBack:s})=>{const{t:n}=L("hotels_common"),{locale:a,replace:o}=R(),{isWebView:l,isSSR:r}=Re();if(r||l)return null;const i=()=>{const d=new URLSearchParams(window.location.search);o(`/${a}/hotels/search?${d.toString()}`)};return e.jsxs(D,{theme:"transparent",shape:"text",onClick:s||i,className:"px-px",children:[e.jsx(se,{className:"inline ltr:mr-2 ltr:rotate-180 rtl:ml-2 rtl:rotate-0"}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:t||n("hotels_common:hotels")})]})},In=Ii,Li=({onClose:t,initialSeconds:s=Xe,city:n,text:a,onCountdownEnd:o})=>{const{locale:l}=R(),{t:r}=L("hotels_common"),i=g.useId(),d=g.useRef(null),u=g.useRef(Oe({date:new Date,interval:"second",value:s}).getTime()/1e3),c=ca({id:i,initialSeconds:s});return g.useEffect(()=>{const m=()=>{const p=u.current-Date.now()/1e3;c.set(p)};return window.addEventListener("visibilitychange",m),()=>window.removeEventListener("visibilitychange",m)},[c,c.count]),g.useEffect(()=>{var m;c.count<=0&&((m=d.current)==null||m.open(),o==null||o())}
5,[c.count]),e.jsxs(e.Fragment,{children:[a==null?void 0:a(c),e.jsx(ne,{ignoreHistory:!0,closeButton:!1,onClose:()=>{c.reset()},ref:d,size:"lg",body:()=>e.jsxs("div",{className:"space-y-6 text-center",children:[e.jsx(Ys,{className:"mx-auto"}),e.jsx(h,{variant:"heading-M",children:r("hotels_common:get_latest_rates",{city:n})})]}),cancel:void 0,action:void 0,customAction:({close:m})=>e.jsxs("div",{className:"flex w-full flex-col gap-4",children:[e.jsx(D,{shape:"outlined",theme:"action",onClick:()=>{t(),m()},children:r("hotels_common:refresh_results")}),e.jsx(D,{shape:"text",theme:"action",as:de,to:`/${l}/hotels`,children:e.jsx(h,{variant:"link-L",children:r("hotels_common:start_a_new_search")})})]})})]})},Ln=Li,Di=()=>{const{trackEvent:t}=W(),{t:s}=L("hotels_common"),{locale:n,search:a,replace:o}=R(),{state:l}=G(),r=new URLSearchParams(a),{mode:i,searchTimer:d,bookTimer:u,isSearchError:c,isSelectPackageError:m}=ee(),p=g.useMemo(()=>{const f=i==="room_selection"?d:u;if(!f||c||m)return 0;const _=Oe({date:new Date(Number(f)),interval:"second",value:i==="room_selection"?Xe:yi});return Math.floor((_.getTime()-Date.now())/1e3)},[i,u,d,c,m]),x=()=>{r.set("mode","room_selection"),o(`${window.location.pathname}?${r.toString()}`),window.location.reload()};return e.jsx(Ln,{city:l.city,initialSeconds:p,onClose:x,text:i!=="room_selection"?({count:f})=>{const _=Date.now()/1e3,j=_+f-_,y=V(j,n,{minute:"2-digit",second:"2-digit"});return e.jsx(Et,{children:e.jsx(Ue.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.3,ease:"easeOut"},opacity:{duration:.2}},className:"bg-body-level-1 mb-4 overflow-hidden",children:e.jsx("div",{className:"flex items-center justify-center p-1 text-center",children:e.jsx(h,{variant:"label-S",className:"text-body-contrast shrink-0",children:f<=0?s("hotels_common:time_out"):e.jsx(ut,{i18nKey:"hotels_common:time_left",values:{time:y},children:e.jsx("span",{className:f>30?"text-success":"text-notice"})})})})})})}:void 0,onCountdownEnd:()=>{t({event:"stays_error_occurred",data:{screen:i.toUpperCase().replace("_"," "),error_type:c?"ModifySearchError":m?"SelectPackageError":"SearchTimeout",error_message:"Search timed out",session_id:l.sId,storedTimer:i==="room_selection"?d:u}})}},p)},Mi=Di,Pi=()=>{const{trackEvent:t}=W(),{t:s}=L("hotels_common"),{currency:n,currencies:a,setCurrency:o}=La(),{search:l,push:r}=R(),{mode:i,setSummary:d}=ee(),u=new URLSearchParams(l),{checkoutSteps:c,activeStep:m}=g.useMemo(()=>{const x=[{id:"room_selection",label:"rooms"},{id:"guest_details",label:"guest_details"},{id:"payment",label:"checkout"}];return{checkoutSteps:x,activeStep:x.findIndex(f=>f.id===i)}},[i]),p=()=>{i==="room_selection"?r(`${window.location.pathname.replace("/book","")}?${u.toString()}`):d(i==="guest_details"?{mode:"room_selection"}:{mode:"guest_details"})};return e.jsx(Xn,{isMini:!1,steps:c,activeStep:m,backButtonComponent:e.jsx(In,{text:s("hotels_common:back"),onBack:p}),countdownComponent:e.jsx(Mi,{}),currency:n,currencies:a,setCurrency:o,trackEvent:t})},Ei=Pi,Oi=({showRating:t=!1,showRoomDetails:s=!1})=>{const{hotelDetails:n,selectedPackage:a}=ee(),{t:o}=L("hotels_common");return e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx(ue,{className:"rounded-M h-24 w-24 object-cover",src:n==null?void 0:n.thumbnailUrl,alt:n==null?void 0:n.name}),e.jsxs("div",{children:[e.jsx("div",{className:"text-text-secondary flex items-center gap-1",children:s?e.jsx(h,{variant:"body-S",children:n==null?void 0:n.name}):e.jsxs(e.Fragment,{children:[e.jsx(h,{variant:"body-S",children:o("hotels_common:hotel")}),t&&!!(n!=null&&n.starRating)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"rtl:h-4",children:"•"}),e.jsx(Se,{className:"text-text-secondary h-2.5 w-2.5 shrink-0"}),e.jsx("span",{children:n==null?void 0:n.starRating})]})]})}),s?e.jsxs(e.Fragment,{children:[e.jsx(h,{variant:"label-L",children:a==null?void 0:a.selectedRoomInfo.rooms[0].name}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:o("hotels_common:rooms",{count:a==null?void 0:a.selectedRoomInfo.rooms.length})})]}):e.jsx(h,{variant:"label-L",children:n==null?void 0:n.name}),!s&&e.jsx(h,{variant:"body-S",color:"text-secondary",children:(n==null?void 0:n.location.address)||`${n==null?void 0:n.location.city}, ${n==null?void 0:n.location.country}`})]})]})},$t=Oi,vs=({policies:t})=>e.jsx(z,{children:e.jsx("ul",{className:"space-y-4",children:t.map((s,n)=>e.jsxs("li",{className:"flex items-start gap-2",children:[s.icon,s.title]},n))})}),Ri=({collapsibleBtn:t})=>{const{t:s}=L("hotels_common"),{selectedPackage:n}=ee(),{locale:a}=R(),{state:o}=G(),l=g.useMemo(()=>{var r,i;const d=n==null?void 0:n.cancellationPolicies,u=((r=d==null?void 0:d.cancellationPolicyDetails)==null?void 0:r.dateFrom)||"",c=(i=d==null?void 0:d.cancellationPolicyDetails)==null?void 0:i.cancellationFee,m=d==null?void 0:d.bookingRemarks,p=u?Ot(Rt(u).getTime(),Date.now()):!1,x=j=>V(j,a,{day:"numeric",month:"short"}),f=j=>V(j,a,{day:"numeric",month:"short"}),_=({dateRange:j,status:y,description:N,color:b})=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{variant:"label-S",color:"text-primary",children:j}),e.jsx(h,{variant:"body-S",color:b,children:y}),N&&e.jsx(h,{variant:"body-XS",color:"text-secondary",children:N})]}),v=[...p?[]:[{title:e.jsx(_,{dateRange:s("hotels_common:free_cancellation_until",{date:f(u)}),status:s("hotels_common:full_refund_available"),color:"success"}),icon:e.jsx(Me,{className:"text-success mt-0.5 h-4 w-4 shrink-0"})}],{title:e.jsx(_,{dateRange:p?`${s("hotels_common:booking_date")} ${x(o.checkInDate||new Date)}`:`${f(u)} - ${x(o.checkInDate||new Date)}`,status:s("hotels_common:non_refundable_period"),description:e.jsx(ut,{i18nKey:"hotels_common:cancellation_fee_applies",ns:"hotels_common",children:e.jsx(U,{originalPrice
5:(c==null?void 0:c.finalPrice)||0,currency:c==null?void 0:c.currency,className:"inline-flex",currencyClassName:"text-body-XS",priceClassName:"text-body-XS"})}),color:"error"}),icon:e.jsx(dt,{className:"text-error mt-0.5 h-4 w-4 shrink-0"})},{title:e.jsx(_,{dateRange:s("hotels_common:check_in_onwards",{date:x(o.checkInDate||new Date)}),status:s("hotels_common:your_stay_begins"),color:"text-secondary"}),icon:e.jsx(jt,{className:"text-text-secondary mt-0.5 h-4 w-4 shrink-0"})}];return m&&v.push({title:e.jsx(h,{variant:"body-S",color:"text-secondary",children:m}),icon:e.jsx(jt,{className:"text-secondary mt-0.5 h-4 w-4 shrink-0"})}),v},[n,s,a,o.checkInDate]);return t?e.jsx(ye,{trigger:e.jsxs(D,{shape:"text",theme:"transparent",className:"flex w-full items-center justify-between gap-2 px-0 text-start",children:[e.jsx(h,{variant:"heading-S",children:s("hotels_common:cancellation_policy")}),e.jsx(se,{className:"h-4 w-4 shrink-0 rtl:rotate-180"})]}),children:e.jsx(vs,{policies:l})}):e.jsx(vs,{policies:l})},Dn=Ri,Ai=()=>{const{t}=L("hotels_common");return e.jsx(ne,{title:t("hotels_common:cancellation_policy"),render:({open:s})=>e.jsx(D,{shape:"text",onClick:s,className:"shrink-0",children:t("hotels_common:view_cancellation_policy")}),cancel:!1,action:!1,body:()=>e.jsx(Dn,{})})},Ti=Ai,Fi=({cancellationPolicy:t=!0})=>{var s,n,a;const{t:o}=L("hotels_common"),{selectedPackage:l,mode:r,numberOfNights:i}=ee(),{locale:d}=R(),u=l==null?void 0:l.cancellationPolicies,c=(s=u==null?void 0:u.cancellationPolicyDetails)==null?void 0:s.cancellationFee,m=(n=u==null?void 0:u.cancellationPolicyDetails)==null?void 0:n.dateFrom,p=m?Ot(Rt(m).getTime(),Date.now()):!1;return e.jsxs(z,{className:"space-y-0 lg:space-y-6",children:[r==="payment"?e.jsx(h,{variant:"heading-M",className:"hidden lg:block",children:o("hotels_common:summary")}):e.jsx(h,{variant:"heading-XS",className:"hidden lg:block",children:o("hotels_common:price_summary")}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-0 lg:space-y-4",children:[r==="payment"&&e.jsx(h,{variant:"heading-XS",className:"hidden lg:block",children:l==null?void 0:l.selectedRoomInfo.rooms[0].name}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(h,{variant:"body-S",className:"flex items-center gap-1",children:[o("hotels_common:rooms",{count:l==null?void 0:l.selectedRoomInfo.rooms.length}),e.jsx(we,{className:"h-3 w-3 shrink-0"}),o("hotels_common:nights",{count:i})]}),e.jsx(U,{originalPrice:(l==null?void 0:l.fare.totalPrice)||0,currency:l==null?void 0:l.fare.currency})]})]}),e.jsx(H,{className:"border-dashed"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(h,{variant:"body-L",children:[e.jsx(h,{as:"span",children:o("hotels_common:total")})," ",e.jsxs(h,{as:"span",color:"text-secondary",children:["(",o("hotels_common:vat_included"),")"]})]}),e.jsx(U,{originalPrice:(l==null?void 0:l.fare.totalPrice)||0,currency:l==null?void 0:l.fare.currency,changeable:!0,className:"text-body-S"})]}),t&&e.jsxs(e.Fragment,{children:[e.jsx(H,{}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex max-w-56 items-start gap-2",children:[p?e.jsx(dt,{className:"text-error mt-0.5 h-4 w-4 shrink-0"}):e.jsx(jt,{className:"text-text-secondary mt-0.5 h-4 w-4 shrink-0"}),e.jsx(h,{as:"div",color:p?"error":"text-secondary",variant:"body-S",children:u!=null&&u.hasFreeCancellation?o("hotels_common:free_cancellation"):p?o("hotels_common:non_refundable"):e.jsx(ut,{i18nKey:"hotels_common:cancellation_with_fees",ns:"hotels_common",values:{date:V(((a=u==null?void 0:u.cancellationPolicyDetails)==null?void 0:a.dateFrom)||"",d,{day:"numeric",month:"long",year:"numeric"})},children:e.jsx(U,{originalPrice:(c==null?void 0:c.finalPrice)||0,currency:c==null?void 0:c.currency,className:"inline-flex",currencyClassName:"text-body-S",priceClassName:"text-body-S"})})})]}),e.jsx(Ti,{})]})]})]})]})},Zt=Fi,Hi=t=>{var s=t,{collapsibleBtn:n}=s,a=Te(s,["collapsibleBtn"]);const{hotelDetails:o}=ee(),{t:l}=L("hotels_common"),r=g.useMemo(()=>{var i,d;const u=[];for(const c of(o==null?void 0:o.policies)||[])((d=(i=c.category)==null?void 0:i.title)==null?void 0:d.toLowerCase())!=="optional fees"&&c.policyDetails&&u.push(c.policyDetails);return u},[o]);return r!=null&&r.length?n?e.jsx(ye,{trigger:e.jsxs(D,{shape:"text",theme:"transparent",className:"flex w-full items-center justify-between gap-2 px-0 text-start",children:[e.jsx(h,{variant:"heading-S",children:l("hotels_common:hotel_policy")}),e.jsx(se,{className:"h-4 w-4 shrink-0 rtl:rotate-180"})]}),children:e.jsx(Ne,P(C({},a),{children:e.jsx("div",{dangerouslySetInnerHTML:{__html:r.join("")}})}))}):e.jsx(Ne,P(C({},a),{children:e.jsx("div",{dangerouslySetInnerHTML:{__html:r.join("")}})})):null},Bi=Hi,$i=t=>{var s=t,{collapsibleBtn:n}=s,a=Te(s,["collapsibleBtn"]);const{hotelDetails:o}=ee(),{t:l}=L("hotels_common"),r=g.useMemo(()=>{var i;return(i=o==null?void 0:o.policies)==null?void 0:i.find(d=>{var u,c;return((c=(u=d.category)==null?void 0:u.title)==null?void 0:c.toLowerCase())==="optional fees"})},[o]);return r!=null&&r.policyDetails?n?e.jsx(ye,{trigger:e.jsxs(D,{shape:"text",theme:"transparent",className:"flex w-full items-center justify-between gap-2 px-0 text-start",children:[e.jsx(h,{variant:"heading-S",children:l("hotels_common:fees_and_extras")}),e.jsx(se,{className:"h-4 w-4 shrink-0 rtl:rotate-180"})]}),children:e.jsx(Ne,P(C({},a),{children:e.jsx("div",{dangerouslySetInnerHTML:{__html:r.policyDetails}})}))}):e.jsx(Ne,P(C({},a),{children:e.jsx("div",{dangerouslySetInnerHTML:{__html:r.policyDetails}})})):null},Zi=$i,zi=()=>{const{state:t}=G(),{selectedPackage:s,numberOfNights:n,hotelDetails:a}=ee(),{t:o}=L("hotels_common"),l=s!=null&&s.hotel.address&&(s!=null&&s.hotel.city)?`${s==null?void 0:s.hotel.address}, ${s==null?void 0:s.hotel.city}`:(s==null?void 0:s.hotel.address)||(s==null?void 0:s.hotel.city),r=`https://maps.google.com/?q=${s==null?void 0:s.hotel.mapCoordinates.latitude},${s==null?void 0:s.hotel.mapCoordinates.longitude}`;return e.jsx(ne,{title:o("hotels_common:booking_summary"),action:!1,cancel:!1,render:({open:i})=>e.jsx(D,{shape:"outlined",theme:"action",onClick:i,children:o("hotels_common:view_booking_summary")}
5),body:()=>{var i,d,u;return e.jsxs(e.Fragment,{children:[e.jsx($t,{showRating:!0}),e.jsxs("div",{children:[e.jsx(h,{variant:"label-L",children:s==null?void 0:s.selectedRoomInfo.rooms[0].name}),e.jsx(h,{color:"text-secondary",children:o(`hotels_common:${s==null?void 0:s.selectedRoomInfo.roomOption.roomBasis}`)})]}),a&&e.jsx(qe,C({numberOfNights:n,checkInTime:a.checkinBeginTime,checkOutTime:a.checkoutTime,checkInDate:t.checkInDate,checkOutDate:t.checkOutDate},((i=s==null?void 0:s.cancellationPolicies)==null?void 0:i.hasFreeCancellation)&&{freeCancellationDate:(u=(d=s.cancellationPolicies)==null?void 0:d.cancellationPolicyDetails)==null?void 0:u.dateFrom})),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Pt,{className:"h-6 w-6 shrink-0"}),e.jsxs("div",{children:[e.jsx(h,{variant:"label-M",children:o("hotels_common:guests")}),e.jsxs(h,{variant:"body-S",color:"text-secondary",className:"flex items-center gap-1",children:[e.jsxs("span",{children:[o("hotels_common:adults",{count:s==null?void 0:s.selectedRoomInfo.rooms[0].adultPerRoom}),","]}),!!(s!=null&&s.selectedRoomInfo.rooms[0].childPerRoom)&&e.jsx(e.Fragment,{children:e.jsxs("span",{children:[o("hotels_common:child",{count:s==null?void 0:s.selectedRoomInfo.rooms[0].childPerRoom}),","]})}),e.jsx("span",{children:o("hotels_common:rooms",{count:s==null?void 0:s.selectedRoomInfo.rooms.length})})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(oa,{className:"h-6 w-6 shrink-0"}),e.jsxs("div",{children:[e.jsx(h,{variant:"label-M",children:o("hotels_common:duration_of_stay")}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:o("hotels_common:nights",{count:n})})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Pe,{className:"h-6 w-6 shrink-0"}),e.jsxs("div",{children:[e.jsx(h,{variant:"label-M",children:o("hotels_common:location")}),e.jsx(D,{theme:"transparent",shape:"text",className:"p-px text-start",as:de,target:"_blank",href:r,children:e.jsx(h,{variant:"link-M",color:"text-secondary",children:l})})]})]}),e.jsx(H,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(h,{variant:"heading-S",children:o("hotels_common:pricing_summary")}),e.jsxs(h,{variant:"body-S",color:"text-secondary",className:"flex items-center gap-1",children:[e.jsx("span",{children:o("hotels_common:adults",{count:s==null?void 0:s.selectedRoomInfo.rooms[0].adultPerRoom})}),e.jsx("span",{className:"rtl:h-4",children:"•"}),!!(s!=null&&s.selectedRoomInfo.rooms[0].childPerRoom)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:o("hotels_common:child",{count:s==null?void 0:s.selectedRoomInfo.rooms[0].childPerRoom})}),e.jsx("span",{className:"rtl:h-4",children:"•"})]}),e.jsx("span",{children:o("hotels_common:rooms",{count:s==null?void 0:s.selectedRoomInfo.rooms.length})})]})]}),e.jsx(Zt,{cancellationPolicy:!1})]}),e.jsx(H,{}),e.jsx(Dn,{collapsibleBtn:!0}),e.jsx(H,{}),e.jsx(Zi,{minimum:12,collapsibleBtn:!0}),e.jsx(H,{}),e.jsx(Bi,{minimum:12,collapsibleBtn:!0})]})},bodyClassName:"space-y-6"})},Mn=zi,Ui=()=>{const{t}=L("hotels_common"),{hotelDetails:s}=ee(),n=g.useMemo(()=>{var a;return(a=s==null?void 0:s.faq)==null?void 0:a.filter(o=>o.question&&o.answer)},[s]);return n!=null&&n.length?e.jsx(ne,{title:t("hotels_common:frequently_asked_questions"),action:!1,cancel:!1,render:({open:a})=>e.jsx(z,{children:e.jsxs(D,{shape:"text",theme:"transparent",className:"flex w-full items-center justify-between gap-2 px-0 text-start",onClick:a,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Mt,{className:"h-6 w-6 shrink-0"}),e.jsx(h,{variant:"heading-S",children:t("hotels_common:frequently_asked_questions")})]}),e.jsx(se,{className:"h-4 w-4 shrink-0 rtl:rotate-180"})]})}),body:()=>n.map((a,o)=>e.jsxs(g.Fragment,{children:[e.jsx(ye,{contentClassName:"pb-4",trigger:e.jsxs(D,{shape:"text",theme:"transparent",className:"flex w-full items-center justify-between gap-2 px-0 py-4 text-start",children:[e.jsx(h,{variant:"body-L",children:a.question}),e.jsx(se,{className:"h-5 w-5 shrink-0 rotate-90"})]}),children:e.jsx(h,{variant:"body-S",color:"text-secondary",className:"prose",as:"div",dangerouslySetInnerHTML:{__html:a.answer}})}),o!==n.length-1&&e.jsx(H,{})]},o))}):null},Vi=Ui,Gi=({initialSearch:t})=>{var s,n,a;const{state:o}=G(),{t:l}=L("hotels_common"),{mode:r,selectedPackage:i,hotelDetails:d,numberOfNights:u}=ee();return e.jsxs("div",{className:"top-20 z-10 space-y-6 pb-4 md:sticky",children:[e.jsxs(z,{className:"space-y-6",children:[e.jsx($t,{}),r!=="room_selection"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx(h,{variant:"label-L",children:i==null?void 0:i.selectedRoomInfo.rooms[0].name}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(h,{variant:"body-S",color:"text-secondary",className:"flex items-center gap-2",children:[e.jsx(yt,{className:"h-4 w-4 shrink-0"}),l("hotels_common:adults",{count:i==null?void 0:i.selectedRoomInfo.rooms[0].adultPerRoom})]}),!!(i!=null&&i.selectedRoomInfo.rooms[0].childPerRoom)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-text-secondary rtl:h-4",children:"•"}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:l("hotels_common:child",{count:i==null?void 0:i.selectedRoomInfo.rooms[0].childPerRoom})})]})]})]}),d&&e.jsx(qe,C({numberOfNights:u,checkInTime:d.checkinBeginTime,checkOutTime:d.checkoutTime,checkInDate:o.checkInDate,checkOutDate:o.checkOutDate},((s=i==null?void 0:i.cancellationPolicies)==null?void 0:s.hasFreeCancellation)&&{freeCancellationDate:(a=(n=i.cancellationPolicies)==null?void 0:n.cancellationPolicyDetails)==null?void 0:a.dateFrom}))]}),r==="room_selection"&&e.jsx(Bt,{showSearch:!0,className:"pb-0 md:block",initialSearch:t}),r!=="room_selection"&&e.jsx(Mn,{})]}),r!=="room_selection"&&e.jsx(Zt,{}),r==="payment"&&e.jsx(Vi,{}),e.jsx(ke,{className:"hidden md:flex"})]})},Xi=Gi,qi=({title:t,description:s,showModal:n,closeButton:a=!1,onClose:o,onRefresh:l,icon:r,className:i,actionButton:d})=>{const{t:u}=L(["hotels_common"]);return e.jsx(Wn,{closeButton:a,onClose:o,show:n,body:()=>e.jsxs("div",{className:A("space-y-4 px-4 py-6",i),children:[r||e.jsx("img",{src:"/@wbk/hotels/error.png",alt:"error",className:"w-20",height:80,width:80}),e.jsx(h,{as:"h3",variant:"heading-S",children:t}),s&&e.jsx(h,{color:"text-secondary",variant:"body-S",children:s}),l&&e.jsx("div",{className:"flex justify-end",children:e.jsx(D,{theme:"action",onClick:l,children:u("hotels_common:refresh")})}),d]})})},Wi=qi,Ji=()=>{var t,s;const{state:n}=G(),{user:a}=ht(),{state:o}=G(),{bookingSource:l}=At(),{selectedPackage:r,hotelDetails:i,numberOfNights:d,hotelId:u,checkoutLoading:c,setCheckoutLoading:m,checkout:p,checkoutError:x}=ee(),{paymentMethod:f}=$s(),_=(x==null?void 0:x.status)===404,{locale:v,push:j}=R(),{trackEvent:y}=W(),{t:N}=L("hotels_common");ma({onShow:()=>{m(!1)}}),g.useEffect(()=>{y({event:"stays_payment_method_selected",data:{payment_method:f==null?void 0:f.type}})},[f]);const b=()=>{p(),y({event:"stays_proceed_to_payment_clicked",data:{location_code:o.location,location_name:o.city,hotel_name:i==null?void 0:i.name,hotel_code:u,rooms_count:o.adults.length,price:o.price,checkin_date:o.checkInDate,checkout_date:o.checkOutDate,room_type:r==null?void 0:r.selectedRoomInfo.roomOption.roomBasis,guests_count:o.adults.reduce((w,k)=>w+k,0)+o.children.reduce((w,k)=>w+k,0),children_ages:o.childrenAges,payment_method:(f==null?void 0:f.type)||"",star_rating:i==null?void 0:i.starRating,booking_source:l,booking_type:"hotel"}})},S=()=>{const w=new URLSearchParams(window.location.search);w.delete("payment_status"),w.delete("packageId"),w.delete("pId"),w.delete("mode"),w.delete("title"),w.delete("firstName"),w.delete("lastName"),w.delete("email"),w.delete("phone"),w.delete("country"),j(`/${v}/hotels/search?${w.toString()}`)};return e.jsxs(e.Fragment,{children:[e.jsx(Wi,{closeButton:!1,showModal:!!x||_,title:N("hotel_not_available"),icon:e.jsx(Ys,{className:"mx-auto"}),className:"space-y-6 text-center",actionButton:e.jsx(D,{shape:"outlined",theme:"action",onClick:()=>S(),className:"w-full",children:N("hotels_common:explore_other_options")})}),e.jsxs("div",{className:"w-full space-y-6",children:[e.jsxs("div",{className:"block space-y-6 md:hidden",children:[e.jsx($t,{showRating:!0,showRoomDetails:!0}),i&&e.jsx(qe,C({numberOfNights:d,checkInTime:i.checkinBeginTime,checkOutTime:i.checkoutTime,checkInDate:n.checkInDate,checkOutDate:n.checkOutDate},((t=r==null?void 0:r.cancellationPolicies)==null?void 0:t.hasFreeCancellation)&&{freeCancellationDate:(s=r.cancellationPolicies.cancellationPolicyDetails)==null?void 0:s.dateFrom})),e.jsx(Mn,{}),e.jsx(H,{type:"zigzag",className:"text-body-level-1"})]}),e.jsxs(z,{className:"hidden lg:block",children:[e.jsxs(h,{color:"text-secondary",as:"div",className:"flex items-center gap-1",children:[N("hotels_common:you_will_pay"),e.jsx(U,{originalPrice
5:(r==null?void 0:r.fare.totalPrice)||0,currency:r==null?void 0:r.fare.currency})]}),e.jsx("div",{className:"space-y-6",children:e.jsx(Gt,{totals:{net_after_discount:(r==null?void 0:r.fare.totalPrice)||0},applePayEnable:!0,tabbyEnable:!0,className:"[&_h2]:text-heading-M hidden lg:block"})})]}),e.jsxs("div",{className:"block lg:hidden",children:[e.jsxs(h,{color:"text-secondary",as:"div",className:"flex items-center gap-1",children:[N("hotels_common:you_will_pay"),e.jsx(U,{originalPrice:(r==null?void 0:r.fare.totalPrice)||0,currency:r==null?void 0:r.fare.currency})]}),e.jsx(Gt,{totals:{net_after_discount:(r==null?void 0:r.fare.totalPrice)||0},applePayEnable:!0,tabbyEnable:!0,className:"[&_h2]:!text-heading-S lg:hidden"})]}),e.jsx(H,{type:"zigzag",className:"text-body-level-1 block lg:hidden"}),e.jsxs("div",{className:"block space-y-4 lg:hidden",children:[e.jsxs("div",{children:[e.jsx(h,{variant:"heading-S",children:N("hotels_common:pricing_summary")}),e.jsxs(h,{variant:"body-S",color:"text-secondary",className:"flex items-center gap-1",children:[e.jsx("span",{children:N("hotels_common:adults",{count:r==null?void 0:r.selectedRoomInfo.rooms[0].adultPerRoom})}),e.jsx("span",{className:"rtl:h-4",children:"•"}),!!(r!=null&&r.selectedRoomInfo.rooms[0].childPerRoom)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:N("hotels_common:child",{count:r==null?void 0:r.selectedRoomInfo.rooms[0].childPerRoom})}),e.jsx("span",{className:"rtl:h-4",children:"•"})]}),e.jsx("span",{children:N("hotels_common:rooms",{count:r==null?void 0:r.selectedRoomInfo.rooms.length})})]})]}),e.jsx(Zt,{cancellationPolicy:!1})]}),e.jsx(Da,{onSuccess:()=>{(f==null?void 0:f.type)!=="apple_pay"&&b()},render:({open:w})=>e.jsx(Ea,{totals:{net_after_discount:(r==null?void 0:r.fare.totalPrice)||0},currency:r==null?void 0:r.fare.currency,loading:c,type:"button",className:"xs:max-w-xs",onClick:()=>{a?b():w()}})})]})]})},Ki=Ji,Yi=()=>{const{t}=L("hotels_common");return e.jsxs("div",{className:"w-full space-y-0 pb-6 lg:space-y-6",children:[e.jsx(h,{as:"h1",variant:"heading-XL",className:"hidden lg:block",children:t("hotels_common:payment_details")}),e.jsx(Ki,{})]})},Qi=Yi,ec=()=>{const[t,s]=g.useState(!0),{mode:n,isLoading:a,pId:o,hotelId:l,isFetching:r,isRefetching:i,hotelDetails:d}=ee(),{locale:u}=R(),{trackEvent:c}=W(),{state:m}=G(),{data:p,isLoading:x,error:f}=Fs({id:o||"",lang:u}
5,{enabled:!!o&&!i,refetchInterval:t?2e3:!1,refetchOnWindowFocus:t});return g.useEffect(()=>{(p!=null&&p.pollingStatus&&(p==null?void 0:p.pollingStatus)!=="IN_PROGRESS"||f)&&s(!1),f&&c({event:"stays_error_occurred",data:{screen:n==="room_selection"?"Details":n==="guest_details"?"Guest":"Checkout",error_type:f.name,error_message:f.message,session_id:m==null?void 0:m.sId}})},[p,f]),g.useEffect(()=>{c(C({event:n==="room_selection"?"stays_rooms_loaded":n==="guest_details"?"stays_guest_details_page_loaded":"stays_payment_summary_page_loaded"},n==="room_selection"&&{data:{location_code:m.location,location_name:m.city,hotel_name:d==null?void 0:d.name,hotel_code:l,rooms_count:m.adults.length,price:m.price}}))},[n]),x||i||a||r||(p==null?void 0:p.pollingStatus)==="IN_PROGRESS"&&!(p!=null&&p.packages.length)?e.jsx(ft,{}):e.jsxs(e.Fragment,{children:[e.jsx(Ei,{}),e.jsxs("div",{className:"container mb-20 flex justify-center gap-6 lg:mb-28",children:[e.jsxs("div",{className:"w-full space-y-6 lg:basis-3/5",children:[n==="room_selection"?e.jsx(Cn,{packages:p==null?void 0:p.packages}):n==="guest_details"?e.jsx(Ni,{}):e.jsx(Qi,{}),e.jsx(ke,{className:"!mb-6 md:hidden"})]}),e.jsx("aside",{className:"mx-auto hidden w-full shrink-0 space-y-6 md:block md:basis-2/5",children:e.jsx(Xi,{})})]}),e.jsx(Ci,{})]})},tc=ec,sc=({hotelId:t})=>{var s;const{locale:n,search:a}=R(),{supportedCountryCode:o}=xa(),{data:l,isLoading:r}=ka({slug:((s=Ma.config)==null?void 0:s.hotelsSlug)||""}),{state:i}=G(),{user:d}=ht({autoFetch:!0}),u=g.useMemo(()=>{const b=a.get("title")||"",S=a.get("firstName")||(d==null?void 0:d.first_name)||"",w=a.get("lastName")||(d==null?void 0:d.last_name)||"",k=a.get("email")||(d==null?void 0:d.email)||"",I=a.get("phone")||(d==null?void 0:d.cell_number)||"",O=a.get("country")?pe.find(K=>K.code===a.get("country")):d!=null&&d.cell_country_code?pe.find(K=>K.code===(d==null?void 0:d.cell_country_code)):pe[0],M=a.get("packageId")||"",E=a.get("pId")||"",B=a.get("sId")||"",X=a.get("mode")||"room_selection";return{title:b,firstName:S,lastName:w,email:k,phone:I,country:O||pe[0],packageId:M,pId:E,sId:B,mode:X}},[a,d]),{data:c,isLoading:m,isRefetching:p,isError:x}=Ts({lang:n,checkIn:i.checkInDate?Z(i.checkInDate,n,{day:"2-digit",month:"2-digit",year:"numeric",timeZone:void 0}).date:"",checkOut:i.checkOutDate?Z(i.checkOutDate,n,{day:"2-digit",month:"2-digit",year:"numeric",timeZone:void 0}).date:"",hotelId:t,roomsInfo:i.adults.map((b,S)=>{var w;return{adultsCount:b,kidsAges:(w=i.childrenAges[S])!=null&&w.filter(k=>k!=="").length?i.childrenAges[S].map(Number):[]}})},{enabled:b=>!b.state.data&&!!t&&u.mode==="room_selection"}),f=g.useMemo(()=>{const b=(c==null?void 0:c.pId)||u.pId,S=(c==null?void 0:c.sId)||u.sId;return{pId:b,sId:S}},[c,u]),{data:_,isLoading:v,isSuccess:j,isFetching:y,isError:N}=Es({pId:f.pId||"",sId:f.sId||"",hotelId:t,packageId:u.packageId||"",lang:n},{enabled:!!u.packageId&&!!f.pId&&!!f.sId&&u.mode!=="room_selection"});return e.jsx(Pa,{user:d,locale:n,supportedCountryCode:o??void 0,isTabbyEnabled:(l==null?void 0:l.is_tabby)==="1",isWalletEnabled:l==null?void 0:l.is_wallet_enabled,isApplePayEnabled:l==null?void 0:l.is_apple_pay_allowed,currency:l==null?void 0:l.currency,event:{_id:(l==null?void 0:l._id)||"",title:(l==null?void 0:l.title)||"",vat_percent:(l==null?void 0:l.vat_percent)||"",enable_payment_methods:l==null?void 0:l.enable_payment_methods,tabby_min_order_limit:(l==null?void 0:l.tabby_min_order_limit)||"",card_types:(l==null?void 0:l.card_types)||[],card_discounts:(l==null?void 0:l.card_discounts)||[]},vertical:"hotels",payable:{type:"event",id:(l==null?void 0:l._id)||""},children:e.jsx(ji,{summaryState:u,sId:(f==null?void 0:f.sId)||"",pId:(f==null?void 0:f.pId)||"",hotelId:t,selectedPackage:_,isLoading:m||v||r,isFetching:y,isRefetching:p,isSearchError:x,isSelectPackageError:N,isSelectPackageSuccess:j,children:e.jsx(tc,{})})},l==null?void 0:l._id)},fd=sc,nc=({location:t,className:s})=>{const n=(t==null?void 0:t.address)||"",a=(t==null?void 0:t.city)||"",o=(t==null?void 0:t.area)||"",l=(t==null?void 0:t.country)||"",i=n||(a&&o&&l?`${o}, ${a}, ${l}`:a)||o||l;return i?e.jsx(h,{variant:"body-S",color:"text-secondary",className:A("line-clamp-1",s),children:i}):null},ac=nc,lc=({hotel:t})=>e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row",children:[e.jsxs("div",{className:"grow space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"flex items-center gap-px",children:Array.from({length:t.starRating||0}).map((s,n)=>e.jsx(Se,{className:"text-text-secondary h-2.5 w-2.5 shrink-0"},n))}),!!t.starRating&&e.jsx(h,{as:"span",color:"text-secondary",className:"rtl:h-4",children:"•"}),e.jsx(ac,{location:t.location})]}),e.jsx(h,{as:"h1",variant:"heading-L",children:t.name})]}),e.jsx("div",{className:"self-end",children:e.jsx(bs,{icon:e.jsx(Ls,{className:"h-5 w-5 shrink-0"}),data:{title:t.name,text:t.name},poster:t.thumbnailUrl})})]}),oc=lc,rc=({hotel:t})=>e.jsxs("section",{className:"container space-y-4 py-4",children:[e.jsx(In,{}),e.jsx(oc,{hotel:t}),e.jsx(Sn,{hotel:t})]}),ic=rc,cc=({hotel:t})=>{var s;const{t:n}=L("hotels_common"),a=(s=t.descriptions)==null?void 0:s.find(o=>{var l;return((l=o.category)==null?void 0:l.key)=="general_description"});return a!=null&&a.description?e.jsxs("section",{className:"space-y-4 py-6 md:py-12 lg:pt-0",children:[e.jsx(h,{variant:"heading-L",children:n("hotels_common:about")}),e.jsx(Ne,{children:e.jsx("div",{dangerouslySetInnerHTML:{__html:a.description}})})]}):null},dc=cc,uc=({amenities:t})=>{const{t:s}=L("hotels_common"),n=t==null?void 0:t.filter(({icon_url:a,name:o,facilities:l})=>!!a&&!o&&(l==null?void 0:l.length));return n!=null&&n.length?e.jsx(ne,{title:s("hotels_common:amenities"),render:({open:a})=>e.jsx(D,{shape:"outlined",theme:"action",onClick:a,children:s("hotels_common:show_all_amenities",{count:n.length})}),body:()=>e.jsx("div",{className:"space-y-4",children:n.map(({id:a,icon_url:o,name:l,facilities:r})=>e.jsx("div",{children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("img",{src:o,alt:l,className:"-mt-1 h-6 w-6 shrink-0 invert"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(h,{variant:"label-S",children:l}),e.jsx("div",{className:"space-y-2",children:r.map(i=>i.name&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(la,{className:"text-text-secondary h-4 w-4 shrink-0 bg-transparent"}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:i.name})]},i.id))})]})]})},a))}),cancel:!1,action:!1}):null},mc=uc,hc=({hotel:t})=>{var s,n;const{t:a}=L("hotels_common");return e.jsxs("div",{className:"space-y-4 py-6 md:py-12",children:[(s=t.facilityCategories)!=null&&s.length?e.jsx(h,{variant:"heading-L",children:a("hotels_common:amenities")}):null,e.jsx("div",{className:"grid w-full grid-cols-2",children:(n=t.facilityCategories)==null?void 0:n.slice(0,4).map(({name:o,id:l,icon_url:r})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{src:r,alt:o,className:"h-6 w-6 shrink-0 invert"}),e.jsx(h,{className:"py-2.5",variant:"label-M",children:o})]},l))}),e.jsx(mc,{amenities:t.facilityCategories})]})},gc=hc,xs=4,vc=({hotel:t})=>{const[s,n]=g.useState(!1),{t:a}=L("hotels_common"),o=g.useMemo(()=>{var l;return(l=t.faq)==null?void 0:l.filter(r=>r.question&&r.answer).slice(0,s?t.faq.length:xs)},[t.faq,s]);return o!=null&&o.length?e.jsxs("section",{className:"space-y-4 py-6 md:py-12",children:[e.jsx(h,{variant:"heading-L",children:a("hotels_common:faq")}),e.jsx(z,{className:"space-y-6",children:o.map((l,r)=>e.jsxs(g.Fragment,{children:[e.jsx(ye,{contentClassName:"pt-2",trigger:e.jsxs(D,{shape:"text",theme:"transparent",className:"flex w-full items-center justify-between gap-2 px-0 text-start",children:[e.jsx(h,{variant:"body-L",children:l.question}),e.jsx(se,{className:"h-4 w-4 shrink-0 rotate-90"})]}),children:e.jsx(h,{variant:"body-S",color:"text-secondary",className:"prose",as:"div",dangerouslySetInnerHTML:{__html:l.answer}}
5)}),r!==o.length-1&&e.jsx(H,{})]},r))}),o.length>xs&&e.jsx(D,{shape:"text",theme:"transparent",className:"p-px",onClick:()=>n(!s),children:e.jsx(h,{variant:"link-M",children:a(s?"hotels_common:view_less_faqs":"hotels_common:view_all_faqs")})})]}):null},xc=vc,fs=4,fc=({hotel:t})=>{const[s,n]=g.useState(!1),{t:a}=L("hotels_common"),o=g.useMemo(()=>{var l;return(l=t.policies)==null?void 0:l.filter(r=>{var i;return((i=r.category)==null?void 0:i.title)&&r.policyDetails}).slice(0,s?t.policies.length:fs)},[t.policies,s]);return o!=null&&o.length?e.jsxs("section",{className:"space-y-4 py-6 md:py-12",children:[e.jsx(h,{variant:"heading-L",children:a("hotels_common:policies")}),e.jsx(z,{className:"space-y-6",children:o.map((l,r)=>e.jsxs(g.Fragment,{children:[e.jsx(ye,{contentClassName:"pt-2",trigger:e.jsxs(D,{shape:"text",theme:"transparent",className:"flex w-full items-center justify-between gap-2 px-0 text-start",children:[e.jsx(h,{variant:"body-L",children:l.category.title}),e.jsx(se,{className:"h-4 w-4 shrink-0 rotate-90"})]}),children:e.jsx(h,{variant:"body-S",color:"text-secondary",className:"prose",as:"div",dangerouslySetInnerHTML:{__html:l.policyDetails}})}),r!==o.length-1&&e.jsx(H,{})]},r))}),o.length>fs&&e.jsx(D,{shape:"text",theme:"transparent",className:"p-px",onClick:()=>n(!s),children:e.jsx(h,{variant:"link-M",children:a(s?"hotels_common:view_less_policies":"hotels_common:view_all_policies")})})]}):null},pc=fc,yc=()=>{const{isWebView:t}=Re(),{t:s}=L("hotels_common");return e.jsx(Lt,{className:A("bg-body border-paper flex min-h-20 flex-col items-center justify-center space-y-2 border-t px-4 lg:hidden",t?"pb-6 pt-2":"py-2"),children:e.jsx(D,{type:"submit",form:"details-search-form",className:"w-full",children:s("hotels_common:select_room")})})},_c=yc,jc=()=>{const{t}=L("hotels_common"),{state:s}=G(),n=g.useMemo(()=>s.checkInDate&&Ae({from:s.checkInDate,to:s.checkOutDate,units:["day"]}).day||1,[s.checkInDate,s.checkOutDate]);return e.jsxs("div",{className:"top-20 z-10 lg:sticky lg:space-y-6",children:[e.jsxs(z,{className:"hidden space-y-4 lg:block",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(h,{variant:"label-M",children:t("hotels_common:from")}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(U,{priceClassName:"text-heading-M",currencyClassName:"text-heading-M",originalPrice:Number(s.price)}),e.jsx(h,{variant:"heading-M",color:"text-secondary",children:`${t("hotels_common:for_nights",{count:n})}`})]})]}),e.jsx(Ge,{type:"detail"})]}),e.jsx(Ft,{className:"hidden lg:flex"}),e.jsx(ke,{className:"hidden lg:flex"}),e.jsx(_c,{})]})},bc=jc,Nc=({hotel:t})=>{const{t:s}=L("hotels_common"),n=t.location.city&&t.location.country?`${t.location.city}, ${t.location.country}`:t.location.city||t.location.country,a=`https://maps.google.com/?q=${t.location.latitude},${t.location.longitude}`,o=g.useMemo(()=>{var l;const r=(l=t.descriptions)==null?void 0:l.find(i=>{var d;return((d=i.category)==null?void 0:d.key)==="attractions"});return r==null?void 0:r.description},[t.descriptions]);return e.jsxs("section",{className:"space-y-4 py-6 md:py-12",children:[e.jsx(h,{variant:"heading-L",children:s("hotels_common:where_you_stay")}),e.jsxs(z,{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Pe,{className:"h-6 w-6 shrink-0"}),e.jsxs("div",{children:[t.location.area&&e.jsx(h,{variant:"heading-S",children:t.location.area}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:n})]})]}),e.jsx(D,{theme:"action",shape:"outlined",as:de,target:"_blank",href:a,children:e.jsx(h,{children:s("hotels_common:get_directions")})})]}),e.jsx(H,{}),o&&e.jsxs("div",{children:[e.jsx(h,{variant:"heading-XS",children:s("hotels_common:nearby_attractions")}),e.jsx(Ne,{className:"text-text-secondary",minimum:6,children:e.jsx("div",{dangerouslySetInnerHTML:{__html:o||""}})})]})]})]})},wc=Nc,kc=({reviewsCount:t=2})=>e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"bg-body-dark/10 rounded-XS h-6 w-44 animate-pulse"}),e.jsx("div",{className:"flex gap-2",children:[...new Array(3)].map((s,n)=>e.jsx("div",{className:"bg-body-dark/10 h-11 w-20 animate-pulse rounded-full"},n))})]}),[...new Array(t)].map((s,n)=>e.jsxs("div",{className:"bg-body-dark/10 bg-paper p-M border-paper rounded-S w-full animate-pulse space-y-6 border",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"bg-body-dark/10 h-9 w-9 animate-pulse rounded-full"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"bg-body-dark/10 h-2 w-24 animate-pulse"}),e.jsx("div",{className:"bg-body-dark/10 h-2 w-24 animate-pulse"})]})]}),e.jsx("div",{className:"bg-body-dark/10 h-3 w-32 animate-pulse"}),e.jsx("div",{className:"bg-body-dark/10 h-4 w-28 animate-pulse"}),e.jsx("div",{className:"bg-body-dark/10 h-3 w-48 animate-pulse"}),e.jsx("div",{className:"bg-body-dark/10 h-3 w-48 animate-pulse"}),e.jsx("div",{className:"bg-body-dark/10 h-2 w-20 animate-pulse"})]},n)),e.jsx("div",{className:"bg-body-dark/10 rounded-S h-10 w-48 animate-pulse"})]}),Sc=kc,Cc=({className:t})=>e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-body-dark/10 rounded-XS h-11 w-11 animate-pulse"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"bg-body-dark/10 h-6 w-24 animate-pulse"}),e.jsx("div",{className:"bg-body-dark/10 h-4 w-48 animate-pulse"})]})]}),e.jsx("div",{className:A("w-full space-y-3",t),children:[...new Array(6)].map((s,n)=>e.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[e.jsx("div",{className:"bg-body-dark/10 h-4 w-16 animate-pulse"}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"bg-body-dark/10 relative h-0.5 w-28 animate-pulse"}),e.jsx("div",{className:"bg-body-dark/10 flex h-5 w-5 animate-pulse items-center justify-end"})]})]},n))})]}),Ic=Cc,Lc=({label:t,score:s,maxScore:n=10})=>{const a=s/n*100;return e.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[e.jsx(h,{variant:"label-M",className:"min-w-[100px]",children:t}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"bg-body-level-2 relative h-0.5 w-28",children:e.jsx("div",{className:"bg-body-dark absolute z-20 h-0.5",style:{width:`${a}%`}})}),(!!s||s===0)&&e.jsx("div",{className:"flex w-5 items-center justify-end",children:e.jsx(h,{variant:"body-S",children:s<10?s.toFixed(1):s})})]})]})},Dc=Lc,Mc=({reviewOverall:t,scoreClassName:s,subCategoryClassName:n,ratingSize:a})=>{const{t:o}=L("hotels_common");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:A("space-y-2",s),children:[(t==null?void 0:t.averageRating)&&e.jsx("div",{className:A("bg-body-dark rounded-XS text-body-light flex items-center justify-center p-1",a==="lg"?"h-16 w-16":"h-11 w-11"),children:e.jsx(h,{className:"relative rtl:top-1",variant:a==="lg"?"heading-XXL":"heading-L",children:t.averageRating})}),e.jsxs("div",{className:"space-y-1",children:[(t==null?void 0:t.summary)&&e.jsx(h,{variant:a==="lg"?"heading-XS":"heading-M",children:t.summary}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:o("hotels_common:based_on_exclusive_reviews")})]})]}),(t==null?void 0:t.subCategories)&&e.jsx("div",{className:A("space-y-2",n),children:Object.entries(t.subCategories).map(([l,r])=>e.jsx(Dc,{label:o(`hotels_common:${vi[l]}`),score:r},l))})]})},Pn=Mc,Pc=({review:{detail:t,metric:s},className:n})=>{var a;const{locale:o}=R(),{t:l}=L("hotels_common"),[r,i]=g.useState(!1),d=V((t==null?void 0:t.checkout)||"",o,{month:"short",year:"numeric"}),u=da({from:new Date((t==null?void 0:t.submittedDate)||""),units:["year"],locale:o,options:{style:"short"}});return e.jsxs(z,{className:A("flex h-full flex-col justify-between gap-4 lg:h-auto",n),children:[e.jsxs("div",{className:"xs:justify-start flex items-center justify-between gap-4",children:[(t==null?void 0:t.name)&&e.jsx("div",{className:"bg-primary text-body-dark xs:flex hidden h-9 w-9 shrink-0 items-center justify-center rounded-full uppercase",children:t.name.slice(0,2)}),e.jsxs("div",{className:"xs:block hidden grow",children:[(t==null?void 0:t.name)&&e.jsx(h,{variant:"body-S",strong:!0,children:t.name}),(t==null?void 0:t.nationality)&&e.jsx(h,{variant:"body-S",color:"text-secondary",children:t.nationality})]}),(!!(s!=null&&s.rating)||(s==null?void 0:s.rating)==0)&&e.jsx(z,{size:"XS",className:"inline-flex h-8 w-8 items-center justify-center",children:e.jsx(h,{strong:!0,className:"rtl:relative rtl:top-0.5",children:s.rating<10?s.rating.toFixed(1):s.rating})}),(t==null?void 0:t.checkout)&&e.jsxs(h,{variant:"body-S",color:"text-secondary",className:"xs:hidden",children:[d,t.travelType&&` • ${l("stay_type",{type:t.travelType})}`]})]}),(t==null?void 0:t.checkout)&&e.jsxs(h,{variant:"body-S",color:"text-secondary",className:"xs:block hidden",children:[l("stayed_in",{date:d}),t.travelType&&` • ${l("stay_type",{type:t.travelType})}`]}),e.jsxs("div",{className:"space-y-4",children:[(t==null?void 0:t.review)&&e.jsxs("div",{className:"space-y-3",children:[t.review.headline&&e.jsx(h,{strong:!0,className:"wrap-break-word",children:r?t.review.translatedHeadline:t.review.headline}),t.review.likable&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wl,{className:"text-success-700 h-4 w-4 shrink-0"}),e.jsx(h,{className:"wrap-break-word",children:r?t.review.translatedLikable:t.review.likable})]}),t.review.unlikable&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Nl,{className:"text-body-dark relative top-1 h-4 w-4 shrink-0"}),e.jsx(h,{className:"wrap-break-word",children:r?t.review.translatedUnlikable:t.review.unlikable})]})]}),e.jsxs("div",{className:"inline-flex items-center gap-2",children:[u&&e.jsx(h,{variant:"body-XS",color:"text-secondary",children:u}),((a=t==null?void 0:t.review)==null?void 0:a.translatedHeadline)&&t.review.translatedLikable&&t.review.translatedUnlikable&&e.jsxs(e.Fragment,{children:[u&&e.jsx(h,{variant:"body-XS",color:"text-secondary",children:"•"}),e.jsx(D,{shape:"text",theme:"action",className:"!p-0",onClick:()=>i(c=>!c),children:e.jsx(h,{variant:"body-XS",strong:!0,children:l(r?"hotels_common:original_text":"hotels_common:see_translation")})})]})]})]}),e.jsxs("div",{className:"xs:hidden flex gap-4",children:[(t==null?void 0:t.name)&&e.jsx("div",{className:"bg-primary text-body-dark flex h-9 w-9 shrink-0 items-center justify-center rounded-full uppercase",children:t.name.slice(0,2)}),e.jsxs("div",{className:"grow",children:[(t==null?void 0:t.name)&&e.jsx(h,{variant:"body-S",strong:!0,children:t.name}),(t==null?void 0:t.nationality)&&e.jsx(h,{variant:"body-S",color:"text-secondary",children:t.nationality})]})]})]})},ps=Pc,Ec=({reviewsData:t,hotelName:s})=>{var n;const{t:a}=L("hotels_common");return(n=t==null?void 0:t.reviews)!=null&&n.length?e.jsx(ne,{title:e.jsxs("span",{className:"p-M bg-body flex flex-col space-y-1 text-center md:text-start",children:[e.jsx(h,{variant:"heading-L",as:"span",children:a("hotels_common:reviews")}),e.jsx(h,{color:"text-secondary",as:"span",children:s})]}),render:({open:o})=>e.jsx(D,{theme:"action",shape:"outlined",className:"w-full sm:w-auto",onClick:o,children:e.jsx(h,{strong:!0,as:"span",children:a("hotels_common:show_all_reviews",{count:t.reviews.length})})}),action:!1,cancel:!1,bodyClassName:"p-L",size:"2xl",body:()=>e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col items-stretch justify-center gap-4",children:[e.jsx("div",{className:"self-center",children:e.jsx(Pn,{reviewOverall:t==null?void 0:t.aggregates,ratingSize:"lg",scoreClassName:"flex flex-col items-center justify-center text-center"})}),e.jsx(H,{type:"zigzag",className:"text-body-level-1 my-6"}),e.jsx(En,{reviewsData:t,hotelName:s,showAll:!0})]})})}):null},Oc=Ec,Rc=({reviewsData:t,hotelName:s,showAll:n=!1})=>{const[a,o]=g.useState(es[0].value),[l,r]=g.useState(),{t:i}=L("hotels_common"),d=g.useMemo(()=>{var m;const p=(m=t==null?void 0:t.reviews)==null?void 0:m.filter(x=>{var f,_,v,j,y,N;return((_=(f=x==null?void 0:x.detail)==null?void 0:f.review)==null?void 0:_.headline)||((j=(v=x==null?void 0:x.detail)==null?void 0:v.review)==null?void 0:j.likable)||((N=(y=x==null?void 0:x.detail)==null?void 0:y.review)==null?void 0:N.unlikable)});return p==null?void 0:p.sort(xi[a])},[t,a]),u=g.useMemo(()=>d==null?void 0:d.reduce((m,p)=>{var x;const f=(x=p==null?void 0:p.detail)==null?void 0:x.travelType;return f&&(m[f]?m[f].push(p):m[f]=[p]),m},{}),[d]),c=g.useMemo(()=>{const m=l?u==null?void 0:u[l]:d;return n?m:m==null?void 0:m.slice(0,2)},[l,d,u,n]);return e.jsxs(e.Fragment,{children:[e.jsx(h,{variant:"heading-M",children:i("hotels_common:guest_reviews")}),e.jsxs(be,{rootClassName:"sticky -top-2 bg-body z-[1]",containerClassName:"flex items-center gap-2",children:[e.jsx(Ss,{menu:{className:"z-[1000]"}
5,trigger:{theme:"action",shape:"text",phill:!0,className:"bg-body text-body-dark border border-2"},value:a,options:es.map(m=>P(C({},m),{text:i(`hotels_common:${m.label}`)})),onChange:m=>o(m.value),hideErrorSpace:!0}),Object.keys(u||{}).map(m=>e.jsx(D,{onClick:()=>r(p=>{if(p!==m)return m}),theme:"action",phill:!0,shape:"outlined",className:A("min-w-fit shrink-0",m===l?"bg-body text-body-dark border-2":"border-paper text-text-secondary"),children:m},m))]}),!!(c!=null&&c.length)&&e.jsx(be,{rootClassName:n?"hidden":"block xs:hidden",containerClassName:"items-stretch gap-4",children:c.map(m=>e.jsx(ps,{review:m,className:"h-auto shrink-0 basis-11/12"},m.id))}),c==null?void 0:c.map(m=>e.jsx(ps,{review:m,className:n?"":"xs:block hidden"},m.id)),d!=null&&d.length&&!n?e.jsx("div",{className:"flex justify-center md:justify-start",children:e.jsx(Oc,{reviewsData:{reviews:t.reviews,aggregates:t.aggregates},hotelName:s})}):null]})},En=Rc,Ac=({hotelId:t,hotel:s})=>{var n,a;const{t:o}=L("hotels_common"),{locale:l}=R(),{data:r,isLoading:i,isError:d}=As({hotelId:t,lang:l}),u=g.useMemo(()=>(r==null?void 0:r.aggregates)&&Object.values(r.aggregates).some(c=>c!=null&&typeof c=="object"&&Object.keys(c).length>0),[r==null?void 0:r.aggregates]);return d?null:(i||!!((n=r==null?void 0:r.reviews)!=null&&n.length)||u)&&e.jsxs("div",{className:"space-y-4 py-6 md:py-12",children:[e.jsx(h,{variant:"heading-L",children:o("hotels_common:reviews")}),e.jsxs("div",{className:"flex flex-col gap-8 md:flex-row lg:flex-col xl:flex-row",children:[e.jsx("div",{className:"flex basis-1/3 lg:basis-full xl:basis-1/3",children:i?e.jsx(Ic,{className:"xs:block hidden"}):u&&e.jsx(Pn,{reviewOverall:r.aggregates,subCategoryClassName:"hidden xs:block"})}),e.jsx("div",{className:"flex min-w-0 basis-2/3 flex-col gap-4 lg:basis-full xl:basis-2/3",children:i?e.jsx(Sc,{}):r&&((a=r==null?void 0:r.reviews)!=null&&a.length)?e.jsx(En,{reviewsData:r,hotelName:s.name}):null})]})]})},Tc=Ac,Fc=({id:t})=>{const{locale:s}=R(),{trackEvent:n}=W(),{state:a}=G(),{data:o,isLoading:l}=mt({hotelId:t,lang:s}),r=()=>{n({event:"stays_details_room_availability_clicked",data:{location_code:a.location,location_name:a.city,hotel_name:o==null?void 0:o.name,hotel_code:t,price:a.price,rooms_count:a.adults.length,guests_count:a.adults.reduce((i,d)=>i+d,0)+a.children.reduce((i,d)=>i+d,0),children_ages:a.childrenAges,star_rating:o==null?void 0:o.starRating}})};return g.useEffect(()=>{o&&n({event:"stays_details_page_loaded",data:{location_code:a.location,location_name:a.city,hotel_name:o.name,hotel_code:t,price:a.price,rooms_count:a.adults.length,guests_count:a.adults.reduce((i,d)=>i+d,0)+a.children.reduce((i,d)=>i+d,0),children_ages:a.childrenAges,star_rating:o.starRating}})},[o]),l?e.jsx(ft,{}):o?e.jsxs(e.Fragment,{children:[e.jsx(ic,{hotel:o}),e.jsxs("div",{className:"container flex flex-col-reverse gap-6 pb-8 md:py-8 lg:flex-row",children:[e.jsxs("div",{className:"grow overflow-hidden",children:[e.jsx(Bt,{reload:!0,onReload:r}),e.jsx(H,{className:"block md:hidden"}),e.jsx(dc,{hotel:o}),e.jsx(H,{}),e.jsx(gc,{hotel:o}),e.jsx(H,{}),e.jsx(Tc,{hotelId:t,hotel:o}),e.jsx(H,{}),e.jsx(wc,{hotel:o}),e.jsx(H,{}),e.jsx(xc,{hotel:o}),e.jsx(H,{}),e.jsx(pc,{hotel:o}),e.jsx(H,{}),e.jsx(Ft,{className:"my-6 md:my-12 lg:hidden"}),e.jsx(ke,{className:"lg:hidden"})]}),e.jsx("aside",{className:"mx-auto w-full shrink-0 grow space-y-6 lg:max-w-md",children:e.jsx(bc,{})})]})]}):null},pd=Fc,Hc=({value:t,onChange:s})=>{const{t:n}=L(["hotels_common"]),{trackEvent:a}=W(),o=l=>{a({event:"stays_results_sort_applied",data:{sort_by:l.value}}),s(P(C({},t),{sort:l.value}))};return e.jsx(Ss,{trigger:{className:"p-0 underline"},value:t.sort,options:Tl.map(l=>P(C({},l),{text:n(`hotels_common:${l.label}`)})),onChange:o,hideErrorSpace:!0})},Bc=Hc,$c=({render:t})=>{const{state:s,setState:n}=G(),{locale:a}=R(),{state:o,setState:l}=Ce();return t({onClick:()=>{s.view!=="map"&&(n({data:P(C({},s),{view:"map"})}),l(o,P(C({},s),{checkInDate:s.checkInDate?Z(s.checkInDate,a,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:void 0}).date:"",checkOutDate:s.checkOutDate?Z(s.checkOutDate,a,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:void 0}).date:"",view:"map"})))}})},Zc=$c,zc=({hotels:t,sId:s,notice:n})=>{var a,o;const[l,r]=g.useState(Qt),{locale:i}=R(),{t:d}=L(["hotels_common"]),{isMobile:u}=Re(),{trackEvent:c}=W(),{state:m}=G(),{state:p,setState:x}=Ce(),{filteredHotels:f}=gn({hotels:t,filterState:p}),_=v=>{x(v,P(C({},m),{checkInDate:m.checkInDate?Z(m.checkInDate,i,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:void 0}).date:"",checkOutDate:m.checkOutDate?Z(m.checkOutDate,i,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:void 0}).date:""})),c({event:"stays_results_filter_applied",data:v})};return e.jsxs("div",{className:"flex lg:gap-4",children:[e.jsxs("div",{className:"lg:w-full lg:max-w-sm lg:space-y-8",children:[e.jsx(Zc,{render:({onClick:v})=>e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"hidden !p-0 lg:block",children:e.jsxs(D,{onClick:v,shape:"text",theme:"action",className:"relative w-full flex-col items-center justify-center gap-0 p-0",children:[e.jsx(ue,{className:"h-32 w-full object-cover",src:"/@wbk/hotels/map-filter.png"}),e.jsx(aa,{className:"text-primary absolute top-14"}),e.jsxs(h,{color:"action",variant:"heading-XXS",className:"flex items-center gap-1 py-3 text-center",children:[e.jsx(_t,{className:"h-5 w-5 shrink-0"}),e.jsx("span",{className:"underline",children:d("hotels_common:cross_selling.map.show_on_map")})]})]})}),e.jsx(Lt,{className:"text-center lg:hidden",children:e.jsxs(D,{onClick:v,phill:!0,theme:"action",children:[e.jsx(_t,{className:"h-5 w-5 shrink-0"}),e.jsx(h,{variant:"heading-XXS",children:d("hotels_common:cross_selling.map.explore_on_map")})]})})]})}),!u&&e.jsxs("div",{className:"hidden lg:block",children:[e.jsx(h,{variant:"heading-S",className:"mb-4",children:d("hotels_common:filter_by")}),e.jsx(Nn,{hotels:t,value:p,onChange:_,count:f.length})]})]}),e.jsxs("div",{className:"grow space-y-4 overflow-x-hidden pt-1 lg:space-y-6 lg:pt-0",children:[e.jsxs("div",{children:[u&&e.jsx("div",{className:"mb-4 lg:hidden",children:e.jsx(ot,{hotels:t,value:p,onChange:_,count:f.length})}),!!f.length&&e.jsxs(e.Fragment,{children:[e.jsx(h,{variant:"heading-M",className:"lg:text-heading-L mb-4",children:d("hotels_common:hotels_and_places_to_stay_in",{city:m.city})}),e.jsx("div",{className:"flex justify-between gap-px lg:flex-row lg:items-center lg:gap-1",children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs(h,{variant:"body-S",className:"lg:text-body-M",children:[d("hotels_common:results_sorted_by",{count:f.length})," "]}),e.jsx(Bc,{value:p,onChange:_})]})})]})]}),((a=n==null?void 0:n[0])==null?void 0:a.body)&&((o=n==null?void 0:n[0])==null?void 0:o.title)&&e.jsx(z,{border:!1,className:"bg-notice text-notice-contrast",children:e.jsxs(Ne,{readMoreLabel:d("hotels_common:learn_more"),readLessLabel:d("hotels_common:show_less"),minimum:2,btnProps:{className:"text-notice-contrast text-body-S font-link underline px-0"},children:[e.jsx(h,{as:"div",variant:"heading-S",className:"text-notice-contrast",dangerouslySetInnerHTML:{__html:n[0].title}}),e.jsx(h,{className:"text-notice-contrast",as:"div",dangerouslySetInnerHTML:{__html:n[0].body}})]})}),f.length?e.jsxs("div",{className:"divide-body-level-1 divide-y",children:[f.slice(0,l).map((v,j)=>e.jsx(kn,{hotel:v,sId:s,cardPosition:j+1},v.hotelId)),e.jsxs("div",{className:"flex flex-col items-center gap-4 py-4",children:[e.jsx(D,{theme:"action",shape:"outlined",onClick:()=>r(l+Qt),disabled:l>=f.length,children:d("hotels_common:load_more")}),e.jsx(ke,{})]})]}):e.jsx(xt,{})]})]})},Uc=zc,Vc=({searchId:t,searchStatus:s,pollingEnabled:n})=>{const[a,o]=g.useState(0),[l,r]=g.useState(!0),i=g.useRef(null);return g.useEffect(()=>{t&&t!==i.current&&n&&(i.current=t,o(0),r(!0))},[t,n]),g.useEffect(()=>{if(s)if(s==="COMPLETED_SUCCESSFULLY"||!n){o(100);const d=setTimeout(()=>{r(!1)},800);return()=>clearTimeout(d)}else if(s==="IN_PROGRESS"||s==="COMPLETED_WITH_TIMEOUT"&&n){if(r(!0),a<95){const d=setTimeout(()=>{o(u=>Math.min(u+(95-u)*.1,95))},1e3);return()=>clearTimeout(d)}}else r(!1)},[s,a,n]),{progress:a,shouldShow:l}},Gc=({searchId:t,searchStatus:s,pollingEnabled:n})=>{const{shouldShow:a,progress:o}=Vc({searchId:t,searchStatus:s,pollingEnabled:n});return e.jsx(Et,{children:a&&e.jsx(Ue.div,{initial:{opacity:0}
5,animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"sticky left-0 right-0 top-12 z-50 md:top-16",children:e.jsx("div",{className:"bg-body-level-1 h-0.5 w-full overflow-hidden",children:e.jsx(Ue.div,{className:"bg-primary h-full ltr:origin-left rtl:origin-right",initial:{scaleX:0},animate:{scaleX:o/100},transition:{duration:.8,ease:"easeOut"}})})})})},Xc=Gc,qc=()=>{const{trackEvent:t}=W(),[s,n]=g.useState(!0),{t:a}=L("hotels_common"),{locale:o}=R(),{state:l,setState:r}=G(),{isMobile:i,isWebView:d}=Re(),{data:u}=wa({locationId:l.location,lang:o}),{data:c,isLoading:m,isRefetching:p,isFetching:x,refetch:f,error:_}=Os({lang:o,checkIn:l.checkInDate?Z(l.checkInDate,o,{day:"2-digit",month:"2-digit",year:"numeric",timeZone:void 0}).date:"",checkOut:l.checkOutDate?Z(l.checkOutDate,o,{day:"2-digit",month:"2-digit",year:"numeric",timeZone:void 0}).date:"",placeId:isNaN(Number(l.location))?l.location:void 0,hotelId:isNaN(Number(l.location))?void 0:l.location,roomsInfo:l.adults.map((E,B)=>{var X;return{adultsCount:E,kidsAges:(X=l.childrenAges[B])!=null&&X.filter(K=>K!=="").length?l.childrenAges[B].map(Number):[]}})},{enabled:!!l.checkInDate&&!!l.checkOutDate}),{data:v,isLoading:j,error:y,isSuccess:N}=Rs({lang:o,id:(c==null?void 0:c.sId)||""},{enabled:!!(c!=null&&c.sId)&&!p,refetchInterval:s?2e3:!1,refetchOnWindowFocus:s,placeholderData:E=>E}),b=at("searchTimer"),S=g.useMemo(()=>{if(!b||!N)return 0;const E=Oe({date:new Date(Number(b)),interval:"second",value:Xe});return Math.floor((E.getTime()-Date.now())/1e3)},[b,N]),{checkInDate:w,checkOutDate:k}=g.useMemo(()=>({checkInDate:l.checkInDate?V(l.checkInDate,o,{day:"2-digit",month:"short",timeZone:void 0}):"",checkOutDate:l.checkOutDate?V(l.checkOutDate,o,{day:"2-digit",month:"short",timeZone:void 0}):""}),[l.checkInDate,l.checkOutDate,o]),I=g.useMemo(()=>{var E;let B=0;for(let X=0;X<l.adults.length;X++){B+=l.adults[X];for(let K=0;K<((E=l.childrenAges[X])==null?void 0:E.length);K++)l.childrenAges[X][K]!==""&&B++}return B},[l.adults,l.childrenAges]),O=()=>{f(),n(!0)};g.useEffect(()=>{n(!0)},[]),g.useEffect(()=>{!((v==null?void 0:v.sId)&&v.sId!==(c==null?void 0:c.sId))&&(v!=null&&v.searchStatus&&(v==null?void 0:v.searchStatus)!=="IN_PROGRESS"&&s||_||y)&&n(!1),_&&t({event:"stays_error_occurred",data:{screen:"Details",error_type:_.name,error_message:_.message,session_id:l.sId}}),y&&t({event:"stays_error_occurred",data:{screen:"Details",error_type:y.name,error_message:y.message,session_id:l.sId}})},[v,_,y,s,c==null?void 0:c.sId,v==null?void 0:v.sId]),g.useEffect(()=>{x&&(n(!0),t({event:"stays_home_search_started",data:{location_code:l.location,location_name:l.city,checkin_date:w,checkout_date:k,rooms_count:l.adults.length,guests_count:I,children_ages:l.childrenAges}}))},[x]),g.useEffect(()=>{(v==null?void 0:v.searchStatus)==="COMPLETED_SUCCESSFULLY"&&t({event:"stays_results_page_loaded"})},[v]),g.useEffect(()=>{const E=new Date().getTime(),B=E.toString();c&&c.sId!==l.sId?(Ze("searchTimer",B),r({data:P(C({},l),{sId:c==null?void 0:c.sId}),path:window.location.pathname})):c&&c.sId===l.sId&&(!b||Number(b)+Xe*1e3<=E)&&Ze("searchTimer",B)},[c,l]);const M=m||j||p||(v==null?void 0:v.searchStatus)==="IN_PROGRESS"&&!(v!=null&&v.hotels.length);return M&&l.view!=="map"?e.jsx(ft,{}):e.jsxs("div",{className:"relative",children:[!M&&e.jsx(Ln,{city:l.city,onClose:O,initialSeconds:S,onCountdownEnd:()=>{t({event:"stays_error_occurred",data:{screen:"Search",error_type:_?_.name:y?y.name:"SearchTimeout",error_message:(_==null?void 0:_.message)||(y==null?void 0:y.message)||"Search timed out",session_id:l.sId}})}}),i?e.jsxs("div",{className:A("bg-body container sticky z-10 flex items-center justify-between text-center lg:hidden",d?"top-0":"top-12 md:top-16"),children:[!d&&e.jsx(D,{shape:"text",theme:"transparent",as:de,href:`/${o}/hotels`,className:"px-0",children:e.jsx(se,{className:"h-4 w-4 rotate-180"})}),e.jsx(ne,{className:"lg:hidden",ignoreHistory:!0,title:a("hotels_common:edit_your_search"),render:({open:E})=>e.jsxs(D,{onClick:E,shape:"text",theme:"transparent",className:"w-full flex-col gap-0",children:[e.jsx(h,{className:"flex items-center",variant:"label-L",children:l.city}),e.jsxs(h,{variant:"label-XS",color:"text-secondary",className:"flex items-center gap-1",children:[e.jsxs("span",{children:[w," - ",k]}),e.jsx("span",{className:"rtl:h-4",children:"•"}),e.jsx("span",{children:a("hotels_common:guests",{count:I})}),e.jsx(se,{className:"h-1.5 w-1.5 shrink-0 rotate-90"})]})]}),body:({close:E})=>e.jsx(Ge,{className:"mx-0 max-w-none",onFormSubmit:B=>{r({data:P(C(C({},l),B),{location:B.location.location,city:B.location.city,price:Number(l.price)})}),E()},showSearchButton:!1},"mobile-search-form"),action:void 0,cancel:void 0,customAction:()=>e.jsxs(D,{className:"w-full",type:"submit",form:"hotels-search-form",children:[e.jsx(Ee,{})," ",a("hotels_common:search")]})})]}):e.jsx("div",{className:"border-paper hidden border-b lg:block",children:e.jsx("div",{className:"container",children:e.jsx(Ge,{className:"bg-transparent py-8"},"desktop-search-form")})}),e.jsx(Xc,{searchId:(c==null?void 0:c.sId)||"",searchStatus:(v==null?void 0:v.searchStatus)||"",pollingEnabled:s}),e.jsx("div",{className:"pb-6 lg:py-6",children:e.jsx(wn,{mode:"dynamic",hotelResults:v,isLoading:M,children:e.jsx("div",{className:"container",children:!(v!=null&&v.hotels)||!(v!=null&&v.hotels.length)?e.jsx("div",{className:"container py-6",children:e.jsx(xt,{showReset:!1})}):e.jsx(Uc,{hotels:v==null?void 0:v.hotels,sId:(c==null?void 0:c.sId)||"",notice:u})})})})]})},yd=qc,Wc=()=>e.jsxs("div",{className:"relative z-10 shrink-0 basis-56 space-y-2 md:basis-[312px] ltr:mr-4 md:ltr:mr-6 rtl:ml-4 md:rtl:ml-6",children:[e.jsx(fe,{className:"h-56 w-full animate-pulse rounded-xl object-cover md:h-[312px]"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"bg-body-level-1 h-2 w-1/2 animate-pulse rounded-md"}),e.jsx("div",{className:"bg-body-level-1 h-2 w-3/4 animate-pulse rounded-md"}),e.jsx("div",{className:"bg-body-level-1 h-2 w-1/2 animate-pulse rounded-md"})]})]}),Jc=Wc,On="ChIJdYeB7UwbwhURzslwz2kkq5g",Rn="ChIJ1SDSl1G-vRUR2Qg76k9RVC4",ys=[On,Rn],Kc={[On]:"mecca",[Rn]:"medina"},_s=[{adultsCount:2,kidsAges:[]}],js=(t,s)=>{const n=new Date;return n.setDate(n.getDate()+s),Z(n,t,{day:"2-digit",month:"2-digit",year:"numeric",timeZone:void 0}).date},Yc=()=>{const{t}=L("hotels_common"),{locale:s}=R(),[n,a]=g.useState(!0),{setState:o}=G(),l=g.useMemo(()=>js(s,1),[s]),r=g.useMemo(()=>js(s,3),[s]),i=g.useMemo(()=>({lang:s,checkIn:l,checkOut:r,roomsInfo:_s}),[s,l,r]),{data:d,error:u,isFetching:c,isLoading:m}=Sa(P(C({},i),{placeIds:ys})),{data:p,error:x,isLoading:f}=Ca({sIds:d||[],lang:s},{enabled:!!(d!=null&&d.length),refetchInterval:n?2e3:!1,refetchOnWindowFocus:n,placeholderData:y=>y});g.useEffect(()=>{c&&a(!0)},[c]),g.useEffect(()=>{if(!n)return;(!!(p!=null&&p.length)&&p.every(N=>N.searchStatus!=="IN_PROGRESS")||u||x)&&a(!1)},[n,p,u,x]),g.useEffect(()=>{d!=null&&d.length&&a(!0)},[d]);const _=g.useMemo(()=>{const y=new Map;return d==null||d.forEach((N,b)=>{const S=ys[b];y.set(N,Kc[S])}),y},[d]),v=g.useMemo(()=>
5{if(!p)return[];const y=[],N=p.flatMap(b=>{const S=_.get(b.sId);return S?b.hotels.map(w=>P(C({},w),{city:S,sId:b.sId})):[]});for(const b of N)b.showDiscount&&b.discountPrice&&y.push(P(C({},b),{sId:b.sId}));return y},[p,_]),j=m||f||!v.length&&n;return!j&&!v.length?null:e.jsx("section",{className:"container py-8",children:e.jsx(be,{arrows:"top",title:e.jsx(h,{variant:"heading-XL",children:t("hotels_common:webook_deals_from_to",{from:V(l,s,{day:"2-digit",month:"short"}),to:V(r,s,{day:"2-digit",month:"short"})})}),children:j?Array.from({length:8}).map((y,N)=>e.jsx(Jc,{},N)):v.map(y=>{var N;const b=((y==null?void 0:y.discountPrice)||0)+y.basePrice;return e.jsxs(D,{className:"block shrink-0 basis-56 space-y-2 p-0 text-start md:basis-[312px] ltr:mr-4 md:ltr:mr-6 rtl:ml-4 md:rtl:ml-6",theme:"transparent",shape:"text",onClick:()=>{o({data:P(C({},_s),{checkInDate:new Date(l),checkOutDate:new Date(r),price:y.basePrice,sId:y.sId}),path:`/${s}/hotels/${y.hotelId}`})},children:[e.jsx(fe,{width:312,height:312,className:"h-56 w-full rounded-xl object-cover md:h-[312px]",src:oe(y.thumbnailUrl),alt:y.name}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs(h,{variant:"body-S",className:"flex items-center gap-1",color:"text-secondary",children:[e.jsx("span",{children:(N=y.propertyType)==null?void 0:N.name}),!!y.starRating&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-body-XS rtl:h-4",children:"•"}),e.jsxs("span",{className:"flex items-center gap-px",children:[e.jsx(Se,{className:"text-text-secondary h-3.5 w-3.5 shrink-0"}),y.starRating]})]})]}),e.jsx(h,{variant:"label-L",children:y.name}),e.jsx(h,{variant:"body-S",color:"text-secondary",children:t(`hotels_common:${y.city}`)}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(h,{variant:"body-S",color:"text-secondary",children:t("hotels_common:from")}),e.jsx(U,{originalPrice:b,discountPrice:y.basePrice})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(jl,{className:"text-primary h-3 w-3 shrink-0"}),e.jsx(h,{variant:"body-S",color:"primary",children:t("hotels_common:webook_deal")})]})]})]},y.hotelId)})})})},Qc=Yc,ed=({showDeals:t=!0})=>{const{trackEvent:s}=W(),{t:n}=L(["hotels_common"]),{logo:a}=Ms();return g.useEffect(()=>{s({event:"stays_home_page_loaded"})},[]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"xs:bg-[url(/@wbk/hotels/search-bg-desktop.svg)] relative rounded-2xl bg-[url(/@wbk/hotels/search-bg-mobile.svg)] bg-cover bg-center bg-no-repeat py-16 text-center",children:[e.jsx("img",{src:a||"/@wbk/hotels/white-logo.svg",className:"relative mx-auto",width:70,height:22,alt:"logo"}),e.jsx(h,{variant:"heading-XXL",as:"h1",className:"relative mt-1 tracking-tighter",children:n("hotels_common:hotels")})]}),e.jsxs("section",{className:"container h-full space-y-8 pb-4",children:[e.jsx(pi,{title:n("hotels_common:where_to_stay"),titleClassName:"text-center mt-8",className:"-mt-6"}),e.jsx("div",{className:"flex justify-center",children:e.jsx(ke,{})})]}),t&&e.jsx(Qc,{})]})},_d=ed;export{xd as HotelBooking,pd as HotelDetailPage,gd as HotelOrderDetail,vd as HotelOrderHistory,yd as HotelsPage,pi as HotelsSearchSection,_d as SearchPage,fd as SummaryPage};

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.