websiteComponents.loader.define("website.components.map.visitor",[],()=>(()=>{"use strict";var e={d:(t,a)=>{for(var i in a)e.o(a,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:a[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Visitor:()=>c,default:()=>y});const a={imgUrl:"/universal/images-v6/icons/cover-pages-map-marker-pin-dark-2x.png",naturalWidth:48,naturalHeight:64},i={Original:{marker:null,colors:[{elementType:"labels",stylers:[{visibility:"off"}]}],labels:[{elementType:"labels",stylers:[{visibility:"on"}]}]},Grayscale:{marker:a,colors:[{featureType:"landscape.man_made",elementType:"all",stylers:[{lightness:51}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"road.local",elementType:"all",stylers:[{gamma:2.51}]},{featureType:"road.arterial",elementType:"all",stylers:[{gamma:1.9}]},{featureType:"water",elementType:"all",stylers:[{gamma:1.36}]},{featureType:"road.highway",elementType:"all",stylers:[{gamma:1.33}]},{featureType:"transit.station.rail",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"transit.station.bus",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"transit",elementType:"all",stylers:[{gamma:1.2},{hue:"#0033ff"}]},{featureType:"administrative.neighborhood",elementType:"labels",stylers:[{gamma:1.43}]},{featureType:"water",elementType:"all",stylers:[{lightness:-47}]},{featureType:"all",elementType:"all",stylers:[{saturation:-100}]},{featureType:"road.arterial",elementType:"labels",stylers:[{lightness:23}]},{elementType:"labels",stylers:[{visibility:"off"}]}],labels:[{elementType:"labels",stylers:[{visibility:"on"}]}]},Satellite:{satellite:!0,marker:null,colors:[{stylers:[{visibility:"off"}]},{elementType:"labels",stylers:[{visibility:"off"}]}],labels:[{elementType:"labels",stylers:[{visibility:"on"}]}]},MinimalDark:{marker:{imgUrl:"/universal/images-v6/icons/cover-pages-map-marker-pin-light-2x.png",naturalWidth:48,naturalHeight:64},colors:[{stylers:[{visibility:"off"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{color:"#0f0f0f"},{visibility:"on"}]},{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{color:"#1f1f1f"},{visibility:"on"}]},{featureType:"road",elementType:"geometry.fill",stylers:[{color:"#5a5a5a"},{visibility:"on"},{weight:.6}]}],labels:[{elementType:"labels.text.fill",stylers:[{visibility:"on"},{color:"#777777"}]},{elementType:"labels.text.stroke",stylers:[{weight:2},{visibility:"on"},{color:"#1f1f1f"}]}]},MinimalLight:{marker:a,colors:[{stylers:[{visibility:"off"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{color:"#f2f2f2"},{visibility:"on"}]},{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{color:"#ffffff"},{visibility:"on"}]},{featureType:"road",elementType:"geometry.fill",stylers:[{color:"#bbbbbb"},{visibility:"on"},{weight:.6}]}],labels:[{elementType:"labels.text.fill",stylers:[{visibility:"on"},{color:"#999999"}]},{elementType:"labels.text.stroke",stylers:[{visibility:"on"},{color:"#ffffff"},{weight:2}]}]},MinimalBlue:{marker:a,colors:[{stylers:[{visibility:"off"}]},{featureType:"water",elementType:"geometry.fill",stylers:[{color:"#ccdee9"},{visibility:"on"}]},{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{color:"#ffffff"},{visibility:"on"}]},{featureType:"road",elementType:"geometry.fill",stylers:[{color:"#bbbbbb"},{visibility:"on"},{weight:.6}]}],labels:[{elementType:"labels.text.fill",stylers:[{visibility:"on"},{color:"#999999"}]},{elementType:"labels.text.stroke",stylers:[{visibility:"on"},{color:"#ffffff"},{weight:2}]}]}},l=[null,i.Original,i.Grayscale,i.Satellite,i.MinimalLight,i.MinimalDark,i.MinimalBlue],s=e=>{let{location:t,controls:a,terrain:i,labels:s,style:r,gmak:o,language:n,region:p}=e;return{location:t,ui:{showControls:a,showTerrain:i,showLabels:s,style:l[r]||void 0},gMapKey:o,language:n,region:p}},r=(new Map,function(e,t){const a=(i=t,window.atob(i));var i;return window.gMapsPromise||(window.gMapsPromise=new Promise((t,i)=>{const l=setTimeout(i,3e4);window.GoogleMapsApiLoadCallback=function(){clearTimeout(l),t(window.google.maps);try{delete window.GoogleMapsApiLoadCallback}catch{console.error("unable to run delete window.GoogleMapsApiLoadCallback")}};const s=document.createElement("script");document.getElementsByTagName("head")[0].appendChild(s),a?s.src=((e,t)=>{let a=`//maps.googleapis.com/maps/api/js?v=3&callback=GoogleMapsApiLoadCallback&key=${t}`;return a+=`&language=${(null==e?void 0:e.language)||"en"}®ion=${(null==e?void 0:e.region)||"US"}`,a})(e,a):console.error("missing Google Maps API key")})),window.gMapsPromise}),o={mapLat:40.720882,mapLng:-74.000988,markerLat:null,markerLng:null,mapZoom:12,addressTitle:null,addressLine1:null,addressLine2:null,addressCountry:null},n={style:i.Grayscale,showLabels:!0,showTerrain:!1,draggable:!0,scrollwheel:!0,showControls:!0,disableDefaultUI:!0,markerDraggable:!1,linkOnClick:!0};class p{static createView(e,t,a,i){return e=Object.entries(e).reduce(function(e,t){let[a,i]=t;return void 0!==i&&(e[a]=i),e},{}),e=Object.assign({},n,e),null===(t=Object.assign({},o,t)).markerLat&&(t.markerLat=t.mapLat),null===t.markerLng&&(t.markerLng=t.mapLng),r(i,i.gMapKey).then(i=>new p(i,e,t,a))}constructor(e,t,a,i){this.GMaps=e,this.ui=t,this.location=a,this.render(i)}render(e){const t=this.GMaps;this.container=e;const{markerLat:a,markerLng:i,mapLat:l,mapLng:s}=this.location;e.classList.add("page-map"),e.innerHTML=" ",this.markerLoc=new t.LatLng(a,i),this.mapLoc=new t.LatLng(l,s),this.locationString=this.getLocationString(),this.initMapImpl(),this.initMarkerImpl(),this.updateUIOptions()}initMapImpl(){this.map=new this.GMaps.Map(this.container,{zoom:this.location.mapZoom,center:this.mapLoc,draggable:this.ui.draggable,scrollwheel:this.ui.scrollwheel,disableDefaultUI:this.ui.disableDefaultUI})}initMarkerImpl(){const e=this.GMaps,t=this.location;this.marker=new e.Marker({map:this.map,animation:e.Animation.DROP,draggable:this.ui.markerDraggable,position:this.markerLoc,title:t.addressTitle?t.addressTitle+" "+this.locationString:this.locationString,icon:""}),e.event.addListener(this.marker,"click",()=>this.handleMarkerClick())}getLocationString(){const e=this.location;let t;return e.addressLine1||e.addressLine2?(t=e.addressLine1+" "+e.addressLine2,e.addressCountry&&(t+=", "+e.addressCountry)):t=e.mapLat+","+e.mapLng,t}handleMarkerClick(){if(this.marker.dragging||!this.ui.linkOnClick)return;const e=encodeURIComponent(this.marker.getPosition().toUrlValue()),t=encodeURIComponent(this.getLocationString()),a=encodeURIComponent(this.map.getZoom());window.open(`http://maps.google.com/maps?sll=${e}&q=${t}&z=${a}`)}redraw(){this.GMaps.event.trigger(this.map,"resize")}updateUIOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this.GMaps;Object.assign(this.ui,e);const{showControls:a,showTerrain:i,showLabels:l,draggable:s,disableDefaultUI:r,scrollwheel:o,markerDraggable:n}=this.ui,p={...this.ui.style},m=[];let c;m.push(...p.colors),l&&p.labels&&m.push(...p.labels),c=p.satellite?t.MapTypeId.HYBRID:i?t.MapTypeId.TERRAIN:t.MapTypeId.ROADMAP;const y={mapTypeControl:!1,mapTypeId:c,overviewMapControl:!1,panControl:a,scaleControl:a,streetViewControl:!1,styles:m,zoomControl:a,draggable:s,disableDefaultUI:r,scrollwheel:o};this.map.setOptions(y);const g={draggable:n};if(this.marker.setOptions(g),p.marker){const e=p.marker.imgUrl,a=p.marker.naturalWidth,i=p.marker.naturalHeight;this.marker.setIcon({url:e,size:new t.Size(a,i),scaledSize:new t.Size(a/2,i/2),anchor:new t.Point(a/4,i/2)})}else this.marker.setIcon(null)}centerMarker(){this.redraw(),this.map.setCenter(this.marker.getPosition())}getCenter(){const e=this.map.getCenter();return{lat:e.lat(),lng:e.lng()}}updateLocation(e,t){this.location.mapLat=e,this.location.mapLng=t,this.map.setCenter(new this.GMaps.LatLng(e,t)),this.updateMarker(e,t)}getMarkerPosition(){const e=this.marker.getPosition();return{lat:e.lat(),lng:e.lng()}}updateMarker(e,t){const a=this.location;this.location.markerLat=e,this.location.markerLng=t;const i=this.getLocationString();this.marker.setPosition(new this.GMaps.LatLng(e,t)),this.marker.title=a.addressTitle?a.addressTitle+" "+i:i}setZoom(e){this.location.mapZoom=e,this.map.setZoom(e)}}const m=p;class c{constructor(e){this.root=e,this.render()}createMap(e,t){this.awaitedMapView=m.createView(e.ui,e.location,t,e)}applyStretchedToFillHeightOverride(){const e=this.root,t=e.querySelector(".sqs-block-content");t&&e.parentElement&&(e.parentElement.classList.contains("fluid-engine-block-contents")||e.parentElement.classList.contains("fe-block"))&&(t.style.height="100%")}async updateMap(e){const t=this.root.querySelector("[data-context]");if(t){const a=s(e),{mapLat:i,mapLng:l,mapZoom:r}=a.location,o=await this.awaitedMapView;o&&(o.setZoom(r),o.updateLocation(i,l),o.updateUIOptions(a.ui),o.render(t))}}render(){const e=this.root,t=e.querySelector("[data-context]");if(t){this.applyStretchedToFillHeightOverride();const a=JSON.parse((null==t?void 0:t.getAttribute("data-context"))||"{}"),i=s(a);e.setAttribute("data-animation-role","image"),this.awaitedMapView?this.awaitedMapView.then(e=>{e.render(t)}):this.createMap(i,t)}}}const y=e=>new c(e);return t})());