!function(){"use strict";var e;e=()=>{if(!window.themeisleLeafletMaps)return void console.warn("The leaflet map attributes did not load on the page!");document.querySelectorAll(".wp-block-themeisle-blocks-leaflet-map").forEach((e=>{e.style.margin="20px 0",e.style.backgroundColor="#ccc"}));let e=0;const t=setInterval((()=>{if(!window.L)return void(++e>=100&&(clearInterval(t),console.warn("The leaflet script did not load on the page!")));clearInterval(t);const o=Array.from(window.themeisleLeafletMaps).reduce(((e,t)=>(t.imagePath&&(window.L.Icon.Default.imagePath=t.imagePath),e[t.container]=t.attributes,e)),{});document.querySelectorAll(".wp-block-themeisle-blocks-leaflet-map").forEach((e=>{void 0!==o[e.id]&&(((e,t)=>{if(!e)return void console.warn(`The placeholder for the leaflet map block with id: ${e} does not exist!`);e.classList.add("wp-block-themeisle-leaflet-blocks-map");const o=!1!==t.scrollZoom,l=window.L.map(e,{maxZoom:21,zoomControl:t.zoomControl,dragging:t.draggable,scrollWheelZoom:o,gestureHandling:t.draggable&&o,gestureHandlingOptions:{text:{touch:"Use two fingers to move the map",scroll:"Use ctrl + scroll to zoom the map",scrollMac:"Use ⌘ + scroll to zoom the map"}}});window.L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',subdomains:["a","b","c"],maxNativeZoom:19,maxZoom:21}).addTo(l),l.setView([t.latitude,t.longitude],t.zoom||15),t.markers.map((e=>((e,t)=>{const o=window.L.marker([e.latitude,e.longitude]),l=Boolean(e.title),a=l||Boolean(e.description),r=t.showMarkerTooltip&&l;return r&&o.bindTooltip(e.title,{direction:"auto"}),a&&(o.bindPopup((e=>{const t=document.createElement("div"),o=document.createElement("h6"),l=document.createElement("div"),a=document.createElement("p");return o.innerHTML=e.title,a.innerHTML=e.description,t.classList.add("wp-block-themeisle-blocks-leaflet-map-overview"),l.classList.add("wp-block-themeisle-blocks-leaflet-map-overview-content"),o.classList.add("wp-block-themeisle-blocks-leaflet-map-overview-title"),t.appendChild(o),t.appendChild(l),l.appendChild(a),t})(e)),r&&o.on("popupopen",(()=>o.closeTooltip()))),o})(e,t))).forEach((e=>{l.addLayer(e)})),new ResizeObserver((()=>{l.invalidateSize()})).observe(e)})(e,o[e.id]),e.style.removeProperty("margin"),e.style.removeProperty("background-color"))}))}),100)},"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",e):e())}();