document.addEventListener(aioseoMapOptions.mapLoadEvent,function(e){if(e.detail===null||!e.detail||!e.detail.element||!e.detail.mapOptions)return;const t=document.querySelector(e.detail.element);if(!t||t.className.match(/map-loaded/))return;if(e.detail.placeId){const a=document.createElement("iframe");a.style.width=e.detail.instance.width,a.style.height=e.detail.instance.height,a.style.border="0",a.frameborder="0",a.src="https://www.google.com/maps/embed/v1/place?key="+aioseoMapOptions.apiKey+"&q=place_id:"+e.detail.placeId,t.replaceChildren(a),t.className+=" map-loaded";return}new google.maps.plugins.loader.Loader({apiKey:aioseoMapOptions.apiKey,libraries:["places"]}).load().then(a=>{const n=new a.maps.Map(t,e.detail.mapOptions),i=new a.maps.Marker({map:n,position:e.detail.mapOptions.center,icon:e.detail.customMarker?{url:e.detail.customMarker,origin:new a.maps.Point(0,0),anchor:new a.maps.Point(17,34),scaledSize:new a.maps.Size(25,25)}:null});if(e.detail.infoWindowContent){const o=new a.maps.InfoWindow({content:e.detail.infoWindowContent});o.open(n,i),i.addListener("click",()=>{o.open({anchor:i,map:n,shouldFocus:!1})})}t.className+=" map-loaded"}).catch(a=>{console.log(a)})});
