1/*! 2 * Store Locator Widget 3 * Self-hostable Google Maps-powered store locator. 4 * 5 * Usage: 6 * <div id="store-locator"></div> 7 * <script src="store-locator.js"><\/script> 8 * <script> 9 * StoreLocator.init({ 10 * container: '#store-locator', 11 * googleMapsApiKey: 'YOUR_KEY', 12 * storesUrl: 'https://your-host.example.com/stores.json', 13 * 14 * // Centering: defaultCenter is the initial view. If autoLocate is true, 15 * // the widget will silently try the user's geolocation and re-center on 16 * // success â falling back to defaultCenter on denial / timeout. 17 * defaultCenter: { lat: 40.7128, lng: -74.0060 }, // optional 18 * defaultZoom: 11, // optional 19 * autoLocate: true, // optional 20 * 21 * // Marker icon. Either a single image URL applied to every pin, or an 22 * // object keyed by store type ('cash-carry' / 'on-premise' / 'featured' 23 * // / 'default'). Each entry may also be { url, size: [w,h], anchor: [x,y] }. 24 * // If omitted, built-in colored SVG markers are used. 25 * markerIcon: './mapIcon-1.png', // optional 26 * 27 * theme: { primary: '#10b981' } // optional 28 * }); 29 * <\/script> 30 */(function(global){"use strict";const DEFAULT_THEME={primary:"#10b981",primaryText:"#ffffff",text:"#0f172a",muted:"#64748b",background:"#ffffff",panel:"#ffffff",border:"#e2e8f0",accent:"#0f172a",radius:"8px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif"},DISTANCE_OPTIONS=[{value:5,label:"5 MI"},{value:10,label:"10 MI"},{value:25,label:"25 MI"},{value:50,label:"50 MI"},{value:0,label:"NATIONWIDE"}],STORE_TYPES={"cash-carry":{label:"Cash & Carry",color:"#10b981"},"on-premise":{label:"On-Premise",color:"#0f172a"}},US_CENTER={lat:39.8283,lng:-98.5795},US_ZOOM=4,loaded={};function loadScript(src,globalCheck){return globalCheck&&globalCheck()?Promise.resolve():(loaded[src]||(loaded[src]=new Promise((resolve,reject)=>{const s=document.createElement("script");s.src=src,s.async=!0,s.defer=!0,s.onload=()=>resolve(),s.onerror=()=>reject(new Error("Failed to load "+src)),document.head.appendChild(s)})),loaded[src])}function loadGoogleMaps(apiKey){return global.google&&global.google.maps&&typeof global.google.maps.Map=="function"?Promise.resolve():(loaded._gmaps||(loaded._gmaps=new Promise((resolve,reject)=>{const cbName="__slMapsReady_"+Math.random().toString(36).slice(2,7);global[cbName]=function(){delete global[cbName],resolve()};var s=document.createElement("script");s.src="https://maps.googleapis.com/maps/api/js?key="+encodeURIComponent(apiKey)+"&libraries=places&loading=async&callback="+cbName,s.async=!0,s.defer=!0,s.onerror=function(){delete global[cbName],reject(new Error("Failed to load Google Maps API \u2014 check your API key and allowed referrers"))},document.head.appendChild(s)})),loaded._gmaps)}function loadMarkerClusterer(){return loadScript("https://unpkg.com/@googlemaps/markerclusterer/dist/index.min.js",()=>global.markerClusterer)}function haversineMiles(a,b){const R=3958.7613,toRad=d=>d*Math.PI/180,dLat=toRad(b.lat-a.lat),dLng=toRad(b.lng-a.lng),lat1=toRad(a.lat),lat2=toRad(b.lat),h=Math.sin(dLat/2)**2+Math.sin(dLng/2)**2*Math.cos(lat1)*Math.cos(lat2);return 2*R*Math.asin(Math.sqrt(h))}const DAY_KEYS=["sun","mon","tue","wed","thu","fri","sat"];function isOpenNow(hours,now){if(!hours)return null;now=now||new Date;const day=DAY_KEYS[now.getDay()],entry=hours[day];if(!entry)return!1;const ranges=Array.isArray(entry)?entry.map(r=>Array.isArray(r)?r:String(r).split("-")):[String(entry).split("-")],mins=now.getHours()*60+now.getMinutes();for(const[openStr,closeStr]of ranges){if(!openStr||!closeStr)continue;const[oH,oM]=openStr.split(":").map(Number),[cH,cM]=closeStr.split(":").map(Number),open=oH*60+(oM||0),close=cH*60+(cM||0);if(close>open){if(mins>=open&&mins<close)return!0}else if(mins>=open||mins<close)return!0}return!1}function el(tag,attrs,children){const e=document.createElement(tag);if(attrs)for(const k in attrs)k==="style"&&typeof attrs[k]=="object"?Object.assign(e.style,attrs[k]):k==="class"?e.className=attrs[k]:k.startsWith("on")&&typeof attrs[k]=="function"?e.addEventListener(k.slice(2).toLowerCase(),attrs[k]):attrs[k]!=null&&e.setAttribute(k,attrs[k]);if(children!=null){const arr=Array.isArray(children)?children:[children];for(const c of arr)c!=null&&e.appendChild(typeof c=="string"?document.createTextNode(c):c)}return e}function injectStyles(theme,scopeId){if(document.getElementById("sl-styles-"+scopeId))return;const css=` 31#${scopeId} { --sl-primary: ${theme.primary}; --sl-primary-text: ${theme.primaryText}; --sl-text: ${theme.text}; --sl-muted: ${theme.muted}; --sl-bg: ${theme.background}; --sl-panel: ${theme.panel}; --sl-border: ${theme.border}; --sl-accent: ${theme.accent}; --sl-radius: ${theme.radius}; font-family: ${theme.fontFamily}; color: var(--sl-text); display: flex; height: 100%; min-height: 500px; background: var(--sl-bg); position: relative; box-sizing: border-box; overflow: hidden; } 32#${scopeId} *, #${scopeId} *::before, #${scopeId} *::after { box-sizing: border-box; } 33#${scopeId} .sl-panel { width: 380px; max-width: 40%; background: var(--sl-panel); border-right: 1px solid var(--sl-border); display: flex; flex-direction: column; flex-shrink: 0; z-index: 2; height: 100%; min-height: 500px; overflow: hidden; } 34#${scopeId}
34 .sl-controls { padding: 16px; border-bottom: 1px solid var(--sl-border); background: var(--sl-panel); position: relative; z-index: 3; flex-shrink: 0; } 35#${scopeId} .sl-search-wrap { position: relative; display: flex; align-items: center; background: var(--sl-bg); border: 1px solid var(--sl-border); border-radius: var(--sl-radius); padding: 0 8px; } 36#${scopeId} .sl-search-icon, #${scopeId} .sl-geo-btn, #${scopeId} .sl-clear-btn { background: transparent; border: 0; cursor: pointer; padding: 8px; color: var(--sl-muted); display: flex; align-items: center; justify-content: center; } 37#${scopeId} .sl-geo-btn:hover, #${scopeId} .sl-clear-btn:hover { color: var(--sl-text); } 38#${scopeId} .sl-search-input { flex: 1; border: 0; outline: none; background: transparent; padding: 12px 4px; font-size: 14px; color: var(--sl-text); min-width: 0; } 39#${scopeId} .sl-filters { display: flex; gap: 8px; margin-top: 10px; } 40#${scopeId} .sl-select { flex: 1; position: relative; } 41#${scopeId} .sl-select select { width: 100%; appearance: none; -webkit-appearance: none; background: var(--sl-bg); border: 1px solid var(--sl-border); border-radius: var(--sl-radius); padding: 10px 30px 10px 12px; font-size: 12px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--sl-primary); cursor: pointer; } 42#${scopeId} .sl-select::after { content: ''; position: absolute; right: 12px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--sl-primary); border-bottom: 2px solid var(--sl-primary); transform: translateY(-75%) rotate(45deg); pointer-events: none; } 43#${scopeId} .sl-list { flex: 1 1 0; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; } 44#${scopeId} .sl-item { padding: 18px 16px; border-bottom: 1px solid var(--sl-border); cursor: pointer; transition: background .12s; } 45#${scopeId} .sl-item:hover, #${scopeId} .sl-item.active { background: rgba(15,23,42,0.04); } 46#${scopeId} .sl-item-name { font-size: 15px; font-weight: 700; color: var(--sl-primary); margin: 0 0 6px; } 47#${scopeId} .sl-item-addr { font-size: 13px; color: var(--sl-text); margin: 0 0 10px; line-height: 1.4; } 48#${scopeId} .sl-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } 49#${scopeId} .sl-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; background: rgba(16,185,129,0.12); color: #047857; } 50#${scopeId} .sl-badge .sl-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; } 51#${scopeId} .sl-badge.sl-closed { background: rgba(100,116,139,0.12); color: var(--sl-muted); } 52#${scopeId} .sl-distance { display: inline-block; padding: 5px 10px; border-radius: 4px; font-size: 11px; font-weight: 600; background: rgba(15,23,42,0.05); color: var(--sl-text); } 53#${scopeId} .sl-directions { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--sl-primary); text-decoration: none; } 54#${scopeId} .sl-directions:hover { text-decoration: underline; } 55#${scopeId} .sl-empty { padding: 32px 16px; text-align: center; color: var(--sl-muted); font-size: 13px; } 56#${scopeId} .sl-loading { padding: 24px 16px; text-align: center; color: var(--sl-muted); font-size: 13px; } 57#${scopeId} .sl-map { flex: 1; min-height: 100%; position: relative; } 58#${scopeId} .sl-map > div { height: 100%; } 59#${scopeId} .sl-info { font-family: inherit; max-width: 260px; } 60#${scopeId} .sl-info h4 { margin: 0 0 6px; font-size: 14px; color: var(--sl-primary); } 61#${scopeId} .sl-info p { margin: 0 0 4px; font-size: 12px; color: var(--sl-text); } 62#${scopeId} .sl-info a { color: var(--sl-primary); text-decoration: none; font-size: 12px; } 63#${scopeId} .sl-error { padding: 16px; background: #fef2f2; color: #991b1b; font-size: 13px; border: 1px solid #fecaca; border-radius: var(--sl-radius); margin: 16px; } 64@media (max-width: 720px) { 65 #${scopeId} { flex-direction: column; height: auto; min-height: 600px; } 66 #${scopeId} .sl-panel { width: 100%; max-width: 100%; min-height: 0; max-height: 50vh; border-right: 0; border-bottom: 1px solid var(--sl-border); } 67 #${scopeId} .sl-map { min-height: 400px; } 68} 69.pac-container { z-index: 9999 !important; font-family: ${theme.fontFamily}; } 70 `,style=el("style",{id:"sl-styles-"+scopeId},css);document.head.appendChild(style)}function builtInMarkerSvg(type,featured){const color=(STORE_TYPES[type]||STORE_TYPES["cash-carry"]).color;if(featured||type==="on-premise"){const svg2=`<svg xmlns='http://www.w3.org/2000/svg' width='34' height='40' viewBox='0 0 34 40'><path d='M17 39 L4 26 A8 8 0 0 1 4 14 L4 6 A4 4 0 0 1 8 2 L26 2 A4 4 0 0 1 3
700 6 L30 14 A8 8 0 0 1 30 26 Z' fill='${color}' stroke='#fff' stroke-width='2'/><path d='M17 9 L19 14 L24 14 L20 17 L21.5 22 L17 19 L12.5 22 L14 17 L10 14 L15 14 Z' fill='#fff'/></svg>`;return{url:"data:image/svg+xml;charset=UTF-8,"+encodeURIComponent(svg2),size:[34,40],anchor:[17,38]}}const svg=`<svg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'><circle cx='14' cy='14' r='11' fill='${color}' stroke='#fff' stroke-width='3'/></svg>`;return{url:"data:image/svg+xml;charset=UTF-8,"+encodeURIComponent(svg),size:[28,28],anchor:[14,14]}}function resolveMarkerIcon(config,store){if(!config)return builtInMarkerSvg(store.type,store.featured);const pickFromMap=map=>store.featured&&map.featured?map.featured:store.type&&map[store.type]?map[store.type]:map.default||map["cash-carry"]||map["on-premise"]||null;let icon;if(typeof config=="string")icon={url:config};else if(config.url)icon=config;else{const picked=pickFromMap(config);if(!picked)return builtInMarkerSvg(store.type,store.featured);icon=typeof picked=="string"?{url:picked}:picked}const size=icon.size||[40,40],anchor=icon.anchor||[Math.round(size[0]/2),size[1]];return{url:icon.url,size,anchor}}const ICON_SEARCH='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>',ICON_CLEAR='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M6 6l12 12M6 18 18 6"/></svg>',ICON_GEO='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M12 2v3M12 19v3M2 12h3M19 12h3"/></svg>';function init(opts){if(!opts||!opts.container)throw new Error("StoreLocator: container required");if(!opts.googleMapsApiKey)throw new Error("StoreLocator: googleMapsApiKey required");if(!opts.storesUrl&&!opts.stores)throw new Error("StoreLocator: storesUrl or stores required");const root=typeof opts.container=="string"?document.querySelector(opts.container):opts.container;if(!root)throw new Error("StoreLocator: container not found");const theme=Object.assign({},DEFAULT_THEME,opts.theme||{}),defaultRadius=opts.defaultRadius!=null?opts.defaultRadius:25,defaultCenter=opts.defaultCenter||US_CENTER,defaultZoom=opts.defaultZoom!=null?opts.defaultZoom:opts.defaultCenter?10:US_ZOOM;root.id||(root.id="sl-"+Math.random().toString(36).slice(2,9)),injectStyles(theme,root.id),root.innerHTML="";const state={stores:[],filtered:[],origin:null,radius:defaultRadius,map:null,markers:[],cluster:null,info:null,activeId:null,originMarker:null},searchInput=el("input",{type:"text",class:"sl-search-input",placeholder:"Enter address or zip","aria-label":"Search address or zip"}),clearBtn=el("button",{class:"sl-clear-btn","aria-label":"Clear"});clearBtn.innerHTML=ICON_CLEAR,clearBtn.style.display="none";const geoBtn=el("button",{class:"sl-geo-btn","aria-label":"Use my location"});geoBtn.innerHTML=ICON_GEO;const searchIcon=el("span",{class:"sl-search-icon"});searchIcon.innerHTML=ICON_SEARCH;const searchWrap=el("div",{class:"sl-search-wrap"},[searchIcon,searchInput,clearBtn,geoBtn]),distSelectEl=el("select");DISTANCE_OPTIONS.forEach(o=>{const opt=el("option",{value:String(o.value)},o.label);o.value===defaultRadius&&(opt.selected=!0),distSelectEl.appendChild(opt)});const distSelect=el("div",{class:"sl-select"},distSelectEl),filters=el("div",{class:"sl-filters"},[distSelect]),controls=el("div",{class:"sl-controls"},[searchWrap,filters]),list=el("div",{class:"sl-list"});list.appendChild(el("div",{class:"sl-loading"},"Loading stores\u2026"));const panel=el("div",{class:"sl-panel"},[controls,list]),mapDiv=el("div",{class:"sl-map"});root.appendChild(panel),root.appendChild(mapDiv),searchInput.addEventListener("input",()=>{clearBtn.style.display=searchInput.value?"flex":"none"}),clearBtn.addEventListener("click",()=>{searchInput.value="",clearBtn.style.display="none",state.origin=null,state.originMarker&&(state.originMarker.setMap(null),state.originMarker=null),render(),fitToVisible()}),geoBtn.addEventListener("click",()=>{navigator.geolocation&&(geoBtn.disabled=!0,navigator.geolocation.getCurrentPosition(pos=>{geoBtn.disabled=!1,state.origin={lat:pos.coords.latitude,lng:pos.coords.longitude},searchInput.value="Current location",clearBtn.style.display="flex",setOriginMarker(),render(),fitToVisible()},()=>{geoBtn.disabled=!1},{enableHighAccuracy:!1,timeout:8e3}))}),distSelectEl.addEventListener("change",()=>{state.radius=Number(distSelectEl.value),render(),fitToVisible()});function loadStores(){return opts.stores?Promise.resolve(opts.stores):fetch(opts.storesUrl,{credentials:"omit"}).then(r=>{if(!r.ok)throw new Error("Stores fetch failed: "+r.status);return r.json()})}function setOriginMarker(){!state.map||!state.origin||(state.originMarker&&state.originMarker.setMap(null),state.originMarker=new google.maps.Marker({position:state.origin,map:state.map,icon:{path:google.maps.SymbolPath.CIRCLE,scale:8,fillColor:"#3b82f6",fillOpacity:1,strokeColor:"#fff",strokeWeight:3},zIndex:9999}))}function computeFiltered(){let arr=state.stores.slice();return state.origin&&state.radius>0?arr=arr.map(s=>Object.assign({},s,{_distance:haversineMiles(state.origin,{lat:s.lat,lng:s.lng})})).filter(s=>s._distance<=state.radius):state.origin&&(arr=arr.map(s=>Object.assign({},s,{_distance:haversineMiles(state.origin,{lat:s.lat,lng:s.lng})}))),state.origin?arr.sort((a,b)=>a._distance-b._distance):arr.sort((a,b)=>a.name.localeCompare(b.name)),arr}function render(){state.filtered=computeFiltered(),renderList(),renderMarkers()}function renderList(){if(list.innerHTML="",!state.filtered.length){list.appendChild(el("div",{class:"sl-empty"},"No stores match your filters."));return}state.filtered.forEach(s=>{const open=isOpenNow(s.hours),meta=el("div",{class:"sl-meta"});if(open!==null){const badge=el("span",{class:"sl-badge"+(open?"":" sl-closed")},[el("span",{class:"sl-dot"}),open?"Open Now":"Closed"]);meta.appendChild(badge)}s._distance!=null&&meta.appendChild(el("span",{class:"sl-distance"},s._distance.toFixed(1)+" mi"));var dirUrl="https://www.google.com/maps/dir/?api=1&destination="+encodeURIComponent(s.address||s.lat+","+s.lng),dirLink=el("a",{class:"sl-directions",href:dirUrl,target:"_blank",rel:"noopener",onclick:function(e){e.stopPropagation()}},"Get Directions \u2192");const item=el("div",{class:"sl-item"+(state.activeId===s.id?" active":""),onclick:()=>focusStore(s)},[el("h3",{class:"sl-item-name"},s.name),el("p",{class:"sl-item-addr"},s.address||""),meta,dirLink]);list.appendChild(item)})}function renderMarkers(){if(!state.map)return;state.cluster&&state.cluster.clearMarkers(),state.markers.forEac
70h(m=>m.setMap(null)),state.markers=[];const visibleIds=new Set(state.filtered.map(s=>s.id));state.filtered.forEach(s=>{const icon=resolveMarkerIcon(opts.markerIcon,s),marker=new google.maps.Marker({position:{lat:s.lat,lng:s.lng},icon:{url:icon.url,scaledSize:new google.maps.Size(icon.size[0],icon.size[1]),anchor:new google.maps.Point(icon.anchor[0],icon.anchor[1])},title:s.name});marker.addListener("click",()=>focusStore(s,!0)),state.markers.push(marker)}),global.markerClusterer&&state.markers.length?state.cluster=new global.markerClusterer.MarkerClusterer({map:state.map,markers:state.markers}):state.markers.forEach(m=>m.setMap(state.map))}function fitToVisible(){if(!state.map||!state.markers.length){state.map&&(state.map.setCenter(defaultCenter),state.map.setZoom(defaultZoom));return}const bounds=new google.maps.LatLngBounds;state.markers.forEach(m=>bounds.extend(m.getPosition())),state.origin&&bounds.extend(state.origin),state.map.fitBounds(bounds,64);const listener=google.maps.event.addListenerOnce(state.map,"idle",()=>{state.map.getZoom()>15&&state.map.setZoom(15)})}function focusStore(s,fromMarker){if(state.activeId=s.id,renderList(),!state.map)return;state.map.panTo({lat:s.lat,lng:s.lng}),state.map.getZoom()<13&&state.map.setZoom(13),state.info||(state.info=new google.maps.InfoWindow);const open=isOpenNow(s.hours),directionsUrl="https://www.google.com/maps/dir/?api=1&destination="+encodeURIComponent(s.address||s.lat+","+s.lng),html='<div class="sl-info"><h4>'+escapeHtml(s.name)+"</h4>"+(s.address?"<p>"+escapeHtml(s.address)+"</p>":"")+(s.phone?'<p><a href="tel:'+escapeAttr(s.phone)+'">'+escapeHtml(s.phone)+"</a></p>":"")+'<p style="display:flex;gap:12px;align-items:center;flex-wrap:wrap;"><a href="'+escapeAttr(directionsUrl)+'" target="_blank" rel="noopener" style="color:'+theme.primary+';font-weight:600;text-decoration:none;">Get Directions →</a>'+(s.website?'<a href="'+escapeAttr(s.website)+'" target="_blank" rel="noopener" style="color:'+theme.accent+';text-decoration:none;">Website</a>':"")+"</p>"+(open===!0?'<p><span class="sl-badge"><span class="sl-dot"></span>Open Now</span></p>':open===!1?'<p><span class="sl-badge sl-closed"><span class="sl-dot"></span>Closed</span></p>':"")+"</div>";state.info.setContent(html);const marker=state.markers.find(m=>{const p=m.getPosition();return p.lat()===s.lat&&p.lng()===s.lng});if(marker&&state.info.open(state.map,marker),!fromMarker){const items=list.querySelectorAll(".sl-item"),idx=state.filtered.findIndex(x=>x.id===s.id);items[idx]&&items[idx].scrollIntoView({block:"nearest",behavior:"smooth"})}}function escapeHtml(str){return String(str).replace(/[&<>"']/g,c=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[c])}function escapeAttr(str){return escapeHtml(str)}return Promise.all([loadGoogleMaps(opts.googleMapsApiKey),loadMarkerClusterer(),loadStores()]).then(([_,__,stores])=>{state.stores=(Array.isArray(stores)?stores:stores.stores||[]).filter(s=>s&&typeof s.lat=="number"&&typeof s.lng=="number").map((s,i)=>Object.assign({id:s.id||"store-"+i,type:s.type||"cash-carry"},s)),state.map=new google.maps.Map(mapDiv,{center:defaultCenter,zoom:defaultZoom,mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!1,clickableIcons:!1,styles:opts.mapStyles||[]});var _acAttached=!1;try{if(google.maps.places&&google.maps.places.Autocomplete){const ac=new google.maps.places.Autocomplete(searchInput,{types:["geocode"],fields:["geometry","formatted_address"]});ac.addListener("place_changed",()=>{const place=ac.getPlace();!place.geometry||!place.geometry.location||(state.origin={lat:place.geometry.location.lat(),lng:place.geometry.location.lng()},clearBtn.style.display="flex",setOriginMarker(),render(),fitToVisible())}),_acAttached=!0}}catch(acErr){console.warn("[StoreLocator] Places Autocomplete unavailable, using geocoder fallback:",acErr.message)}if(searchInput.addEventListener("keydown",e=>{if(e.key!=="Enter")return;e.preventDefault();const q=searchInput.value.trim();if(!q)return;setTimeout(()=>{if(_acAttached&&state._lastQuery===q)return;state._lastQuery=q,new google.maps.Geocoder().geocode({address:q},(results,status)=>{if(status==="OK"&&results[0]){const loc=results[0].geometry.location;state.origin={lat:loc.lat(),lng:loc.lng()},clearBtn.style.display="flex",setOriginMarker(),render(),fitToVisible()}})},_acAttached?250:0)}),render(),opts.defaultCenter?(state.map.setCenter(defaultCenter),state.map.setZoom(defaultZoom)):fitToVisible(),opts.autoLocate&&navigator.geolocation){const geoTimeoutMs=opts.autoLocateTimeoutMs||8e3;navigator.geolocation.getCurrentPosition(pos=>{state.origin={lat:pos.coords.latitude,lng:pos.coords.longitude},searchInput.value="Current location",clearBtn.style.display="flex",setOriginMarker(),render(),fitToVisible()},err=>{opts.onGeolocationError&&opts.onGeolocationError(err)},{enableHighAccuracy:!1,timeout:geoTimeoutMs,maximumAge:300*1e3})}}).catch(err=>{console.error("[StoreLocator]",err),list.innerHTML="",list.appendChild(el("div",{class:"sl-error"},"Could not load store locator: "+err.message))}),{destroy(){state.cluster&&state.cluster.clearMarkers(),state.markers.forEac
70h(m=>m.setMap(null)),root.innerHTML=""}}}global.StoreLocator={init}})(typeof window<"u"?window:globalThis); 71//# sourceMappingURL=/cdn/shop/t/44/assets/sl-map-widget-7-13.js.map?v=143036335160955513741783996926
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.