import{a as e}from"./rolldown-runtime-C_ttsnZz.js";import{St as t,q as o}from"./index-BT8Vuu3B.js";import{o as r,r as n,s,t as i}from"./index.modern-tyEdEbjo.js";import{n as a}from"./context-BrD4AniQ-_nW8oMsv.js";import{i as l,r as d,t as m}from"./constants-DOpa8YMW-CAHGepUD.js";import{n as u}from"./esm-Be30MpcN-ls4GMpDI.js";import{t as p}from"./esm-k7KI3vER-DWALg7MX.js";var f=e(t(),1),c=o(),g={"top-left":n.LEFT_TOP,"top-right":n.RIGHT_TOP,"bottom-left":n.LEFT_BOTTOM,"bottom-right":n.RIGHT_BOTTOM},h=({isMapLoaded:e})=>{let t=s(),{centerPinMarkerPoints:o,markerPoints:r,locationBoundary:n,setZoom:i,mapPadding:l}=a(),[m,c]=(0,f.useState)(void 0),g=(0,f.useRef)(void 0),h=(0,f.useCallback)(()=>{if(!t)return;let e=t.getZoom();void 0!==e&&i(e+1)},[t,i]);return(0,f.useEffect)(()=>{h();let e=t?.addListener("zoom_changed",h);return()=>{e?.remove()}},[t,h]),(0,f.useEffect)(()=>{if(!t)return;let e=[];void 0!==n&&n.length>0?e.push(...n):void 0!==r&&r.length>0?(e.push(...r),o&&e.push(o)):void 0!==o&&e.push(o);let s=0===e.length?d:p(u(e));(!g.current||!s.every((e,t)=>e===g.current?.[t]))&&(g.current=s,c(s))},[t,r,n,o]),(0,f.useEffect)(()=>{if(!t||void 0===m)return;let[e,o,r,n]=m,s=.1*(r-e)||.001,i=.1*(n-o)||.001;t.fitBounds({south:o-i,west:e-s,north:n+i,east:r+s},l)},[e,t,m,l]),null};function v({children:e}){let[t,o]=(0,f.useState)(!1),[n,s]=(0,f.useState)(!1),{mapProvider:u,mapPadding:p,locale:v,center:T,zoom:x=m.zoom,minZoom:y,maxZoom:j,pitch:P=m.pitch,bearing:b=m.bearing,cooperativeGestures:B=m.cooperativeGestures,zoomPosition:L}=a();return(0,f.useEffect)(()=>{if(!n)return;let e=document.querySelector(".gm-style-moc");e&&p&&(e.style.paddingLeft=`${p.left}px`,e.style.paddingRight=`${p.right}px`)},[n,p?.left,p?.right]),"google"===u.name?(0,c.jsx)(i,{apiKey:u.apiKey,language:v,onLoad:()=>{o(!0)},children:t&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(h,{isMapLoaded:n}),(0,c.jsx)(r,{mapId:u.theme||l.google,defaultCenter:{lat:T.latitude,lng:T.longitude},defaultBounds:{north:d[3],south:d[1],east:d[2],west:d[0]},defaultZoom:x+1,defaultTilt:P,defaultHeading:b,gestureHandling:B?"cooperative":"greedy",streetViewControl:!1,fullscreenControl:!1,clickableIcons:!1,mapTypeControl:!1,zoomControlOptions:{position:L&&g[L]},minZoom:"number"==typeof y?y+1:void 0,maxZoom:"number"==typeof j?j+1:void 0,onTilesLoaded:()=>{s(!0)},children:e})]})}):null}export{v as default};
//# sourceMappingURL=Google-D1kMMDIv-DbG7pnRv.js.map