1import{u as q,r as n,j as t,M as A,e as W}from"./index-5664YHSw.js";import{M as Z}from"./Map-O0z3OB1Q.js";import{B as V,S as H,G as J,a as Q,b as X,U as Y}from"./utensils-crossed-CSYc5W6a.js";import{N as K}from"./navigation-UjVys2mP.js";import"./usePersistFn-CDqEa8zC.js";const v=[{key:"transit_station",label:"交é",icon:V,color:"#F97316",types:["bus_station","transit_station","subway_station"]},{key:"shopping_mall",label:"åå ´",icon:H,color:"#2E7DD1",types:["shopping_mall","supermarket","convenience_store"]},{key:"school",label:"叿 ¡",icon:J,color:"#8B5CF6",types:["school","university","primary_school"]},{key:"hospital",label:"é«ç",icon:Q,color:"#D94545",types:["hospital","pharmacy","doctor"]},{key:"bank",label:"éè¡",icon:X,color:"#D97706",types:["bank","atm"]},{key:"restaurant",label:"é¤é£²",icon:Y,color:"#E8720C",types:["restaurant","cafe","food"]}];function ce({address:x,estateName:g}){const{t:D}=q(),u=n.useRef(null),h=n.useRef(null),[m,F]=n.useState(!1),[T,j]=n.useState(!1),[p,$]=n.useState("transit_station"),[I,P]=n.useState({}),i=n.useRef({}),[B,f]=n.useState(!1);function k(e,c,s){const l=v.find(r=>r.key===s);if(!l||i.current[s]!==void 0)return;i.current[s]=[],f(!0),new google.maps.places.PlacesService(e).nearbySearch({location:c,radius:800,type:l.types[0]},(r,y)=>{if(y===google.maps.places.PlacesServiceStatus.OK&&r&&r.length>0){const d=r.slice(0,5),b=d.map(o=>{const a=o.geometry?.location?google.maps.geometry.spherical.computeDistanceBetween(c,o.geometry.location):null,C=a!==null?a<100?"極è¿":a<500?`${Math.round(a)}ç±³`:`${(a/1e3).toFixed(1)}km`:"";return{name:o.name||"",distance:C,rating:o.rating,location:o.geometry?.location}});i.current[s]=b,P(o=>({...o,[s]:b})),f(!1);const E=d.filter(o=>o.geometry?.location).map(o=>o.geometry.location);E.length>0&&new google.maps.DistanceMatrixService().getDistanceMatrix({origins:[c],destinations:E,travelMode:google.maps.TravelMode.WALKING,unitSystem:google.maps.UnitSystem.METRIC},(a,C)=>{if(C==="OK"&&a?.rows[0]?.elements){const O=a.rows[0].elements;P(z=>
1{const _=(i.current[s]?.length?i.current[s]:b).map((R,L)=>{const M=O[L];if(M?.status==="OK"){const U=Math.ceil(M.duration.value/60);return{...R,walkTime:`æ¥è¡ ${U} åé`,distance:M.distance.text}}return R});return i.current[s]=_,{...z,[s]:_}})}}),d.slice(0,3).forEach(o=>{if(o.geometry?.location){const a=document.createElement("div");a.style.cssText=`width:10px;height:10px;background:${l.color};border-radius:50%;border:2px solid white;box-shadow:0 1px 4px rgba(0,0,0,0.3);`,new google.maps.marker.AdvancedMarkerElement({map:e,position:o.geometry.location,title:o.name,content:a})}})}else f(!1),i.current[s]=[],P(d=>({...d,[s]:[]}))})}function G(e){if(u.current=e,!x&&!g){j(!0);return}const c=x||g;new google.maps.Geocoder().geocode({address:`${c}, æ¾³é`},(l,N)=>{if(N==="OK"&&l&&l[0]){const r=l[0].geometry.location;h.current=r,e.setCenter(r),e.setZoom(16);const y=document.createElement("div");y.style.cssText="width:14px;height:14px;background:#F97316;border-radius:50%;border:3px solid white;box-shadow:0 2px 6px rgba(0,0,0,0.3);",new google.maps.marker.AdvancedMarkerElement({map:e,position:r,title:g||x,content:y}),F(!0),k(e,r,"transit_station")}else j(!0)})}n.useEffect(()=>{u.current&&h.current&&m&&k(u.current,h.current,p)},[p,m]);const w=I[p]||[],S=v.find(e=>e.key===p);return t.jsxs("div",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:147",className:"bg-white rounded-xl border border-gray-100 overflow-hidden",children:[t.jsxs("div",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:148",className:"px-5 py-4 flex items-center gap-2 border-b border-gray-50",children:[t.jsx(A,{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:149",size:17,className:"text-orange-600"}),t.jsx("h3",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:150",className:"text-base font-bold text-gray-900",children:D("å°åä½ç½®")}),m&&t.jsxs("button",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:152",className:"ml-auto flex items-center gap-1 text-xs text-orange-600 hover:underline",onClick:()=>window.open(`https://maps.google.com/?q=${encodeURIComponent((x||g)+", æ¾³é")}`,"_blank"),children:[t.jsx(K,{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:155",size:12}),"å°èª"]})]}),T?t.jsxs("div",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:160",className:"h-[260px] flex items-center justify-center text-gray-400 text-sm",children:[t.jsx(A,{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:161",size:20,className:"mr-2 opacity-40"}),"æªè½å®ä½å°å"]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:165",className:"h-[260px] relative",children:t.jsx(Z,{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:166",initialCenter:{lat:22.1987,lng:113.5439},initialZoom:14,onMapReady:G})}),t.jsx("div",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:173",className:"flex border-b border-gray-50 overflow-x-auto",children:v.map(e=>{const c=e.icon,s=p===e.key;return t.jsxs("button",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:178",onClick:()=>$(e.key),className:"flex flex-col items-center gap-0.5 px-4 py-2.5 whitespace-nowrap transition-colors",style:{borderBottom:s?`2px solid ${e.color}`:"2px solid transparent",background:s?`${e.color}08`:"transparent"},children:[t.jsx(c,{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:181",size:15,style:{color:s?e.color:"#9CA3AF"}}),t.jsx("span",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:182",className:"text-xs",style:{color:s?e.color:"#9CA3AF",fontWeight:s?600:400},children:e.label})]},e.key)})}),t.jsx("div",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:188",className:"min-h-[80px]",children:B?t.jsxs("div",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:190",className:"flex items-center justify-center py-6 text-gray-400",children:[t.jsx(W,{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:191",size:16,className:"animate-spin mr-2"}),"æ¥è©¢ä¸..."]}):w.length===0?t.jsx("div",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:194",className:"flex items-center justify-center py-6 text-gray-400 text-sm",children:m?`éè¿æªæ¾å°${S.label}è¨æ½`:"å®ä½ä¸..."}):w.map((e,c)=>t.jsxs("div",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:199",className:"px-5 py-3 flex items-center justify-between",style:{borderTop:c>0?"1px solid rgba(0,0,0,0.04)":"none"},children:[t.jsxs("div",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:200",className:"flex items-center gap-2",children:[t.jsx("div",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:201",className:"w-1.5 h-1.5 rounded-full",style:{background:S.color}}),t.jsx("span",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:202",className:"text-sm text-gray-700",children:e.name}),e.rating&&t.jsxs("span",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:203",className:"text-xs text-amber-500",children:["â
",e.rating.toFixed(1)]})]}),t.jsxs("div",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:205",className:"text-right",children:[e.walkTime?t.jsx("span",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:207",className:"text-xs font-medium",style:{color:S.color},children:e.walkTime}):t.jsx("span",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:209",className:"text-xs text-gray-400",children:e.distance}),e.walkTime&&e.distance&&t.jsx("p",{"data-loc":"client\\src\\pages\\pc\\PCPropertyMapSection.tsx:212",className:"text-xs text-gray-400",children:e.distance})]})]},c))})]})]})}export{ce as PropertyMapSection};
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.