import{a as e}from"./rolldown-runtime-C_ttsnZz.js";import{St as o,q as t}from"./index-BT8Vuu3B.js";import{n as r}from"./context-BrD4AniQ-_nW8oMsv.js";import{i as l,t as i}from"./constants-DOpa8YMW-CAHGepUD.js";import{n as a}from"./esm-Be30MpcN-ls4GMpDI.js";import{t as n}from"./esm-k7KI3vER-DWALg7MX.js";import{n as s,o as m,r as c}from"./maplibre-CUYkxr-D-BaX6BEaK.js";var p=e(o(),1),u=t(),C={en:{"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},fr:{"AttributionControl.ToggleAttribution":"Afficher/Masquer l’attribution","AttributionControl.MapFeedback":"Retour sur la carte","FullscreenControl.Enter":"Passer en plein écran","FullscreenControl.Exit":"Quitter le plein écran","GeolocateControl.FindMyLocation":"Trouver ma position","GeolocateControl.LocationNotAvailable":"Position non disponible","LogoControl.Title":"Logo MapLibre","Map.Title":"Carte","Marker.Title":"Marqueur de carte","NavigationControl.ResetBearing":"Réinitialiser l’orientation au nord","NavigationControl.ZoomIn":"Zoomer","NavigationControl.ZoomOut":"Dézoomer","Popup.Close":"Fermer la fenêtre","ScaleControl.Feet":"pi","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"mn","GlobeControl.Enable":"Activer le globe","GlobeControl.Disable":"Désactiver le globe","TerrainControl.Enable":"Activer le relief","TerrainControl.Disable":"Désactiver le relief","CooperativeGesturesHandler.WindowsHelpText":"Utilisez Ctrl + défilement pour zoomer sur la carte","CooperativeGesturesHandler.MacHelpText":"Utilisez ⌘ + défilement pour zoomer sur la carte","CooperativeGesturesHandler.MobileHelpText":"Utilisez deux doigts pour déplacer la carte"}},b=()=>{let{current:e}=m(),{centerPinMarkerPoints:o,markerPoints:t,locationBoundary:l,setZoom:i,mapPadding:s}=r(),[c,u]=(0,p.useState)(void 0),C=(0,p.useRef)(void 0),b=(0,p.useCallback)(()=>{e&&i(e.getZoom())},[e,i]);return(0,p.useEffect)(()=>(b(),e?.on("zoom",b),()=>{e?.off("zoom",b)}),[e,b]),(0,p.useEffect)(()=>{if(!e)return;let r=[];if(void 0!==l&&l.length>0?r.push(...l):void 0!==t&&t.length>0?(r.push(...t),o&&r.push(o)):void 0!==o&&r.push(o),0===r.length)return;let i=n(a(r));(!C.current||!i.every((e,o)=>e===C.current?.[o]))&&(C.current=i,u(i))},[e,t,l,o]),(0,p.useEffect)(()=>{if(!e||void 0===c)return;let[o,t,r,l]=c,i=.1*(r-o)||.001,a=.1*(l-t)||.001;e.fitBounds([[o-i,t-a],[r+i,l+a]],{padding:s,maxZoom:17,duration:700})},[e,c,s]),null};function d({children:e}){let{mapProvider:o,locale:t,center:a,zoom:n=i.zoom,minZoom:m,maxZoom:p,pitch:d=i.pitch,bearing:f=i.bearing,cooperativeGestures:g=i.cooperativeGestures,zoomPosition:v}=r();return"maptiler"===o.name?(0,u.jsxs)(c,{initialViewState:{...a,zoom:n,pitch:d,bearing:f},cooperativeGestures:g,minZoom:m,maxZoom:p,mapStyle:`https://api.maptiler.com/maps/${o.theme||l.maptiler}/style.json?key=${o.apiKey}`,locale:C[t],children:[(0,u.jsx)(b,{}),v&&(0,u.jsx)(s,{position:v}),e]}):null}export{d as default};
//# sourceMappingURL=Maptiler-Cy2r6w4G-CzCt19kA.js.map