/*! YOOtheme Pro v5.0.24 | https://yootheme.com */

const E=window.UIkit&&Object.prototype.hasOwnProperty.call(window.UIkit,"default")?window.UIkit.default:window.UIkit,{$:L,$$:O,html:D,observeIntersection:Z}=window.UIkit.util;async function k(e,{type:n,center:a,zoom:t,fit_bounds:o,min_zoom:P,max_zoom:x,zooming:y,dragging:A,clustering:I,cluster_icons:p,controls:G,markers:h=[],popup_max_width:S}){const r=new URL(import.meta.url).pathname+"/../../../leaflet",b=[await import(`${r}/leaflet/dist/leaflet.js`),await C(`${r}/leaflet/dist/leaflet.css`)];I&&b.push(await import(`${r}/markercluster/dist/leaflet.markercluster.js`),await C(`${r}/markercluster/dist/MarkerCluster.css`),await C(`${r}/markercluster/dist/MarkerCluster.Default.css`)),await Promise.all(b);const{L:i}=window;i.Icon.Default.imagePath=`${r}/leaflet/dist/images/`;const d=i.map(e,{zoom:t,minZoom:Number(P),maxZoom:Number(x),center:a,dragging:A,zoomControl:G,touchZoom:y,scrollWheelZoom:y,doubleClickZoom:y});n==="satellite"?i.tileLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",{attribution:'&copy; <a href="https://www.esri.com">Esri</a> | DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community'}).addTo(d):i.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="http://osm.org/copyright">OpenStreetMap</a>'}).addTo(d);let w;if(I){const l={showCoverageOnHover:!1};Array.isArray(p)&&p.length&&(l.iconCreateFunction=m=>{const c=m.getChildCount(),s=c>=100&&p[2]||c>=10&&p[1]||p[0],u=s.textColor?`style="color: ${s.textColor}"`:"";return new i.DivIcon({html:`<img src="${s.url}" alt><span class="uk-position-center"${u}>${c}</span>`,iconSize:s.size?new i.Point(...s.size):null})}),w=i.markerClusterGroup(l),d.addLayer(w)}for(const{lat:l,lng:m,content:c,show_popup:s,icon:u,iconSize:$,iconAnchor:v,title:z}of h){const f=i.marker({lat:l,lng:m},{title:z});if(u&&f.setIcon(i.icon({iconUrl:u,iconSize:$,iconAnchor:v})),w?w.addLayer(f):f.addTo(d),c){const U={maxWidth:S?parseInt(S,10):300};$&&(U.offset=new i.Point(0,-1*$[1]+7));const M=i.popup(U).setContent(c);f.bindPopup(M),s&&f.openPopup()}}o&&(h!=null&&h.length)&&d.fitBounds(h.map(({lat:l,lng:m})=>[l,m]),{padding:[50,50]})}let g={};function C(e){var n;return(n=g[e])!=null?n:g[e]=new window.Promise((a,t)=>{const o=document.createElement("link");o.onload=()=>a(e),o.onerror=()=>t(e),o.rel="stylesheet",o.href=e,document.head.appendChild(o)})}E.component("Map",{async connected(){var e,n,a;if(this.script||(this.script=L("script",this.$el)),!!this.script){(e=this.map)!=null||(this.map=JSON.parse(this.script.textContent)),(n=this.templates)!=null||(this.templates=O("template",this.$el)),(a=this.map.markers)==null||a.forEach((t,o)=>{t.content=D(this.templates[o]).trim(),!t.icon&&this.map.icon&&(t.icon=this.map.icon,t.iconSize=this.map.iconSize,t.iconAnchor=this.map.iconAnchor)});for(const t of this.$el.parentElement.children)t.hidden=this.$el!==t&&!t.hidden;this.map.lazyload&&"IntersectionObserver"in window?Z(this.$el,(t,o)=>{k(this.$el,this.map),o.disconnect()},{rootMargin:`${window.innerHeight/2}px 0px`}):k(this.$el,this.map)}}});
