1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[400],{97400:(e,t,r)=>{r.r(t),r.d(t,{FastbookingCalendar:()=>m});var n=r(95155),l=r(89239),a=r(9281),o=r(99412),s=r(92455),i=r(79225),c=r(30094),d=r(40980),h=r(27055),u=r(50910),f=r(12115);function m(e){let{selected:t,onSelect:m,onConfirm:g,hotelIds:w}=e,[x,p]=f.useState(t),[v,b]=f.useState(t?.from||new Date),{getPriceForDate:D,isDateAvailable:y,getDateInfo:M,fetchPricesForRange:S,fetchPricesForMonth:k,loading:F,prices:C,clearCache:E}=(0,i.U)(),{isSmallScreen:j}={isSmallScreen:(0,c.e)("(max-width: 1023px)"),isLargeScreen:(0,c.e)("(min-width: 1024px)")},Y=(0,u.c)("Fastbooking"),N=f.useRef(null),[$,L]=f.useState(new Set),P=f.useRef(0);f.useEffect(()=>{if(!j)return;let e=N.current;if(!e)return;let t=P.current,r=setTimeout(()=>{0===e.scrollTop&&t>0&&(e.scrollTop=t)},0);return()=>clearTimeout(r)},[C,j]),f.useEffect(()=>{if(!j)return;let e=N.current;if(!e)return;let t=()=>{P.current=e.scrollTop};return e.addEventListener("scroll",t,{passive:!0}),()=>{e.removeEventListener("scroll",t)}},[j]);let T=f.useCallback(()=>{let e=new Date;if(t?.from){let e=t.from;return{start:new Date(e.getFullYear(),e.getMonth(),1),end:new Date(e.getFullYear(),e.getMonth()+2,0)}}return{start:new Date(e),end:new Date(e.getFullYear(),e.getMonth()+2,0)}},[t]);f.useEffect(()=>{p(t)},[t]),f.useEffect(()=>{if(w?.trim())if(E(),j){let e=new Date,t=new Set;[0,1,2].forEach(r=>{let n=new Date(e.getFullYear(),e.getMonth()+r,1),l=`${n.getFullYear()}-${n.getMonth()}`;t.add(l),k(n,w)}),L(t)}else{let{start:e,end:t}=T();S(e,t,w)}},[w,j]),f.useEffect(()=>{if(!j||!w?.trim())return;let e=N.current;if(!e)return;let t=()=>{let t=e.querySelectorAll('[class*="month"]'),r=e.getBoundingClientRect(),n=r.height;t.forEach(e=>{let l=e.getBoundingClientRect(),a=l.top-r.top;if(a<n+n&&a+l.height>-n){let r=Array.from(t).indexOf(e);if(-1!==r){let e=new Date,t=new Date(e.getFullYear(),e.getMonth()+r,1),n=`${t.getFullYear()}-${t.getMonth()}`;L(e=>e.has(n)?e:(k(t,w),new Set(e).add(n)))}}})},r=requestAnimationFrame(()=>{t()});return e.addEventListener("scroll",t,{passive:!0}),()=>{cancelAnimationFrame(r),e.removeEventListener("scroll",t)}},[j,w,k]);let _=f.useCallback(e=>{b(e),!j&&w?.trim()&&S(new Date(e.getFullYear(),e.getMonth(),1),new Date(e.getFullYear(),e.getMonth()+2,0),w)},[w,S,j]),A=f.useMemo(()=>j?`calendar-mobile-${w}-${$.size}`:`calendar-desktop-${w}`,[w,j,$.size]),[W,R]=f.useState(h.es);f.useEffect(()=>{let e=navigator.language;e.startsWith("en")?Promise.resolve().then(r.bind(r,11150)).then(e=>R(e.enGB)):e.startsWith("de")?Promise.resolve().then(r.bind(r,70512)).then(e=>R(e.de)):e.startsWith("it")?Promise.resolve().then(r.bind(r,63410)).then(e=>R(e.it)):e.startsWith("fr")&&Promise.resolve().then(r.bind(r,91279)).then(e=>R(e.fr))},[]);let z=(e=>{if(!e?.from||!e.to)return 0;let t=new Date(e.from.getFullYear(),e.from.getMonth(),e.from.getDate());return Math.max(Math.floor((new Date(e.to.getFullYear(),e.to.getMonth(),e.to.getDate()).getTime()-t.getTime())/864e5),0)})(x),B=()=>{x?.from&&x?.to&&(m?.(x),g)&&g(x.from&&x.to?`${x.from.toLocaleDateString(W.code,{weekday:"short",day:"numeric",month:"short"})} - ${x.to.toLocaleDateString(W.code,{weekday:"short",day:"numeric",month:"short"})}`:"")},H=f.useMemo(()=>{let e=new Date;return v.getFullYear()===e.getFullYear()&&v.getMonth()===e.getMonth()},[v]);return(0,n.jsxs)("div",{className:"flex h-full w-full flex-1 select-none flex-col gap-4 overflow-hidden md:gap-0",children:[(0,n.jsxs)("div",{className:"flex shrink-0 flex-col flex-wrap justify-between gap-4 md:flex-row md:items-center md:px-4 md:py-3",children:[(0,n.jsx)("p",{className:"note-text text-grey-800 hidden md:block",children:Y("Precios desde por habitaci\xf3n")}),(0,n.jsx)(s.MediaQueries,{largeScreen:"(max-width: 1023px)",children:(0,n.jsx)(l.$,{variant:"secondary",disabled:!x?.to,asChild:!0,children:(0,n.jsxs)(o.SheetClose,{onClick:B,children:[Y("Confirmar")," ",z," ",Y(1===z?"noche":"noches")]})})}),(0,n.jsx)("div",{className:"hidden md:block",children:(0,n.jsxs)(l.$,{variant:"secondary",disabled:!x?.to,onClick:B,children:[Y("Confirmar")," ",z," ",Y(1===z?"noche":"noc
1hes")]})})]}),(0,n.jsxs)("div",{ref:N,className:"relative max-h-full min-h-0 flex-1 overflow-y-auto md:px-4 md:py-3",children:[F&&(0,n.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-white/50",children:(0,n.jsx)("div",{className:"text-grey-800 body-text",children:Y("Cargando precios")})}),(0,n.jsx)(a.V,{mode:"range",formatters:{formatWeekdayName:e=>e.toLocaleDateString("es-ES",{weekday:"short"}).charAt(0)},defaultMonth:j?new Date:x?.from,selected:x,onSelect:e=>{p(e)},onMonthChange:_,numberOfMonths:j?12:2,locale:W,fromMonth:new Date,className:"w-full p-0",classNames:{months:(0,d.cn)("flex gap-4 flex-col relative",!j&&"md:flex-row lg:gap-6 xl:gap-10"),day:(0,d.cn)("relative w-full h-8 xs:h-10 p-0 text-center circular-bold border border-white group/day lg:aspect-55/32 select-none"),...j&&{button_previous:(0,d.cn)("hidden"),button_next:(0,d.cn)("hidden")},...!j&&H&&{button_previous:(0,d.cn)("disabled pointer-events-none opacity-0")}},showOutsideDays:!1,priceForDate:D,isDateAvailable:y,getDateInfo:M,showPrices:!0,showPricesInPastDates:!0,hasHotelSelected:!!w?.trim(),disabled:e=>{let t=new Date;t.setHours(0,0,0,0);let r=new Date(e);return r.setHours(0,0,0,0),r<t}},A)]})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.