PageSourceSearch

https://www.euholidays.com.sg/_next/static/chunks/app/collections/%5Bslug%5D/page-a5a53e89d9ae3c1d.js

js euholidays.com.sg collected 2026-09-28 12:49:37 UTC 5,191 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9008],{16390:(e,t,s)=>{"use strict";s.d(t,{CollectionPageClient:()=>c});var a=s(95155),r=s(12115),o=s(15239),i=s(41857),l=s(55866),n=s(95590),d=s(77023);function c(e){let{collection:t,initialTours:s,slug:c}=e,[u,x]=(0,r.useState)(s),[h,m]=(0,r.useState)(1),[g,p]=(0,r.useState)(1),[v,b]=(0,r.useState)(s.length),[y,j]=(0,r.useState)(!1),[f,N]=(0,r.useState)(null),[w,P]=(0,r.useState)(),C=(0,r.useCallback)(async function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;j(!0),N(null),e&&P(e);let a=e||w;try{var r;let e=(t.items||t.tours||[]).filter(e=>!1!==e.active&&(e.tourId||e.id)).map(e=>e.tourId||e.id).join(",")||"";if(!e){x([]),p(1),b(0),m(1);return}let o=await fetch("/api/tour/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({search:(null==a?void 0:a.searchQuery)||"",tourIds:e,sectorIds:(null==a?void 0:a.destination)&&"all"!==a.destination?a.destination:"",startDuration:(null==a?void 0:a.duration)?a.duration.split("-")[0].replace(/\D/g,""):"0",endDuration:(null==a?void 0:a.duration)?a.duration.includes("+")?"999":(null==(r=a.duration.split("-")[1])?void 0:r.replace(/\D/g,""))||"0":"0",startPrice:parseInt((null==a?void 0:a.minPrice)||"0")||0,endPrice:parseInt((null==a?void 0:a.maxPrice)||"0")||0,date:"",type:0,sort:+((null==a?void 0:a.sortBy)==="price"||(null==a?void 0:a.sortBy)==="Price: Low to High"),sortType:+((null==a?void 0:a.sortBy)!=="Price: High to Low"),currentPage:s-1,pageSize:12,tags:(null==a?void 0:a.holidayType)||"",tagMode:"OR"})});if(!o.ok)throw Error("Failed to fetch tours");let i=await o.json();x(i.tours||[]),p(i.totalPages||1),b(i.total||0),m(s)}catch(e){console.error("Error fetching tours:",e),N("Failed to load tours. Please try again."),x([]),p(1),b(0)}finally{j(!1)}},[t.items,t.tours,w,12]),S=(0,r.useCallback)(e=>{C({searchQuery:e.searchQuery||"",destination:e.destination||"",from:"",to:"",holidayType:e.holidayType||"",duration:e.duration||"",minPrice:e.minPrice||"0",maxPrice:e.maxPrice||"0",sortBy:e.sortBy||""},1)},[C]),k=(0,r.useCallback)(e=>{C(void 0,e),window.scrollTo({top:0,behavior:"smooth"})},[C]);(0,r.useEffect)(()=>{0===s.length&&C()},[C,s.length]);let I=t.sectionConfig.title&&t.sectionConfig.subtitle,T=(0,a.jsxs)("div",{className:"relative h-[400px] lg:h-[500px] flex items-center justify-center overflow-hidden bg-gray-900",children:[t.coverImage?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.default,{src:t.coverImage,alt:t.sectionConfig.title,fill:!0,className:"object-cover z-0",priority:!0,onError:e=>{console.error("Image failed to load:",t.coverImage)},onLoad:()=>{}}),I&&(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 z-10"})]}):(0,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-600 to-purple-600 z-0"}),(0,a.jsxs)("div",{className:"relative z-20 text-center text-white px-4 max-w-4xl mx-auto",children:[(0,a.jsx)("h1",{className:"text-4xl lg:text-6xl font-thunder font-normal mb-4 drop-shadow-lg",children:t.sectionConfig.title}),t.sectionConfig.subtitle&&(0,a.jsx)("p",{className:"text-lg lg:text-xl opacity-90 max-w-2xl mx-auto drop-shadow-md",children:t.sectionConfig.subtitle}),t.description&&(0,a.jsx)("p",{className:"text-base lg:text-lg opacity-80 max-w-3xl mx-auto mt-4 drop-shadow-md",children:t.description})]})]});return(0,a.jsx)(i.LayoutWithHero,{hero:T,children:(0,a.jsxs)("div",{className:"container mx-auto px-4 py-8",children:[(0,a.jsx)("div",{className:"mb-8",children:(0,a.jsx)(l.S,{onSearch:S})}),(0,a.jsx)("div",{className:"flex items-center justify-between mb-6",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-2xl font-semibold text-gray-900",children:t.name}),(0,a.jsx)("p",{className:"text-gray-600 mt-1",children:y?"Loading...":"".concat(v," tour").concat(1!==v?"s":""," found")})]})}),f&&(0,a.jsxs)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 mb-6",children:[(0,a.jsx)("p",{className:"text-red-600",children:f}),(0,a.jsx)("button",{onClick:()=>C(),className:"mt-2 text-red-700 hover:text-red-800 underline",children:"Try again"})]}),(0,a.jsx)("div",{className:"mb-8",children:(0,a.jsx)(n.u,{tours:u,totalCount:v,isLoading:y})}),!y&&0===u.length&&!f&&(0,a.jsx)("div",{className:"text-center py-12",children:(0,a.jsxs)("div",{className:"max-w-md mx-auto",children:[(0,a.jsx)("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No tours found"}),(0,a.jsx)("p",{className:"text-gray-600 mb-4",children:"Try adjusting your search criteria or browse all tours."}),(0,a.jsx)("button",{onClick:()=>C(),className:"bg-blue-600 text-white px-6 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:"Show all tours"})]})}),g>1&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"hidden md:block",children:(0,a.jsx)(d.u,{currentPage:h,totalPages:g,onPageChange:k})}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(d.Y,{currentPage:h,totalPages:g,onPageChange:k})})]})]})})}},96577:(e,t,s)=>{Promise.resolve().then(s.bind(s,16390))}},e=>{e.O(0,[4909,2619,3729,9566,7191,3424,9569,1596,8204,9590,6980,1361,1275,7550,2907,573,8441,1255,7358],()=>e(e.s=96577)),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.