1/*! For license information please see 498.40606a97.js.LICENSE.txt */ 2(self.webpackChunkstw_seems=self.webpackChunkstw_seems||[]).push([[498],{6659:function(e,t,s){var a={"./map-marker-em.svg":3454,"./map-marker.svg":5699};function o(e){var t=n(e);return s(t)}function n(e){if(!s.o(a,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return a[e]}o.keys=function(){return Object.keys(a)},o.resolve=n,e.exports=o,o.id=6659},1498:function(e,t,s){"use strict";s.d(t,{default:function(){return i}});s(4114),s(8992),s(2577),s(3949);var a=s(842),o=s.n(a);s(1454);class n{onAdd(e){return this.map=e,this.container=document.createElement("form"),this.container.className="search-when-map-moves-form mapboxgl-ctrl mapboxgl-ctrl-group",this.container.innerHTML='\n <div class="p-1 mb-0">\n <input id="search-after-move-map" type="checkbox" checked></input>\n <label for="search-after-move-map"><span>Search after moving map</span></label>\n <div>\n ',this.container}onRemove(){this.container.parentNode.removeChild(this.container),this.map=void 0}}class i{constructor(e,t){this.hasBeenDisplayed=!1,this.mapboxMap=null,this.replaceMarkers([]),this.rootElem=e,this.options={...t},this.defaultCentre=JSON.parse(this.getRootElem().dataset.location),this.setMarkerLocations(this.options.markerLocations)}setMarkerLocations(e,t=!1){this.markerLocations=e,this.hasBeenDisplayed&&this.refreshMarkers(this.markerLocations,t)}getMarkerLocations(){return this.markerLocations}hasMarkerLocations(){return this.getMarkerLocations().length>0}setMapUpdateCallback(e){this.mapUpdateCallback=e}initialiseMapboxMapAndIncurCharge(){o().accessToken="pk.eyJ1IjoicG93ZGVyYmx1ZSIsImEiOiJja2psY3FkMGkwbXh1MnpzMmZiZWw5ZzFpIn0.n8jGRFNfYX-RgZ_iFJiXLw";const e={container:this.getRootElem(),style:"mapbox://styles/mapbox/light-v10?optimize=true",minZoom:4};if(this.hasMarkerLocations()){const t=new a.LngLatBounds;this.getMarkerLocations().forEach(e=>{t.extend([e.lng,e.lat])}),e.bounds=t}else e.center=[this.defaultCentre.lng,this.defaultCentre.lat],e.zoom=8;this.mapboxMap=new a.Map(e),this.setUpCustomControls(),this.refreshMarkers(this.getMarkerLocations(),!1),this.mapboxMap.on("load",()=>this.getRootElem().classList.remove("loading-spinner")),this.getWindow().addEventListener("resize",()=>this.handleLayoutChange()),this.recenter(),this.mapboxMap.on("dragend",()=>this.afterMapMove()),this.mapboxMap.on("zoomend",()=>this.afterMapMove()),this.mapboxMap.on("rotateend",()=>this.afterMapMove()),this.mapboxMap.on("boxzoomend",()=>this.afterMapMove()),this.mapboxMap.on("pitchend",()=>this.afterMapMove()),this.hasBeenDisplayed=!0}afterMapMove(){if(this.latestMoveWasAuto)return void(this.latestMoveWasAuto=!1);if(!this.hasBeenDisplayed||!this.options.showMapOptionsPanel)return;this.getDocument().getElementById("search-after-move-map").checked&&this.mapUpdateCallback()}setUpCustomControls(){this.options.showMapOptionsPanel&&this.mapboxMap.addControl(new n,"bottom-right"),this.mapboxMap.addControl(new a.NavigationControl({showCompass:!1}),"bottom-right")}replaceMarkers(e){void 0!==this.markers&&this.markers.forEach(e=>{e.remove()}),this.markers=e}
2getMarkers(){return this.markers}show(){this.hasBeenDisplayed?this.mapboxMap.triggerRepaint():this.initialiseMapboxMapAndIncurCharge()}getSerialisedMapBounds(){if(!this.hasBeenDisplayed)return"";const e=this.mapboxMap.getBounds();return"map[n]="+String(e.getNorth())+"&map[e]="+String(e.getEast())+"&map[s]="+String(e.getSouth())+"&map[w]="+String(e.getWest())}handleLayoutChange(){this.latestMoveWasAuto=!0,this.hasBeenDisplayed&&(this.mapboxMap.resize(),this.recenter())}recenter(){if(this.latestMoveWasAuto=!0,this.hasMarkerLocations()){const e=new a.LngLatBounds;this.getMarkerLocations().forEach(t=>{e.extend([t.lng,t.lat])}),this.mapboxMap.fitBounds(e,{padding:112,maxZoom:17})}else this.mapboxMap.setZoom(8),this.mapboxMap.setCenter([this.defaultCentre.lng,this.defaultCentre.lat])}createMarkerImageElem(e){const t=this.getDocument().createElement("img");return t.src=s(6659)("./map-marker"+(e?"-em":"")+".svg").toString(),t.classList.add("map-marker"),e&&t.classList.add("special"),t}refreshMarkers(e,t=!1){const s=[];0!==e.length&&(e.sort((e,t)=>e._is_special?1:t._is_special?-1:0),e.forEach(e=>{const t=new a.Popup({focusAfterOpen:!1,closeButton:!1});t.setHTML('<div><div class="loading-spinner"></div></div>'),t.on("open",async function(){const s=t.getElement();if(null!==s.querySelector(".map-popup-content"))return;const a=await fetch(e._info_url);a.ok&&(t.setHTML(await a.text()),s.querySelector(".close-button").addEventListener("click",t.remove.bind(t)))});const o=new a.Marker({anchor:"bottom",element:this.createMarkerImageElem(e._is_special)}).setLngLat([e.lng,e.lat]).setPopup(t).addTo(this.mapboxMap);o.getElement().dataset.id=e.id_c_item.toString(),o.getElement().addEventListener("click",()=>{this.latestMoveWasAuto=!0}),s.push(o)}),this.replaceMarkers(s),t||this.recenter())}findMarker(e){return this.getMarkers().find(t=>{const s=t.getElement().dataset.id;return parseInt(s)===e})}highlightItem(e,t=!0){const s=this.findMarker(e);if(void 0===s||!this.hasBeenDisplayed)return;const a=t?"add":"remove";s.getElement().classList[a]("map-pin-highlight")}getRootElem(){return this.rootElem}getDocument(){return this.getRootElem().ownerDocument}getWindow(){return this.getDocument().defaultView}}},3454:function(e,t,s){"use strict";e.exports=s.p+"images/map-marker-em.5a8f3333.svg"},5699:function(e,t,s){"use strict";e.exports=s.p+"images/map-marker.10bdd59b.svg"}}]);
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.