1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[817],{4817:function(e,t,r){r.r(t),r.d(t,{GoogleMapsPanel:function(){return p}});var a=r(7437),n=r(2265),o=r(5706);let l={stays:["lodging"],restaurants:["restaurant"],attraction:["tourist_attraction"],activities:["park"],locations:["point_of_interest"]},s="places-search:",c=new Map,i=new Map;function u(e){return!!(e&&Date.now()-e.timestamp<6e5)}async function d(e,t){var r,a;let n=t.type?l[t.type]:void 0,o=(r=t.radius)?r<100?100:r>4e3?4e3:r:2e3,d=[t.location.lat.toFixed(4),t.location.lng.toFixed(4),t.type||"all",o,(null===(a=t.keyword)||void 0===a?void 0:a.trim().toLowerCase())||""].join("_"),f=function(e){let t=c.get(e);if(u(t))return t.value;let r=function(e){try{let t=window.sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return null}}("".concat(s).concat(e));return r&&u(r)?(c.set(e,r),r.value):null}(d);if(f)return f;let p=i.get(d);if(p)return p;let g=new google.maps.places.PlacesService(e),h=new google.maps.LatLng(t.location.lat,t.location.lng),m=(async()=>{let e=new Map,r=t.keyword?[t.keyword]:[void 0];for(let t of n&&n.length>0?n:[void 0])for(let a of r){let r={location:h,radius:o,type:t,keyword:a};try{for(let t of(await function(e,t){return new Promise((r,a)=>{e.nearbySearch(t,(e,t)=>{t===google.maps.places.PlacesServiceStatus.OK&&e?r(e):t===google.maps.places.PlacesServiceStatus.ZERO_RESULTS?r([]):a(Error("Places search failed: ".concat(t)))})})}(g,r)))t.place_id&&e.set(t.place_id,t)}catch(e){continue}}let a=Array.from(e.values()).map(e=>(function(e,t){var r,a,n;let o=null===(r=e.geometry)||void 0===r?void 0:r.location;return{id:e.place_id||"place_".concat(Date.now(),"_").concat(Math.random().toString(36).slice(2,11)),name:e.name||"Unknown",type:t||function(e){for(let[t,r]of Object.entries(l))if(e.some(e=>r.includes(e)))return t;return"locations"}(e.types||[]),location:{lat:(null==o?void 0:o.lat())||0,lng:(null==o?void 0:o.lng())||0},address:e.vicinity||e.formatted_address,rating:e.rating,priceLevel:e.price_level,photoUrl:null===(n=e.photos)||void 0===n?void 0:null===(a=n[0])||void 0===a?void 0:a.getUrl({maxWidth:400}),placeId:e.place_id}})(e,t.type));return!function(e,t){let r={timestamp:Date.now(),value:t};c.set(e,r),function(e,t){try{window.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){}}("".concat(s).concat(e),r)}(d,a),a})();i.set(d,m);try{return await m}finally{i.delete(d)}}function f(e){return e?e.replace(/\*\*\*/g,"").replace(/\*\*/g,"").replace(/\*/g,"").replace(/___/g,"").replace(/__/g,"").replace(/_/g," ").replace(/#{1,6}\s/g,"").replace(/`{3}[\s\S]*?`{3}/g,"").replace(/`/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^[-*+]\s/gm,"").replace(/^\d+\.\s/gm,"").replace(/^>\s/gm,"").replace(/\n{3,}/g,"\n\n").trim():""}let p=n.memo(function(e){let{locations:t,places:r=[],days:l=[],center:s={lat:15.87,lng:100.9925},zoom:c=6,onPlaceClick:i,selectedLocationId:u,selectedPlaceId:p}=e,g=(0,n.useRef)(null),h=(0,n.useRef)(null),m=(0,n.useRef)([]),x=(0,n.useRef)([]),v=(0,n.useRef)(""),y=(0,n.useRef)(null),b=(0,n.useRef)(null),w=(0,n.useRef)(""),j=(0,n.useRef)(!1),k=(0,n.useRef)([]),C=(0,n.useRef)(null),[N,L]=(0,n.useState)(!0),[E,_]=(0,n.use
1State)([]),[I,S]=(0,n.useState)(!1),[M,P]=(0,n.useState)({all:!0,stays:!1,restaurants:!1,attraction:!1,activities:!1,locations:!1,showPrices:!1}),F=(0,n.useCallback)(()=>{let e=[];return l.forEach((t,r)=>{(t.places||[]).forEach((t,a)=>{if(!e.find(e=>e.name===t.name)){var n;e.push({...t,id:t.id||"day".concat(r,"_place").concat(a,"_").concat((null!==(n=t.name)&&void 0!==n?n:"").toLowerCase().replace(/\s+/g,"_"))})}})}),e},[l]);(0,n.useEffect)(()=>{if(g.current&&"undefined"!=typeof google&&google.maps&&!h.current){let e=new google.maps.Map(g.current,{center:s,zoom:c,mapTypeId:google.maps.MapTypeId.ROADMAP,mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!1,zoomControl:!0,styles:[{featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]}]});h.current=e,j.current=!0}},[]),(0,n.useEffect)(()=>{if(!h.current||!j.current)return;let e=JSON.stringify(t.map(e=>({id:e.id,lat:e.coordinates.lat,lng:e.coordinates.lng})));if(e===v.current)return;v.current=e;let r=h.current;if(k.current.forEach(e=>e.close()),k.current=[],x.current.forEach(e=>e.setMap(null)),x.current=[],m.current.filter(e=>!e.place&&e.location).forEach(e=>{let{marker:t}=e;return null==t?void 0:t.setMap(null)}),m.current=m.current.filter(e=>e.place||!e.location),t.filter(e=>e.coordinates&&0!==e.coordinates.lat&&0!==e.coordinates.lng).forEach(e=>{let t=new google.maps.Marker({position:e.coordinates,map:r,title:f(e.name),icon:{path:google.maps.SymbolPath.CIRCLE,scale:10,fillColor:"#2f4f93",fillOpacity:1,strokeColor:"#ffffff",strokeWeight:3},zIndex:1e3}),a=new google.maps.InfoWindow({content:'<div style="padding: 8px; font-family: Poppins, sans-serif;">\n <strong style="color: #2f4f93; font-size: 14px;">'.concat(f(e.name),"</strong>\n </div>")});t.addListener("click",()=>{var n;k.current.forEach(e=>e.close()),a.open(r,t),null===(n=h.current)||void 0===n||n.panTo(e.coordinates)}),k.current.push(a),m.current.push({location:e,marker:t})}),!u){let e=t.filter(e=>e.coordinates&&0!==e.coordinates.lat&&0!==e.coordinates.lng);if(e.length>1){let t=new google.maps.LatLngBounds;e.forEach(e=>t.extend(e.coordinates));
1let a=t.getNorthEast(),n=t.getSouthWest(),o=Math.abs(a.lat()-n.lat()),l=Math.abs(a.lng()-n.lng());if(o>10||l>10)r.setCenter(e[0].coordinates),r.setZoom(8);else{r.fitBounds(t,{top:50,right:50,bottom:50,left:50});let e=google.maps.event.addListener(r,"bounds_changed",()=>{r.getZoom()&&6>r.getZoom()&&r.setZoom(6),google.maps.event.removeListener(e)})}}else 1===e.length&&(r.setCenter(e[0].coordinates),r.setZoom(c||12))}},[t,u,c]),(0,n.useEffect)(()=>{if(!h.current||!j.current||!u)return;let e=t.find(e=>e.id===u);if(!(null==e?void 0:e.coordinates))return;let{lat:r,lng:a}=e.coordinates;if(0===r&&0===a)return;let n=h.current.getCenter();(!y.current||Math.abs(y.current.lat-r)>.001||Math.abs(y.current.lng-a)>.001||Math.abs(((null==n?void 0:n.lat())||0)-r)>.01||Math.abs(((null==n?void 0:n.lng())||0)-a)>.01)&&(y.current={lat:r,lng:a},h.current.panTo({lat:r,lng:a}),h.current.setZoom(14))},[u,t]),(0,n.useEffect)(()=>{if(!h.current||!j.current)return;let e=!y.current||Math.abs(y.current.lat-s.lat)>.001||Math.abs(y.current.lng-s.lng)>.001,t=null===b.current||b.current!==c;e&&!u&&(y.current=s,h.current.panTo(s)),t&&!u&&(b.current=c,h.current.setZoom(c))},[s,c,u]),(0,n.useEffect)(()=>{h.current&&(k.current.forEach(e=>e.close()),k.current=[],m.current.forEach(e=>{let{marker:t,place:r}=e;t&&r&&t.setMap(null)}),m.current=m.current.filter(e=>e.location),[...r,...E,...F()].filter((e,t,r)=>t===r.findIndex(t=>!!t.id&&!!e.id&&t.id===e.id||!!t.placeId&&!!e.placeId&&t.placeId===e.placeId||t.name.toLowerCase()===e.name.toLowerCase())).filter(e=>{if(M.all)return!0;if(!(M.stays||M.restaurants||M.attraction||M.activities||M.locations))return!1;switch(e.type){case"stays":return M.stays;case"restaurants":return M.restaurants;case"attraction":return M.attraction;case"activities":return M.activities;default:return M.locations}}).forEach(e=>{if(!e.location||0===e.location.lat||0===e.location.lng)return;let t=new google.maps.Marker({position:e.location,map:h.current,title:f(e.name),icon:R(e.type,!!e.id&&e.id===p),zIndex:e.id&&e.id===p?200:100}),r=new google.maps.InfoWindow({content:'<div style="padding: 10px; font-family: Poppins, sans-serif; max-width: 200px;">\n <strong style="color: #2f4f93; font-size: 14px;">'.concat(f(e.name),'</strong>\n <div style="color: #888; font-size: 11px; margin-top: 4px; text-transform: uppercase;">').concat(D(e.type),"</div>\n ").concat(e.rating?'<div style="color: #666; font-size: 12px;">â '.concat(e.rating,"</div>"):"","\n ").concat(e.address?'<div style="color: #666; font-size: 12px; margin-top: 4px;">'.concat(e.address,"</div>"):"","\n </div>")});t.addListener("click",()=>{var a;k.current.forEach(e=>e.close()),r.open(h.current,t),null===(a=h.current)||void 0===a||a.panTo(e.location),i&&i(e)}),k.current.push(r),m.current.push({place:e,marker:t})}))},[r,E,M,i,F,p]),(0,n.useEffect)(()=>{if(!u||!h.current||0===t.length){w.current="",_([]);return}let e=t.find(e=>e.id===u);if(!(null==e?void 0:e.coordinates)){w.current="",_([]);return}let{lat:r,lng:a}=e.coordinates;if(0===r&&0===a){w.current="",_([]);return}let n="".concat(r.toFixed(4),"_").concat(a.toFixed(4));if(n===w.current)return;w.current=n;let o=f(e.name).toLowerCase();if(["city","town","province","state","region","country","district","prefecture"].some(e=>o.includes(e))){_([]);return}_([]);let l=setTimeout(()=>{S(!0),Promise.all([d(h.current,{location:{lat:r,lng:a},radius:5e3,type:"attraction"}).catch(()=>[]),d(h.current,{location:{lat:r,lng:a},radius:3e3,type:"restaurants"}).catch(()=>[]),d(h.current,{location:{lat:r,lng:a},radius:3e3,type:"stays"}).catch(()=>[])]).then(e=>{let[t,r,a]=e;_([...t,...r,...a].reduce((e,t)=>(e.find(e=>!!e.placeId&&!!t.placeId&&e.placeId===t.placeId||"".concat(e.name.toLowerCase(),"_").concat(e.location.lat.toFixed(5),"_").concat(e.location.lng.toFixed(5))==="".concat(t.name.toLowerCase(),"_").concat(t.location.lat.toFixed(5),"_").concat(t.location.lng.toFixed(5)))||e.push(t),e),[]))}).catch(()=>_([])).finally(()=>S(!1))},300);return()=>clearTimeout(l)},[u,t]);let R=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r={stays:"#FF6B6B",restaurants:"#4ECDC4",attraction:"#FFD93D",activities:"#95E1D3",locations:"#2f4f93"};return t?{path:google.maps.SymbolPath.CIRCLE,scale:11,fillColor:r[e]||"#2f4f93",fillOpacity:.95,strokeColor:"#2f4f93",strokeWeight:3}:{path:google.maps.SymbolPath.CIRCLE,scale:7,fillColor:r[e]||"#2f4f93",fillOpacity:.9,strokeColor:"#ffffff",strokeWeight:2}};(0,n.useEffect)(()=>{var e;if(!h.current)return;if(C.current){let{marker:e,place:t}=C.current;e.setIcon(R(t.type,!1)),e.setZIndex(100),C.current=null}if(!p)return;let t=m.current.find(e=>{var t;return(null===(t=e.place)||void 0===t?void 0:t.id)===p});(null==t?void 0:t.place)&&(t.marker.setIcon(R(t.place.type,!0)),t.marker.setZIndex(200),C.current={marker:t.marker,place:t.place},h.current.panTo(t.marker.getPosition()),(null!==(e=h.current.getZoom())&&void 0!==e?e:0)<16&&h.current.setZoom(16))},[p]);let D=e=>({stays:"Accommodation",restaurants:"Restaurant",attraction:"Attraction",activities:"Activity",locations:"Location"})[e]||"Place",z=(0,n.useMemo)(()=>{let e=[...r,...E,...F()].filter((e,t,r)=>t===r.findIndex(t=>!!t.id&&!!e.id&&t.id===e.id||!!t.placeId&&!!e.placeId&&t.placeId===e.placeId||t.n
1ame.toLowerCase()===e.name.toLowerCase()));return{stays:e.filter(e=>"stays"===e.type).length,restaurants:e.filter(e=>"restaurants"===e.type).length,attraction:e.filter(e=>"attraction"===e.type).length,activities:e.filter(e=>"activities"===e.type).length,locations:e.filter(e=>"locations"===e.type).length,total:e.length}},[r,E,F]),O=(0,n.useCallback)(e=>P(e),[]);return(0,a.jsxs)("div",{className:"relative w-full h-full",children:[(0,a.jsx)("div",{ref:g,className:"w-full h-full"}),(0,a.jsx)("div",{className:"absolute top-0 left-0 right-0 h-[201px] pointer-events-none",style:{background:"linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0) 100%)"}}),I&&(0,a.jsx)("div",{className:"absolute top-20 left-1/2 -translate-x-1/2 bg-white px-4 py-2 rounded-full shadow-lg z-20",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-4 h-4 border-2 border-[#2f4f93] border-t-transparent rounded-full animate-spin"}),(0,a.jsx)("span",{className:"text-sm text-[#475f73]",children:"Loading places..."})]})}),(0,a.jsx)(o.O,{filters:M,onFilterChange:O,onClose:()=>L(!1),isOpen:N,placeCounts:z}),!N&&(0,a.jsx)("button",{onClick:()=>L(!0),className:"absolute right-4 top-4 z-10 bg-white rounded-full p-3 shadow-lg hover:bg-gray-50 transition-colors",children:(0,a.jsx)("svg",{className:"w-5 h-5 text-[#475f73]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})})}),(0,a.jsxs)("div",{className:"absolute bottom-4 left-4 bg-white rounded-lg shadow-lg p-3 z-10",children:[(0,a.jsx)("p",{className:"text-[10px] text-[#a7b8c7] uppercase tracking-wide mb-2 font-medium",children:"Legend"}),(0,a.jsx)("div",{className:"space-y-1.5",children:[{color:"#2f4f93",label:"Locations"},{color:"#FFD93D",label:"Attractions"},{color:"#4ECDC4",label:"Restaurants"},{color:"#FF6B6B",label:"Stays"},{color:"#95E1D3",label:"Activities"}].map(e=>{let{color:t,label:r}=e;return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:t}}),(0,a.jsx)("span",{className:"text-xs text-[#475f73]",children:r})]},r)})})]})]})})},5706:function(e,t,r){r.d(t,{O:function(){return o}});var a=r(7437),n=r(3145);function o(e){let{filters:t,onFilterChange:r,onClose:n,isOpen:o,placeCounts:s}=e,c=e=>{if("all"===e)r({all:!0,stays:!1,restaurants:!1,attraction:!1,activities:!1,locations:!1,showPrices:t.showPrices});else if("showPrices"===e)r({...t,showPrices:!t.showPrices});else{let a=!t[e],n={...t,all:!1,[e]:a};n.stays||n.restaurants||n.attraction||n.activities||n.locations||(n.all=!0),r(n)}},i=function(e){if(e.all)return 0;let t=0;return e.stays&&t++,e.restaurants&&t++,e.attraction&&t++,e.activities&&t++,e.locations&&t++,t}(t);return o?(0,a.jsxs)("div",{className:"absolute right-4 top-4 z-10 flex flex-col items-end gap-3",children:[(0,a.jsxs)("button",{onClick:n,className:"flex items-center gap-1.5 rounded-full bg-white px-3 py-2 shadow-lg hover:bg-gray-50 transition-colors border border-gray-100",children:[(0,a.jsx)("span",{className:"text-sm text-[#475f73] font-medium",children:"Close"}),(0,a.jsx)("svg",{className:"w-4 h-4 text-[#475f73]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]}),(0,a.jsxs)("div",{className:"bg-white rounded-xl shadow-lg p-4 flex flex-col gap-3 min-w-[180px] border border-gray-100",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between pb-2 border-b border-gray-100",children:[(0,a.jsx)("span",{className:"text-sm font-semibold text-[#132341]",children:"Filters"}),i>0&&(0,a.jsx)("span",{className:"text-xs bg-[#2f4f93] text-white px-2 py-0.5 rounded-full",children:i})]}),(0,a.jsxs)("button",{onClick:()=>c("all"),className:"flex items-center gap-2.5 px-2 py-1.5 rounded-lg transition-all ".concat(t.all?"bg-[#2f4f93]/10":"hover:bg-gray-50"),children:[(0,a.jsx)("div",{className:"w-5 h-5 flex items-center justify-center",children:t.all?(0,a.jsx)("div",{className:"w-4 h-4 rounded-full border-2 border-[#2f4f93] flex items-center justify-center bg-white",children:(0,a.jsx)("div",{className:"w-2 h-2 rounded-full bg-[#2f4f93]"})}):(0,a.jsx)("div",{className:"w-4 h-4 rounded-full border-2 border-gray-300"})}),(0,a.jsx)("span",{className:"text-sm flex-1 text-left ".concat(t.all?"text-[#2f4f93] font-medium":"text-[#475f73]"),children:"Show All"}),s&&s.total>0&&(0,a.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded-full font-medium ".concat(t.all?"bg-[#2f4f93] text-white":"bg-gray-100 text-[#7286b0]"),children:s.total})]}),(0,a.jsx)("div",{className:"h-px bg-gray-100"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)(l,{label:"Stays",icon:"/assets/bookmark-bag.svg",color:"#FF6B6B",checked:t.stays,count:null==s?void 0:s.stays,onChange:()=>c("stays")}),(0,a.jsx)(l,{label:"Restaurants",icon:"/assets/stat-0.svg",color:"#4ECDC4",checked:t.restaurants,count:null==s?void 0:s.restaurants,onChange:()=>c("restaurants")}),(0,a.jsx)(l,{label:"Attractions",icon:"/assets/travel-explore.svg",color:"#FFD93D",checked:t.attraction,count:null==s?void 0:s.attraction,onChange:()=>c("attraction")}),(0,a.jsx)(l,{label:"Activities",icon:"/assets/explore.svg",color:"#95E1D3",checked:t.activities,count:null==s?void 0:s.activities,onChange:()=>c("activities")}),(0,a.jsx)(l,{label:"Locations",icon:"/assets/logo-icon.svg",color:"#2f4f93",checked:t.locations,count:null==s?void 0:s.locations,onChange:()=>c("locations")})]}),(0,a.jsx)("div",{className:"h-px bg-gray-100"}),(0,a.jsxs)("button",{onClick:()=>c("showPrices"),className:"flex items-center gap-2.5 px-2 py-1.5 rounded-lg transition-all ".concat(t.showPrices?"bg-[#2f4f93]/10":"hover:bg-gray-50"),children:[(0,a.jsx)("div",{className:"relative w-8 h-[18px] rounded-full shrink-0 transition-colors ".concat(t.showPrices?"bg-[#2f4f93]":"bg-gray-300"),children:(0,a.jsx)("div",{className:"absolute top-0.5 left-0.5 w-[14px] h-[14px] rounded-full bg-white shadow transition-transform ".concat(t.showPrices?"translate-x-[14px]":"translate-x-0")})}),(0,a.jsx)("span",{className:"text-sm ".concat(t.showPrices?"text-[#2f4f93] font-medium":"text-[#475f73]"),children:"Show prices"})]})]})]}):null}function l(e){let{label:t,icon:r,color:o,checked:l,count:s,onChange:c}=e;return(0,a.jsxs)("button",{onClick:c,className:"flex items-center gap-2.5 px-2 py-1.5 rounded-lg transition-all w-full ".concat(l?"bg-gray-50":"hover:bg-gray-50"),children:[(0,a.jsx)("div",{className:"w-5 h-5 flex items-center justify-center shrink-0",children:l?(0,a.jsx)("div",{className:"w-4 h-4 rounded flex items-center justify-center",style:{backgroundColor:o},children:(0,a.jsx)("svg",{className:"w-3 h-3 text-white",viewBox:"0 0 12 12",fill:"none",children:(0,a.jsx)("path",{d:"M2 6L5 9L10 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}):(0,a.jsx)("div",{className:"w-4 h-4 border-2 border-gray-300 rounded"})}),(0,a.jsx)("div",{className:"w-4 h-4 rounded-full flex items-center justify-center shrink-0",style:{backgroundColor:l?o:"#e5eaf0"},children:(0,a.jsx)(n.default,{src:r,alt:t,width:10,height:10,className:l?"brightness-0 invert":"opacity-50"})}),(0,a.jsx)("span",{className:"text-sm flex-1 text-left ".concat(l?"text-[#132341] font-medium":"text-[#475f73]"),children:t}),"number"==typeof s&&s>0&&(0,a.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded-full font-medium shrink-0",style:{backgroundColor:l?o:"#f0f4f8",color:l?"#fff":"#7286b0"},children:s})]})}}}]);
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.