"use strict";var __extends,Scripts;(function(n){var t;(function(n){var i=function(){function n(){}return n.prototype.setLocation=function(n){this.location=n},n.prototype.setLocationAsync=function(n,t,i){var r=this,u;t?(u=new google.maps.Geocoder,u.geocode({location:n,address:""},function(n,t){r.processGeocodeResult("",n,t);i(r)}.bind(this))):i(this)},n.prototype.setAddress=function(n){this.search_address=n},n.prototype.getAddress=function(){return this.search_address},n.prototype.getLocation=function(n){var t=this,r,i;this.location?n(this.location):(r=new google.maps.Geocoder,i=this.search_address,r.geocode({address:i},function(r,u){t.processGeocodeResult(i,r,u);t.location&&n&&n(t.location)}.bind(this)))},n.prototype.getCoordinates=function(){return this.location},n.prototype.processGeocodeResult=function(n,t,i){if(i==google.maps.GeocoderStatus.OK){var r=t[0].geometry.location;this.location=r;this.setLocationInformation(t[0].address_components)}else console.log("Couldn't find "+n+" for dealer "+name+" because "+i)},n.prototype.setLocationInformation=function(n){this.setCountryCodeFromLocationInformation(n)},n.prototype.setCountryCodeFromLocationInformation=function(n){this.countryCode=this.getLocationComponent(n,"country").shortname},n.prototype.getCountryCode=function(){return this.countryCode},n.prototype.setCountryCode=function(n){this.countryCode=n},n.prototype.getLocationComponent=function(n,i){var r=n.filter(function(n){return n.types.filter(function(n){return n===i}).length==1});return r.length>0?new t(r[0].long_name,r[0].short_name):null},n}(),t;n.Location=i;t=function(){function n(n,t){this.name=n;this.shortname=t}return n}();n.LocationComponent=t})(t=n.Maps||(n.Maps={}))})(Scripts||(Scripts={})),function(n){var t;(function(n){var t=function(){function t(n){this.skipMapBoundsExtention=n;this.locations=[];this.markers=[];this.markerBounds=new google.maps.LatLngBounds}return t.prototype.initiateMap=function(n,t){this.map=new google.maps.Map($(n)[0],t)},t.prototype.initiateAutoComplete=function(n){this.autocomplete=new google.maps.places.Autocomplete($(n)[0]);this.autocomplete.bindTo("bounds",this.map)},t.prototype.initiateMapWithSearchBox=function(n,t,i){this.initiateMap(n,{styles:i});this.initiateAutoComplete(t)},t.prototype.extendBounds=function(n){if(this.markerBounds.extend(n),this.markerBounds.getNorthEast().equals(this.markerBounds.getSouthWest())){var t=new google.maps.LatLng(this.markerBounds.getNorthEast().lat()+.01,this.markerBounds.getNorthEast().lng()+.01),i=new google.maps.LatLng(this.markerBounds.getNorthEast().lat()-.01,this.markerBounds.getNorthEast().lng()-.01);this.markerBounds.extend(t);this.markerBounds.extend(i)}this.map.fitBounds(this.markerBounds)},t.prototype.addLocation=function(n,t,i){var r=this;n.getLocation(function(n){var u,f;n&&(u=new google.maps.Marker({icon:"https://maps.google.com/mapfiles/ms/icons/red-dot.png",position:n,map:r.map,animation:google.maps.Animation.DROP,title:t?t:""}),i&&(f=new google.maps.InfoWindow({content:i})),google.maps.event.addListener(u,"mouseover",function(){var n=$(".gm-style-iw");n.parent().hide();f&&f.open(this.map,u)}),r.markers.push(u),r.skipMapBoundsExtention||r.extendBounds(n))}.bind(this));this.locations.push(n)},t.prototype.getSearchLocation=function(t){var i=null,r;this.autocomplete.getPlace()&&this.autocomplete.getPlace().geometry?(i=new n.Location,i.setLocationAsync(this.autocomplete.getPlace().geometry.location,!0,t)):(i=new n.Location,r=this.getTextFromElement($(".pac-container .pac-item:first")),i.setAddress(r),t(i))},t.prototype.getTextFromElement=function(n,t){var i,u,r,f;for(t||(t=", "),i="",u=n.contents(),r=0;r<u.length;r++)u[r].nodeType==3?i=i.concat(u[r].nodeValue):(f=this.getTextFromElement($(u[r]),""),f!==""&&(i=i.concat(i!==""?t:"",f)));return i},t.prototype.loseLocationFocus=function(){this.markerBounds=new google.maps.LatLngBounds},t.prototype.resetLocationFocus=function(){var n,t;for(this.loseLocationFocus(),n=0;n<this.locations.length;n++)t=this.locations[n],this.addFocusOnLocation(t)},t.prototype.addFocusOnLocation=function(n){var t=this;n.getLocation(function(n){t.extendBounds(n)})},t.prototype.resetLocationsAndMarkers=function(){for(var t,n=0;n<this.markers.length;n++)t=this.markers[n],t.setMap(null);this.markers=[];this.locations=[]},t}();n.Map=t})(t=n.Maps||(n.Maps={}))}(Scripts||(Scripts={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(n,t,i,r){this.id=n;this.latitude=t;this.longitude=i;this.icon=r}return t.prototype.getPosition=function(){return new google.maps.LatLng(this.latitude,this.longitude,!1)},t.prototype.getLocation=function(){var t=new n.Maps.Location;return t.setLocation(this.getPosition(),!1),t},t}();t.Marker=i})(i=t.Neighbourhood||(t.Neighbourhood={}))})(t=n.Components||(n.Components={}))}(Scripts||(Scripts={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(t){var i;(function(t){var i=function(t){function i(n){var i=t.call(this,"",0,0,"")||this;return i.markers=[],i.addMarker(n),i}return __extends(i,t),i.prototype.addMarker=function(n){this.markers.push(n)},i.prototype.getPosition=function(){var t,n,i,r;if(this.markers.length>1){for(t=new google.maps.LatLngBounds,n=0,i=this.markers;n<i.length;n++)r=i[n],t.extend(r.getPosition());return t.getCenter()}return this.markers.length>0?this.markers[0].getPosition():new google.maps.LatLng(0,0,!1)},i.prototype.getLocation=function(){var t=new n.Maps.Location;return t.setLocation(this.getPosition(),!1),t},i}(t.Marker);t.MarkerGroup=i})(i=t.Neighbourhood||(t.Neighbourhood={}))})(t=n.Components||(n.Components={}))}(Scripts||(Scripts={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(n){var t;(function(n){var t=function(n){function t(t,i,r){var u=n.call(this)||this;return u.id=t,u.position=i,u.colorClass=r,u}return __extends(t,n),t.prototype.draw=function(){var t=this.getProjection(),n=t.fromLatLngToDivPixel(this.position),i=this.getPanes();this.div.style.left=n.x+"px";this.div.style.top=n.y+"px"},t.prototype.onRemove=function(){this.div&&this.div.parentElement&&this.div.parentElement.removeChild(this.div)},t.prototype.addTooltip=function(n,t,i,r,u){var f=document.createElement("div"),o,e;f.classList.add("c-neighbourhood-tooltip");f.style.position="absolute";f.style.display="none";o='<div><h3 class="c-card__title c-card__title--neigbourhood"><span class="c-card__link">'+t+'<\/span><\/h3><p class="c-card__text u-plr-beta c-neighbourhood-subtypelabel c-neighbourhood-subtypelabel--'+this.colorClass+'">'+i+'<\/p><p class="c-card__text u-plr-beta"><span class="p-i-map-tooltip-address">'+r+"<\/p>";u&&(o+='<p class="c-card__text"><i class="c-icon c-icon--distance"><\/i> '+u+"<\/p>");o+="<\/div>";f.innerHTML=o;e=document.createElement("div");e.classList.add("c-neighbourhood-arrow");e.classList.add("c-neighbourhood-arrow--down");e.style.display="none";n.appendChild(f);n.appendChild(e);google.maps.event.addDomListener(n,"click",function(){this.showTooltip(f,e)}.bind(this));google.maps.event.addDomListener(n,"mouseover",function(){this.showTooltip(f,e)}.bind(this));google.maps.event.addDomListener(n,"mouseout",function(){f.style.display="none";e.style.display="none"}.bind(this))},t.prototype.showTooltip=function(n,t){var h=this.getMap(),i=h.getBounds(),r=i.getNorthEast().lat(),c=i.getNorthEast().lng(),u=i.getSouthWest().lat(),f=i.getSouthWest().lng(),e=new google.maps.LatLng(r,f),o=i.getNorthEast(),l=i.getSouthWest(),a=new google.maps.LatLng(u,c),v=new google.maps.LatLng(r,i.getCenter().lng()),y=new google.maps.LatLng(u,i.getCenter().lng()),s=new google.maps.LatLng(i.getCenter().lat(),f),p=new google.maps.LatLngBounds(e,v).getCenter(),it=new google.maps.LatLngBounds(e,s).getCenter(),w=new google.maps.LatLngBounds(y,a).getCenter(),b=new google.maps.LatLngBounds(l,p),k=new google.maps.LatLngBounds(w,o),d=new google.maps.LatLngBounds(s,o),g=b.contains(this.position),nt=k.contains(this.position),tt=d.contains(this.position);n.classList.remove("c-neighbourhood-tooltip--pull-right");n.classList.remove("c-neighbourhood-tooltip--pull-left");n.classList.remove("c-neighbourhood-tooltip--pull-down");t.classList.add("c-neighbourhood-arrow--down");t.classList.remove("c-neighbourhood-arrow--up");g&&n.classList.add("c-neighbourhood-tooltip--pull-right");nt&&n.classList.add("c-neighbourhood-tooltip--pull-left");tt&&(n.classList.add("c-neighbourhood-tooltip--pull-down"),t.classList.add("c-neighbourhood-arrow--up"));n.style.display="block";t.style.display="block"},t}(google.maps.OverlayView);n.CustomHtmlMarker=t})(t=n.Neighbourhood||(n.Neighbourhood={}))})(t=n.Components||(n.Components={}))}(Scripts||(Scripts={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(n){var t;(function(n){var t=function(n){function t(t,i,r,u,f){var e=n.call(this,t,i,r)||this;return e.id=t,e.position=i,e.colorClass=r,e.markers=u,e.onBoundsChanged=f,e}return __extends(t,n),t.prototype.onAdd=function(){var n,t;this.div=document.createElement("div");this.div.id=this.id;this.div.classList.add("c-neighbourhood-dot");this.div.classList.add("c-neighbourhood-cluster");this.div.classList.add("js-neighbourhood-marker");this.div.classList.add("c-neighbourhood-dot--"+this.colorClass);this.div.style.position="absolute";this.div.style.paddingLeft="0px";n=document.createElement("p");n.classList.add("c-neighbourhood-dot__label");n.textContent=this.markers.length.toString();this.div.appendChild(n);t=this.getPanes();t.overlayImage.appendChild(this.div);google.maps.event.addDomListener(this.div,"click",function(){for(var u=this,f=this.getMap(),i=new google.maps.LatLngBounds,r,n=0,t=this.markers;n<t.length;n++)r=t[n],i.extend(r.getPosition());f.fitBounds(i);google.maps.event.addListenerOnce(this.map,"idle",function(){u.onBoundsChanged()}.bind(this))}.bind(this))},t}(n.CustomHtmlMarker);n.CustomHtmlClusterMarker=t})(t=n.Neighbourhood||(n.Neighbourhood={}))})(t=n.Components||(n.Components={}))}(Scripts||(Scripts={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(n){var t;(function(n){var t=function(n){function t(t,i,r,u){var f=n.call(this,t,i,r)||this;return f.id=t,f.position=i,f.colorClass=r,f.markers=u,f}return __extends(t,n),t.prototype.onAdd=function(){var r,f,u,i,n,o;if(this.div=document.createElement("div"),this.div.id=this.id,this.div.style.position="absolute",this.div.style.paddingLeft="0px",this.getMap().getZoom()<18)this.div.classList.add("c-neighbourhood-dot"),this.div.classList.add("c-neighbourhood-cluster"),this.div.classList.add("js-neighbourhood-marker"),this.div.classList.add("c-neighbourhood-dot--"+this.colorClass),r=document.createElement("p"),r.classList.add("c-neighbourhood-dot__label"),r.textContent=this.markers.length.toString(),this.div.appendChild(r),f=this,google.maps.event.addDomListener(this.div,"click",function(){var n=f.getMap();n.setZoom(18);n.setCenter(f.position)});else for(u=this.markers.length,i=u*50,n=0;n<u;n++){var e=n/(u/2)*Math.PI,s=i*Math.cos(e)+i,h=i*Math.sin(e)+i,t=document.createElement("div");t.classList.add("c-neighbourhood-dot");t.classList.add("js-neighbourhood-marker");t.classList.add("c-neighbourhood-dot--"+this.colorClass);t.style.position="absolute";t.style.paddingLeft="0px";t.style.transform="translate("+s+"%, "+h+"%)";this.div.appendChild(t);this.addTooltip(t,this.markers[n].title,this.markers[n].subtype,this.markers[n].address,this.markers[n].distance)}o=this.getPanes();o.overlayImage.appendChild(this.div)},t}(n.CustomHtmlMarker);n.CustomHtmlOpenClusterMarker=t})(t=n.Neighbourhood||(n.Neighbourhood={}))})(t=n.Components||(n.Components={}))}(Scripts||(Scripts={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(n){var t;(function(n){var t=function(n){function t(t,i,r,u,f,e,o){var s=n.call(this,t,i,r)||this;return s.id=t,s.position=i,s.colorClass=r,s.tooltipTitle=u,s.tooltipSubtype=f,s.tooltipAddress=e,s.tooltipDistance=o,s}return __extends(t,n),t.prototype.onAdd=function(){this.div=document.createElement("div");this.div.id=this.id;this.div.classList.add("c-neighbourhood-dot");this.div.classList.add("js-neighbourhood-marker");this.div.classList.add("c-neighbourhood-dot--"+this.colorClass);this.div.style.position="absolute";this.div.style.paddingLeft="0px";var n=this.getPanes();n.overlayMouseTarget.appendChild(this.div);this.addTooltip(this.div,this.tooltipTitle,this.tooltipSubtype,this.tooltipAddress,this.tooltipDistance)},t}(n.CustomHtmlMarker);n.CustomHtmlTooltipMarker=t})(t=n.Neighbourhood||(n.Neighbourhood={}))})(t=n.Components||(n.Components={}))}(Scripts||(Scripts={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t,i,r,u,f){f===void 0&&(f=!0);this.id=n;this.name=t;this.color=i;this.markers=r;this.enable=u;this.visible=f}return n}();n.DimensionBundle=t})(t=n.Neighbourhood||(n.Neighbourhood={}))})(t=n.Components||(n.Components={}))}(Scripts||(Scripts={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t){this.dimension=n;this.count=t}return n}();n.DimensionCount=t})(t=n.Neighbourhood||(n.Neighbourhood={}))})(t=n.Components||(n.Components={}))}(Scripts||(Scripts={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(t){var i;(function(t){var r=function(n){function i(t,i){var r=n.call(this,!0)||this;return r.mapElementID=t,r.styles=i,r.smallMarkerSize=10,r.customMarkers=[],r}return __extends(i,n),i.prototype.initiate=function(n){this.initiateMap("#"+this.mapElementID,{zoom:16,mapTypeControl:!1,styles:this.styles,center:n,mapTypeId:google.maps.MapTypeId.ROADMAP});this.overlay=new google.maps.OverlayView;this.overlay.setMap(this.map)},i.prototype.getPointFromLatLng=function(n){return this.map.getProjection().fromLatLngToPoint(n)},i.prototype.getDistanceBetweenLocationsInPixels=function(n,t){var i=this.getPointFromLatLng(n),r=this.getPointFromLatLng(t),u=Math.pow(2,-this.map.getZoom());return Math.sqrt((i.x-r.x)*(i.x-r.x)+(i.y-r.y)*(i.y-r.y))/u},i.prototype.setChangeEvents=function(n){this.onChange=n;google.maps.event.addListenerOnce(this.map,"idle",n);this.map.addListener("zoom_changed",n)},i.prototype.addMarker=function(n,t){var i=new google.maps.Marker({map:this.map,icon:n,position:t})},i.prototype.addCustomClusterMarker=function(n,i,r){var u=new t.CustomHtmlClusterMarker(n.id,i,n.colorClass,r,this.onChange);this.addCustomMarker(u)},i.prototype.addCustomOpenClusterMarker=function(n,i,r){var u=new t.CustomHtmlOpenClusterMarker(n.id,i,n.colorClass,r);this.addCustomMarker(u)},i.prototype.addCustomTooltipMarker=function(n){var i=new t.CustomHtmlTooltipMarker(n.id,n.getPosition(),n.colorClass,n.title,n.subtype,n.address,n.distance);this.addCustomMarker(i)},i.prototype.addCustomMarker=function(n){n.setMap(this.map);this.customMarkers.push(n)},i.prototype.removeCustomMarkers=function(){for(var i,n=0,t=this.customMarkers;n<t.length;n++)i=t[n],i.onRemove()},i}(n.Maps.Map),i;t.NeighbourhoodMap=r;i=function(){function n(){}return n}();t.NeighourhoodMapStyle=i})(i=t.Neighbourhood||(t.Neighbourhood={}))})(t=n.Components||(n.Components={}))}(Scripts||(Scripts={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t;(function(n){var t;(function(n){var t=function(n){function t(t,i,r,u,f,e,o,s,h,c,l,a){var v=n.call(this,t,f,e,h)||this;return v.id=t,v.title=i,v.tooltip=r,v.address=u,v.latitude=f,v.longitude=e,v.markertype=o,v.colorClass=s,v.icon=h,v.subtype=c,v.distance=l,v.cluster=a,v}return __extends(t,n),t}(n.Marker);n.NeighbourhoodMarker=t})(t=n.Neighbourhood||(n.Neighbourhood={}))})(t=n.Components||(n.Components={}))}(Scripts||(Scripts={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t,i){this.centerMarker=n;this.bundles=t;this.dimensionCounts=i}return n}();n.NeighbourhoodModel=t})(t=n.Neighbourhood||(n.Neighbourhood={}))})(t=n.Components||(n.Components={}))}(Scripts||(Scripts={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function i(n){this.projectId=n;this.apiLocation="/api/sitecore/Neighbourhood/"}return i.prototype.getData=function(i){$.ajax({url:this.apiLocation+"Project?projectId="+this.projectId,dataType:"json",cache:!1,ifModified:!1,success:function(r){for(var a=[],u=null,y=new n.Components.Neighbourhood.Marker(r.CenterMarker.Id,r.CenterMarker.Latitude,r.CenterMarker.Longitude,r.CenterMarker.Icon),v=[],c,o,f,l,s,e=0,h=r.DimensionCounts;e<h.length;e++)c=h[e],v.push(new t.DimensionCount(c.Dimension,c.Count));for(o=0;o<r.DimensionBundles.length;o++){for(f=r.DimensionBundles[o],l=[],s=0;s<f.Markers.length;s++)u=f.Markers[s],l.push(new n.Components.Neighbourhood.NeighbourhoodMarker(u.Id,u.Title,u.Tooltip,u.Address,u.Latitude,u.Longitude,u.Markertype,u.ColorClass,u.Icon,u.Subtype,u.Distance,u.Cluster));a.push(new t.DimensionBundle(f.ID,f.Name,f.Color,l,!0))}i(new n.Components.Neighbourhood.NeighbourhoodModel(y,a,v))}.bind(this)})},i}();t.NeighbourhoodService=i})(i=t.Neighbourhood||(t.Neighbourhood={}))})(t=n.Components||(n.Components={}))}(Scripts||(Scripts={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function t(n,t){this.neighbourhoodService=n;this.neighbourhoodMap=t;this.neighbourhood=undefined;this.initiate();this.dimensionCounts=ko.observable("")}return t.prototype.refresh=function(){var i,n,r,u,t,f,e;for(this.neighbourhoodMap.removeCustomMarkers(),i=[],n=0,r=this.neighbourhood.bundles;n<r.length;n++)if(u=r[n],u.visible)for(t=0,f=this.groupAllMarkers(u.markers);t<f.length;t++)e=f[t],i.push(e);this.placeMarkers(this.neighbourhood.centerMarker,i)},t.prototype.initiate=function(){var n=this;this.neighbourhoodService.getData(function(t){var i,r,e,u,o,f;for(n.neighbourhood=t,i=n.neighbourhood.dimensionCounts.filter(function(n){return n.count>0}),i=i.sort(function(n,t){return n.count>t.count?-1:n.count<t.count?1:0}),r="",e=1,u=0,o=i;u<o.length;u++){if(f=o[u],r+=" "+f.count+" "+(f.dimension?f.dimension.toLowerCase():""),e<3)e++;else break;r+=", "}n.dimensionCounts(r);n.neighbourhoodMap.initiate(t.centerMarker.getPosition());n.neighbourhoodMap.setChangeEvents(function(){n.refresh()}.bind(n));n.neighbourhoodMap.addMarker(t.centerMarker.icon,t.centerMarker.getPosition())})},t.prototype.placeMarkers=function(n,t){for(var i,r,h,u,e,c,o,f=0,s=t;f<s.length;f++)if(i=s[f],r=i.markers[0],r)if(i.markers.length==1)this.neighbourhoodMap.addCustomTooltipMarker(r);else{for(h=!0,u="",e=0,c=i.markers;e<c.length;e++)o=c[e],u!==""&&o.cluster!==u?h=!1:o.cluster!==""&&(u=o.cluster);h&&u!==""?this.neighbourhoodMap.addCustomOpenClusterMarker(r,i.getPosition(),i.markers):this.neighbourhoodMap.addCustomClusterMarker(r,i.getPosition(),i.markers)}},t.prototype.groupAllMarkers=function(t){for(var f=[],r,o,u,s,h,c,i=0,e=t;i<e.length;i++){for(r=e[i],o=!1,u=0,s=f;u<s.length;u++)if(h=s[u],c=this.neighbourhoodMap.getDistanceBetweenLocationsInPixels(r.getPosition(),h.getPosition()),c<50){o=!0;h.addMarker(r);break}o||f.push(new n.MarkerGroup(r))}return f},t.prototype.toggleDimension=function(n){var t=this.neighbourhood.bundles.filter(function(t){return t.id===n})[0];t&&(t.visible=!t.visible,this.refresh())},t.prototype.selectDimension=function(n){var e=this.neighbourhood.bundles.filter(function(t){return t.id===n})[0],i,u,r,f,t;if(e)for(i=0,u=this.neighbourhood.bundles;i<u.length;i++)t=u[i],t.visible=t.id===n?!0:!1;else for(r=0,f=this.neighbourhood.bundles;r<f.length;r++)t=f[r],t.visible=!0;this.refresh()},t}();n.NeighbourhoodViewModel=t})(t=n.Neighbourhood||(n.Neighbourhood={}))})(t=n.Components||(n.Components={}))}(Scripts||(Scripts={}));$(document).ready(function(){var i=$(".js-neigbourhood").attr("data-guid"),n=new Scripts.Components.Neighbourhood.NeighbourhoodViewModel(new Scripts.Components.Neighbourhood.NeighbourhoodService(i),new Scripts.Components.Neighbourhood.NeighbourhoodMap("interactive-map-neighbourhood",[{featureType:"administrative.country",elementType:"geometry.stroke",stylers:[{visibility:"on"},{color:"#4ba4df"}]},{featureType:"administrative.country",elementType:"labels.text.fill",stylers:[{color:"#4ba4df"}]},{featureType:"administrative.province",elementType:"labels.text.fill",stylers:[{color:"#6d6d6d"},{visibility:"on"}]},{featureType:"administrative.locality",elementType:"labels.text.fill",stylers:[{color:"#555555"}]},{featureType:"administrative.neighborhood",elementType:"labels.text.fill",stylers:[{color:"#999999"}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#f2f2f2"}]},{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"}]},{featureType:"landscape.natural.landcover",elementType:"geometry.fill",stylers:[{visibility:"on"}]},{featureType:"poi.attraction",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.business",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.government",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.medical",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{color:"#e1eddd"}]},{featureType:"poi.place_of_worship",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.school",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"poi.sports_complex",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"road",elementType:"all",stylers:[{saturation:"-100"},{lightness:"45"}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#E9E9E9"}]},{featureType:"road.highway",elementType:"labels.icon",stylers:[{visibility:"on"},{hue:"#c6e7fd"},{saturation:"100"},{lightness:"5"}]},{featureType:"road.highway.controlled_access",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"road.highway.controlled_access",elementType:"geometry.fill",stylers:[{color:"#EFEFEF"}]},{featureType:"road.highway.controlled_access",elementType:"geometry.stroke",stylers:[{visibility:"on",color:"#EFEFEF"}]},{featureType:"road.highway.controlled_access",elementType:"labels.icon",stylers:[{lightness:"1"},{saturation:"100"},{hue:"#EFEFEF"}]},{featureType:"road.arterial",elementType:"geometry.fill",stylers:[{color:"#ffffff"}]},{featureType:"road.arterial",elementType:"labels.text.fill",stylers:[{color:"#8a8a8a"}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"road.local",elementType:"geometry.fill",stylers:[{color:"#ffffff"}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"transit.station.airport",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"transit.station.airport",elementType:"geometry.fill",stylers:[{lightness:"33"},{saturation:"-100"},{visibility:"on"}]},{featureType:"transit.station.bus",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"transit.station.rail",elementType:"all",stylers:[{visibility:"on"}]},{featureType:"water",elementType:"all",stylers:[{color:"#c6e7fd"},{visibility:"on"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{color:"#c6e7fd"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#ffffff"}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{visibility:"off"}]}])),t;$(".js-neighbourhood-item").click(function(){n.toggleDimension($(this).data("type"))});$(".js-neighbourhood-dimensionSelection").change(function(t){var i=$(t.target).val();n.selectDimension(i)});t=$("[data-type='neighbourhoodBarometer']")[0];ko.applyBindings(n,t)})