{"version":3,"file":"bounding-box-controller-7SX79yh-.js","sources":["../../../app/frontend/entrypoints/admin/components/locations/components/google-maps/bounding-box-controller.jsx"],"sourcesContent":["import React, { useState, useEffect } from 'react'\nimport { useMap } from '@vis.gl/react-google-maps';\n\nexport default function BoundingBoxController({position, markers}) {\n const map = useMap();\n\n useEffect(function () {\n if(!map || markers.length === 0) return;\n const bounds = new window.google.maps.LatLngBounds();\n if(position) {\n bounds.extend(position);\n }\n\n markers.forEach((marker) => {\n bounds.extend(marker.position)\n })\n map.fitBounds(bounds);\n }, [map, markers.length])\n\n return null;\n}\n"],"names":["BoundingBoxController","position","markers","map","useMap","useEffect","bounds","marker"],"mappings":"oKAGA,SAAwBA,EAAsB,CAAC,SAAAC,EAAU,QAAAC,GAAU,CACjE,MAAMC,EAAMC,IAEZC,OAAAA,EAAAA,UAAU,UAAY,CACjB,GAAA,CAACF,GAAOD,EAAQ,SAAW,EAAG,OACjC,MAAMI,EAAS,IAAI,OAAO,OAAO,KAAK,aACnCL,GACDK,EAAO,OAAOL,CAAQ,EAGhBC,EAAA,QAASK,GAAW,CACnBD,EAAA,OAAOC,EAAO,QAAQ,CAAA,CAC9B,EACDJ,EAAI,UAAUG,CAAM,CACnB,EAAA,CAACH,EAAKD,EAAQ,MAAM,CAAC,EAEjB,IACT"}