var TF_LatLongMapSelector=function(){function e(){this.initEvents()}return e.prototype.initEvents=function(){document.addEventListener("change",function(e){var t,n,e=e.target.closest(".tf-lat-long-map-value");e&&(n=e.previousElementSibling)&&n.classList.contains("tf-lat-long-map-selector")&&2===(e=e.value.split(",")).length&&(console.log(e),t=parseFloat(e[0]),e=parseFloat(e[1]),!isNaN(t))&&!isNaN(e)&&(n=n.OpenStreetMap)&&(n.options.markers[0].latitude=t,n.options.markers[0].longitude=e,n.updateMarkers(),n.map.setView([t,e],n.options.zoom))}),document.addEventListener("onTFMapWidgetRender",function(e){var t=e.detail.map;t.closest(".map-widget.tf-lat-long-map-selector")&&((e=t.OpenStreetMap).markers_draggable=!0,e.map.on("click",function(e){t.OpenStreetMap.options.markers[0].latitude=e.latlng.lat,t.OpenStreetMap.options.markers[0].longitude=e.latlng.lng,t.OpenStreetMap.updateMarkers(),t.nextElementSibling.value=[e.latlng.lat,e.latlng.lng].join(",")}))}),document.addEventListener("onTFMapMarkerCreate",function(t){var n=t.detail.map;n.closest(".map-widget.tf-lat-long-map-selector")&&t.detail.markerMap.on("moveend",function(){var e=t.detail.markerMap.getLatLng();n.nextElementSibling.value=[e.lat,e.lng].join(",")})})},e}();document.addEventListener("DOMContentLoaded",function(){new TF_LatLongMapSelector});

