1"use strict";(self.webpackChunkcmtl_frontend=self.webpackChunkcmtl_frontend||[]).push([[104],{2160:(e,t,i)=>{i.r(t),i.d(t,{default:()=>m});var o=i(1425);const s={class:"global-map-wrapper"},r={class:"title title--3 mb-2"},n={class:"global-map-wrapper__legend legend"},a=["onClick"];var l=i(3481),p=i.n(l);i(9389),i(4635),i(1466);delete p().Icon.Default.prototype._getIconUrl,p().Icon.Default.mergeOptions({shadowUrl:i(8980)});const d={};function u(e){if(!d[e]){const t=encodeURIComponent(`\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 40">\n <path d="M12 0C5.372 0 0 5.372 0 12c0 9.6 12 28 12 28s12-18.4 12-28c0-6.628-5.372-12-12-12z" fill="${e}"/>\n <circle cx="12" cy="12" r="5" fill="white"/>\n </svg>\n `);d[e]=p().icon({iconUrl:`data:image/svg+xml,${t}`,iconSize:[24,40],iconAnchor:[12,40],popupAnchor:[0,-35]})}return d[e]}const c={name:"CompanyMap",props:{divisions:{type:Array,required:!0},companies:{type:Array,required:!0},allDivisionsLabel:{type:String,default:"All Divisions"},title:{type:String,default:"Filter by Division:"},disableClustering:{type:Boolean,default:!1},cartoApiKey:{type:String,default:""}},data:()=>({map:null,markerClusterGroup:null,selectedDivisionId:null}),computed:{tileUrl(){const e="https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png";return this.cartoApiKey?`${e}?key=${encodeURIComponent(this.cartoApiKey)}`:e},resolvedTitle(){return this.title&&this.title.trim()?this.title:"Filter by Division:"},showFilters(){return Array.isArray(this.divisions)&&this.divisions.length>1},filteredCompanies(){return null===this.selectedDivisionId?this.companies:this.companies.filter(e=>e.divisionId===this.selectedDivisionId)}},watch:{selectedDivisionId(){this.updateMarkers()},companies:{handler(){this.updateMarkers()},deep:!0}},mounted(){(0,o.dY)(()=>{document.getElementById("global-map")&&this.initMap()})},methods:{initMap(){document.getElementById("global-map")&&(this.map=p().map("global-map",{center:[54.5,-3],zoom:6,zoomControl:!1}),p().control.zoom({position:"bottomright"}).addTo(this.map),p().tileLayer(this.tileUrl,{attribution:'© <a href="https://www.openstreetmap.org/copyright">OSM</a> © <a href="https://carto.com/">CARTO</a>',minZoom:1,maxZoom:10}).addTo(this.map),this.disableClustering?this.markerClusterGroup=p().featureGroup():this.markerClusterGroup=p().markerClusterGroup({maxClusterRadius:35,disableClusteringAtZoom:7,showCoverageOnHover:!1,spiderfyOnMaxZoom:!0}),this.map.addLayer(this.markerClusterGroup),this.updateMarkers())},updateMarkers(){if(!this.map||!this.markerClusterGroup)return;const e=Object.prototype.hasOwnProperty.call(this.markerClusterGroup.options||{},"animate"),t=e?this.markerClusterGroup.options.animate:null;e&&(this.markerClusterGroup.options.animate=!1),this.markerClusterGroup.clearLayers(),this.filteredCompanies.forEach(e=>{const t=this.divisions.find(t=>t.id===e.divisionId),i=t?t.colour:"#13a538",o=p().marker([e.lat,e.lng],{icon:u(i)}),s=`\n <div class="global-map__pop-up">\n <img src="${e.logo}" alt="${e.name} Logo" />\n <p class="title title--5">${e.name}</p>\n <div class="richtext">\n ${t?`<p><strong>Division:</strong> ${t.name}</p>`:""}\n ${e.office?`<p><strong>Office:</strong> ${e.office}</p>`:""}\n <p><strong>Address:</strong> ${e.address}</p>\n ${e.googleMapsUrl?`<p class="mt-1"><a href="${e.googleMapsUrl}" target="_blank" rel="noopener">View on Google Maps</a></p>`:""}\n </div>\n ${e.website?`<a class="button button--secondary button--small" href="${e.website}" target="_blank" rel="noopener">Visit Website</a>`:""}\n </div>\n `;o.bindPopup(s,{keepInView:!0,autoPan:!0,autoPanPaddingTopLeft:[50,75],autoPanPaddingBottomRight:[50,50],maxWidth:300}),this.markerClusterGroup.addLayer(o)});if(this.markerClusterGroup.getLayers().length>0){const e=this.markerClusterGroup.getBounds();if(e.isValid())try{requestAnimationFrame(()=>{this.map.fitBounds(e.pad(.2),{animate:!1,maxZoom:8})})}catch(e){console.warn("Leaflet fitBounds skipped due to invalid bounds",e)}}e&&(this.markerClusterGroup.options.animate=t)}}};const m=(0,i(6262).A)(c,[["render",function(e,t,i,l,p,d){return(0,o.uX)(),(0,o.CE)("div",s,[d.showFilters?((0,o.uX)(),(0,o.CE)(o.FK,{key:0}
1,[(0,o.Lk)("p",r,(0,o.v_)(d.resolvedTitle),1),(0,o.Lk)("div",n,[(0,o.Lk)("button",{class:(0,o.C4)(["legend__item",{active:null===p.selectedDivisionId}]),onClick:t[0]||(t[0]=e=>p.selectedDivisionId=null)},[t[1]||(t[1]=(0,o.Lk)("span",{class:"legend__color",style:{"background-color":"#13a538"}},null,-1)),(0,o.eW)(" "+(0,o.v_)(i.allDivisionsLabel),1)],2),((0,o.uX)(!0),(0,o.CE)(o.FK,null,(0,o.pI)(i.divisions,e=>((0,o.uX)(),(0,o.CE)("button",{key:e.id,class:(0,o.C4)(["legend__item",{active:p.selectedDivisionId===e.id}]),onClick:t=>p.selectedDivisionId=e.id},[(0,o.Lk)("span",{class:"legend__color",style:(0,o.Tr)({backgroundColor:e.colour})},null,4),(0,o.eW)(" "+(0,o.v_)(e.name),1)],10,a))),128))])],64)):(0,o.Q3)("v-if",!0),t[2]||(t[2]=(0,o.Lk)("div",{id:"global-map",class:"global-map"},null,-1))])}]])}}]); 2//# sourceMappingURL=GlobalMap.41c22903ac9187fc2809.js.map
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.