1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1439],{12345:function(i,e,t){t.r(e);var n=t(52676),o=t(75271),s=t(40507),d=t.n(s),u=t(33589),r=t(32866),l=t(32571);let a=i=>{var e,t,s,d,a,c,v,p,f,g,P,C,h,b;let{isMobile:m,shopping:A,setShopping:y,showNotification:O,language:I,currency:R,currency_id:G,itemLabels:U,productSpecialMessages:q,setLoading:k,productsComplements:S,host:j,validation:D,infoGA4:M,getProductsForChildren:L,metricasGA4:w,cbResults:_}=i,[N,x]=(0,o.useState)([]),[E,B]=(0,o.useState)(!1),F=(null==A?void 0:null===(e=A.Cart)||void 0===e?void 0:null===(t=e.PackageProducts)||void 0===t?void 0:null===(s=t.Products)||void 0===s?void 0:s.filter(i=>"Components"in i).length)+(null==A?void 0:null===(d=A.Cart)||void 0===d?void 0:null===(a=d.IndividualProducts)||void 0===a?void 0:null===(c=a.Products)||void 0===c?void 0:c.filter(i=>"Components"in i).length),Z=(0,o.useMemo)(()=>{var i,e,t;let{Cart:n}=A;if(!n)return null;let o=Array.from((null===(i=n.ActivityProducts)||void 0===i?void 0:i.Products)||[]),s=[],d=Array.from((null===(e=n.PackageProducts)||void 0===e?void 0:e.Products)||[]),u=Array.from((null===(t=n.IndividualProducts)||void 0===t?void 0:t.Products)||[]);for(let i=0;i<d.length;i+=1)if(d[i].Components)for(let e=0;e<d[i].Components.length;e+=1)d[i].Components[e].IsActivity&&s.push(d[i].Components[e]);for(let i=0;i<u.length;i+=1)if(u[i].Components)for(let e=0;e<u[i].Components.length;e+=1)u[i].Components[e].IsActivity&&s.push(u[i].Components[e]);let r=S.filter(i=>{let e=o.find(e=>e.Id===i.idUpgrade||e.Id===i.id);return e||(e=s.find(e=>e.IdProduct===i.id)),!e}),l=r.map(i=>({...i,hasBeenAdded:!1,hasUpgrade:!1}));return l},[F,null==A?void 0:null===(v=A.Cart)||void 0===v?void 0:null===(p=v.ActivityProducts)||void 0===p?void 0:p.ProductCount]),T=(0,o.useMemo)(()=>{let i=[];for(let n=0;n<Z.length;n+=1){var e,t;let o=null,s=!1,d=Z[n];(null==A?void 0:null===(e=A.Cart)||void 0===e?void 0:e.PackageProducts)&&(o=A.Cart.PackageProducts.Products.find(i=>i.ActivityParentGroup&&i.ActivityParentGroup.indexOf(d.idParentGroup)>-1))&&(s=!0),(null==A?void 0:null===(t=A.Cart)||void 0===t?void 0:t.IndividualProducts)&&!s&&(o=A.Cart.IndividualProducts.Products.find(i=>i.ActivityParentGroup&&i.ActivityParentGroup.indexOf(d.idParentGroup)>-1))&&(s=!0),s&&i.push({...d,foundParent:s,parentInfo:{visitDate:null==o?void 0:o.BookingDate,id:null==o?void 0:o.Id,guests:null==o?void 0:o.Guests}})}return i},[Z.length,null==A?void 0:null===(f=A.Cart)||void 0===f?void 0:null===(g=f.PackageProducts)||void 0===g?void 0:g.ProductCount,null==A?void 0:null===(P=A.Cart)||void 0===P?void 0:null===(C=P.IndividualProducts)||void 0===C?void 0:C.ProductCount,null==A?void 0:null===(h=A.Cart)||void 0===h?void 0:null===(b=h.ActivityProducts)||void 0===b?void 0:b.ProductCount]);return((0,o.useEffect)(()=>{B(!0);let i=async()=>{let i=T.reduce((i,e)=>(i[e.businessUnitCode]=i[e.businessUnitCode]||{productIDs:[],visitDate:"",businessUnitCode:""},i[e.businessUnitCode].productIDs.push(e.id),i[e.businessUnitCode].visitDate=e.parentInfo.visitDate,i[e.businessUnitCode].businessUnitCode=e.businessUnitCode,i),{}),e=Object.values(i).map(async i=>{let{data:e}=await (0,l.OA)(i.productIDs,I,R,i.visitDate,"",m,i.businessUnitCode);return e}),t=await Promise.all(e).then(i=>i),n=t.map(i=>i.Addons).flat(),o=n.map(i=>{var e;let{NormalAdults:t,DayStatus:n}=null===(e=null==i?void 0:i.Rates[0])||void 0===e?void 0:e.Calendar[0],o=String(n||"").toUpperCase(),s=T.filter(e=>e.id===i.Id&&e.businessUnitCode===i.BusinessUnit.Code);return{...s[0],price:t,priceFetched:!0,available:"OPEN"===o,variant:"adulto"}});L(o),x(()=>o),B(!1),"function"==typeof _&&_(o)};i()},[T,R]),(null==N?void 0:N.length)>0)?m?(0,n.jsx)(r.Z,{setLoading:k,currency_id:G,currency:R,language:I,setShopping:y,showNotification:O,shopping:A,products:N,itemLabels:U,productSpecialMessages:q,isMobile:m,host:j,validation:D,isActivities:!0,isLoadingPrices:E,infoGA4:M,metricasGA4:w}):(0,n.jsx)(u.Z,{setLoading:k,currency_id:G,currency:R,language:I,setShopping:y,showNotification:O,shopping:A,products:N,itemLabels:U,productSpecialMessages:q,isMobile:m,host:j,validation:D,isActivities:!0,isLoadingPrices:E,infoGA4:M,metricasGA4:w}):null};a.propTypes={isMobile:d().bool.isRequired,shopping:d().instanceOf(Object).isRequired,setShopping:d().func.isRequired,showNotification:d().func.isRequired,setLoading:d().func.isRequired,language:d().string.isRequired,currency:d().string.isRequired,currency_id:d().number.isRequired,itemLabels:d().instanceOf(Object).isRequired,productSpecialMessages:d().instanceOf(Object),productsComplements:d().instanceOf(Array).isRequired,host:d().string.isRequired,validation:d().instanceOf(Object).isRequired,infoGA4:d().instanceOf(Object).isRequired,getProductsForChildren:d().func,metricasGA4:d().instanceOf(Object),cbResults:d().func},a.defaultProps={getProductsForChildren:()=>{},metricasGA4:{},productSpecialMessages:[],cbResults:()=>{}},e.default=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.