"use strict";function DataLayerClusterer(n){var t,i,r;DataLayerClusterer.extend(DataLayerClusterer,google.maps.OverlayView);this.addListener=function(n,t){return this._dataLayer.addListener(n,t)};t=n||{};this.clusters_=[];this.sizes=[50,70,90];this.colors=["#0C5950","#0C5950","#0C5950"];this.ready_=!1;this.map=t.map||null;this.gridSize_=t.gridSize||60;this.minClusterSize_=t.minimumClusterSize||2;this.minPolySize_=t.minimumPolySize||50;this.setProperty_=t.setProperty||!1;this.maxZoom_=t.maxZoom||null;this.className_=t.className||"cluster";this.styles_=t.styles||[];this.imagePath_=t.imagePath||DataLayerClusterer.MARKER_CLUSTER_IMAGE_PATH_;this.imageExtension_=t.imageExtension||DataLayerClusterer.MARKER_CLUSTER_IMAGE_EXTENSION_;this.zoomOnClick_=t.zoomOnClick!==undefined?t.zoomOnClick:!0;this.averageCenter_=t.averageCenter!==undefined?t.averageCenter:!0;this._dataLayer=new google.maps.Data;this.firstIdle_=!0;this.prevBounds_=null;this.recolorSVG_=typeof t.recolorSVG!="undefined"&&(typeof t.recolorSVG=="string"||t.recolorSVG instanceof String||t.recolorSVG===!1)?t.recolorSVG:"g:first-child";this.baseSVG_=null;this.recolorSVG_&&this.imageExtension_=="svg"?(i=this,r=new XMLHttpRequest,r.open("GET",/\.svg$/.test(this.imagePath_)?this.imagePath_:this.imagePath_+"1."+this.imageExtension_),r.overrideMimeType("image/svg+xml"),r.send(""),r.onreadystatechange=function(){this.readyState==4&&(this.status==200?(i.baseSVG_={document:r.responseXML.documentElement,colorElement:r.responseXML.documentElement.querySelector(i.recolorSVG_)},i.baseSVG_.document&&i.baseSVG_.colorElement||(i.recolorSVG_=!1)):i.recolorSVG_=!1,i.init_())}):this.init_()}function FeatureCluster(n){this.featureClusterer_=n;this.map_=n.getMap();this.minClusterSize_=n.getMinClusterSize();this.averageCenter_=n.isAverageCenter();this.center_=null;this.features_=[];this.bounds_=null;this.classId=n.className_+"-"+this.featureClusterer_.clusters_.length;this.clusterIcon_=new FeatureClusterIcon(this,n.getStyles(),n.getGridSize(),this.classId);this.forced_=!1}function FeatureClusterIcon(n,t,i,r){DataLayerClusterer.extend(FeatureClusterIcon,google.maps.OverlayView);this.styles_=t;this.padding_=i||0;this.cluster_=n;this.center_=null;this.map_=n.getMap();this.div_=null;this.sums_=null;this.visible_=!1;this.classId=r;this.setMap(this.map_)}function MapLabel(n){this.set("fontFamily","sans-serif");this.set("fontSize",12);this.set("fontColor","#000000");this.set("strokeWeight",4);this.set("strokeColor","#ffffff");this.set("align","center");this.set("zIndex",1e3);this.setValues(n)}function ContextMenu(n,t){t=t||{};this.setMap(n);this.map_=n;this.mapDiv_=n.getDiv();this.classNames_=t.classNames||{};this.menuItems_=t.menuItems||[];this.pixelOffset=t.pixelOffset||new google.maps.Point(10,-5);this.zIndex=t.zIndex||null}var Mrwa;DataLayerClusterer.CLUSTER_PROPERTY_NAME="in_cluster";DataLayerClusterer.VISIBLE_FEATURE={visible:!0};DataLayerClusterer.HIDDEN_FEATURE={visible:!1};DataLayerClusterer.prototype.setVisible=function(n){n?(this.map__||(this.map__=this.map||this.map_),this.setMap(this.map__),this._dataLayer.setMap(this.map__),this.onAdd(),this.redraw()):(this.map__=this.getMap(),google.maps.event.removeListener(this._idle),google.maps.event.removeListener(this._zoomchanged),this._dataLayer.setMap(null),this.setMap(null),this.resetViewport())};DataLayerClusterer.prototype.getTotalClusters=function(){return this.clusters_.length};DataLayerClusterer.prototype.getExtendedBounds=function(n){var t=this.getProjection(),e=new google.maps.LatLng(n.getNorthEast().lat(),n.getNorthEast().lng()),o=new google.maps.LatLng(n.getSouthWest().lat(),n.getSouthWest().lng()),r=t.fromLatLngToDivPixel(e),i,u,f;return r.x+=this.gridSize_,r.y-=this.gridSize_,i=t.fromLatLngToDivPixel(o),i.x-=this.gridSize_,i.y+=this.gridSize_,u=t.fromDivPixelToLatLng(r),f=t.fromDivPixelToLatLng(i),n.extend(u),n.extend(f),n};DataLayerClusterer.prototype.redraw=function(){var n=this.clusters_.slice();this.clusters_.length=0;this.createClusters_();window.requestAnimationFrame(function(){for(var i=n.length,t=0;t!==i;++t)n[t].remove()});this.map_&&(this.prevBounds_=this.map_.getBounds())};DataLayerClusterer.prototype.isZoomOnClick=function(){return this.zoomOnClick_};DataLayerClusterer.prototype.SetMap=function(n){this.map=n;this.setMap(this.map)};DataLayerClusterer.prototype.isAverageCenter=function(){return this.averageCenter_};DataLayerClusterer.prototype.setMaxZoom=function(n){this.maxZoom_=n};DataLayerClusterer.prototype.getMaxZoom=function(){return this.maxZoom_};DataLayerClusterer.prototype.getGridSize=function(){return this.gridSize_};DataLayerClusterer.prototype.setGridSize=function(n){this.gridSize_=n};DataLayerClusterer.prototype.getMinClusterSize=function(){return this.minClusterSize_};DataLayerClusterer.prototype.setMinClusterSize=function(n){this.minClusterSize_=n};DataLayerClusterer.prototype.add=function(n){return this._dataLayer.add(n)};DataLayerClusterer.prototype.addGeoJson=function(n,t){return this._dataLayer.addGeoJson(n,t)};DataLayerClusterer.prototype.contains=function(n){return this._dataLayer.contains(n)};DataLayerClusterer.prototype.forEach=function(n){return this._dataLayer.forEach(n)};DataLayerClusterer.prototype.getControlPosition=function(){return this._dataLayer.getControlPosition()};DataLayerClusterer.prototype.getControls=function(){return this._dataLayer.getControls()};DataLayerClusterer.prototype.getDrawingMode=function(){return this._dataLayer.getDrawingMode()};DataLayerClusterer.prototype.getFeatureById=function(n){return this._dataLayer.getFeatureById(n)};DataLayerClusterer.prototype.getStyle=function(){return this._dataLayer.getStyle()};DataLayerClusterer.prototype.loadGeoJson=function(n,t,i){return this._dataLayer.loadGeoJson(n,t,i)};DataLayerClusterer.prototype.overrideStyle=function(n,t){return this._dataLayer.overrideStyle(n,t)};DataLayerClusterer.prototype.remove=function(n){return this._dataLayer.remove(n)};DataLayerClusterer.prototype.revertStyle=function(n){return this._dataLayer.revertStyle(n)};DataLayerClusterer.prototype.setControlPosition=function(n){return this._dataLayer.setControlPosition(n)};DataLayerClusterer.prototype.setControls=function(n){return this._dataLayer.setControls(n)};DataLayerClusterer.prototype.setDrawingMode=function(n){return this._dataLayer.setDrawingMode(n)};DataLayerClusterer.prototype.setStyle=function(n){var t=this._dataLayer.setStyle(n);return this.setProperty_&&this.redraw(),t};DataLayerClusterer.prototype.toGeoJson=function(n){return this._dataLayer.toGeoJson(n)};DataLayerClusterer.prototype.resetViewport=function(){for(var t=this.clusters_.length,n=0;n!==t;++n)this.clusters_[n].remove();this.clusters_=[]};DataLayerClusterer.prototype.setReady_=function(n){this.ready_=n;n&&this.createClusters_()};DataLayerClusterer.prototype.isFeatureInBounds_=function(n,t){var r=n.getGeometry(),i=!1,u;return r.getType()=="Point"?i=t.contains(r.get()):(u=this,r.getArray().forEach(function(n){return i=n instanceof google.maps.LatLng?t.contains(n):t.contains(u.featureCenter_(n)),!i})),i};DataLayerClusterer.prototype.distanceBetweenPoints_=function(n,t){if(!n||!t)return 0;var i=(t.lat()-n.lat())*Math.PI/180,r=(t.lng()-n.lng())*Math.PI/180,u=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n.lat()*Math.PI/180)*Math.cos(t.lat()*Math.PI/180)*Math.sin(r/2)*Math.sin(r/2),f=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u));return 6371*f};DataLayerClusterer.prototype.featureBounds_=function(n,t){var r=n.getGeometry?n.getGeometry():n,i=t||new google.maps.LatLngBounds;return r.getType()=="Point"?i.extend(r.get()):r.getArray().forEach(function(n){n instanceof google.maps.LatLng?i.extend(n):n.getArray().forEach(function(n){i.extend(n)})}),i};DataLayerClusterer.prototype.featureCenter_=function(n){var t=n.getGeometry?n.getGeometry():n;return t.getType()=="Point"?t.get():this.featureBounds_(n).getCenter()};DataLayerClusterer.prototype.addToClosestCluster_=function(n){var e=4e4,h=this.featureCenter_(n),t,o=!0,c=n.getProperty(DataLayerClusterer.CLUSTER_PROPERTY_NAME),i,s,r,u,f;if(n.setProperty(DataLayerClusterer.CLUSTER_PROPERTY_NAME,!1),i=this.getStyle(n),typeof i=="function"&&(i=i(n)),o=typeof i.visible=="undefined"||i.visible,n.setProperty(DataLayerClusterer.CLUSTER_PROPERTY_NAME,c),o){for(s=this.clusters_.length,r=0;r!==s;++r)u=this.clusters_[r].getCenter(),u&&(f=this.distanceBetweenPoints_(u,h),f<e&&(e=f,t=this.clusters_[r]));t&&t.isFeatureInClusterBounds(n)?t.addFeature(n):(t=new FeatureCluster(this),t.addFeature(n),this.clusters_.push(t))}};DataLayerClusterer.prototype.createClusters_=function(){if(this.ready_&&this.map_){var t=new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(),this.map_.getBounds().getNorthEast()),i=this.getExtendedBounds(t),n=this;this.forEach(function(t){n.isFeatureInBounds_(t,i)&&n.addToClosestCluster_(t)})}};DataLayerClusterer.prototype.onAdd=function(){var t=this.getMap(),n;this.map_!==t&&this.onRemove();this.map_=t;this.map_!==null?(this._dataLayer.setMap(this.map_),this.prevZoom_=this.map_.getZoom(),n=this,this._zoomchanged=google.maps.event.addListener(this.map_,"zoom_changed",function(){var t=n.map_.getZoom(),i=n.prevBounds_&&n.prevBounds_.equals(n.map_.getBounds());n.prevZoom_!==t&&i!==!0&&(n.prevZoom_=t,n.resetViewport())}),this._idle=google.maps.event.addListener(this.map_,"idle",function(){var t=n.map_&&n.prevZoom_&&n.prevZoom_===n.map_.getZoom()&&n.prevBounds_&&n.prevBounds_.equals(n.map_.getBounds());n.firstIdle_||t===!0||n.redraw();n.firstIdle_=!1}),this.setReady_(!0)):this.setReady_(!1)};DataLayerClusterer.prototype.onRemove=function(){if(this.map_!==null){if(this._zoomchanged!==null)try{this.map_.removeListener(this._zoomchanged)}catch(n){}if(this._idle!==null)try{this.map_.removeListener(this._idle)}catch(n){}}this._dataLayer.setMap(null);this.map_=null;this.setReady_(!1)};DataLayerClusterer.prototype.draw=function(){};DataLayerClusterer.extend=function(n,t){return function(n){for(var t in n.prototype)n.prototype[t]&&(this.prototype[t]=n.prototype[t]);return this}.apply(n,[t])};FeatureCluster.prototype.isFeatureAlreadyAdded=function(n){var i,t;if(this.features_.indexOf)return this.features_.indexOf(n)!==-1;for(i=this.features_.length,t=0;t!==i;++t)if(this.features_[t]===n)return!0;return!1};FeatureCluster.prototype.addFeature=function(n){var c,r,i,t;if(this.isFeatureAlreadyAdded(n))return!1;if(c=n.getGeometry(),r=this.center_||this.featureClusterer_.featureCenter_(n),this.center_){if(this.averageCenter_){var u=this.features_.length+1,l=(this.center_.lat()*(u-1)+r.lat())/u,a=(this.center_.lng()*(u-1)+r.lng())/u;this.center_=new google.maps.LatLng(l,a);this.calculateBounds_()}}else this.center_=r,this.calculateBounds_();if(n.setProperty("clusterID",this.classId),this.features_.push(n),i=this.features_.length,i==1&&!!this.featureClusterer_.minPolySize_&&n.getGeometry().getType()!="Point"){var f=this.featureClusterer_.minPolySize_,e=this.featureClusterer_.featureBounds_(n),v=e.getSouthWest(),y=e.getNorthEast(),o=this.map_.getProjection(),s=o.fromLatLngToPoint(v),h=o.fromLatLngToPoint(y),p=Math.round(Math.abs((h.x-s.x)*Math.pow(2,this.map_.getZoom()))),w=Math.round(Math.abs((s.y-h.y)*Math.pow(2,this.map_.getZoom())));this.forced_=p<f&&w<f?!0:!1}if(i<this.minClusterSize_&&!this.forced_&&(this.featureClusterer_.setProperty_?n.setProperty(DataLayerClusterer.CLUSTER_PROPERTY_NAME,!1):this.featureClusterer_.overrideStyle(n,DataLayerClusterer.VISIBLE_FEATURE),n.setProperty(DataLayerClusterer.CLUSTER_PROPERTY_NAME,!1)),i>=this.minClusterSize_||this.forced_)for(t=0;t<i;t++)this.featureClusterer_.setProperty_?this.features_[t].setProperty(DataLayerClusterer.CLUSTER_PROPERTY_NAME,!0):this.featureClusterer_.overrideStyle(this.features_[t],DataLayerClusterer.HIDDEN_FEATURE),this.features_[t].setProperty(DataLayerClusterer.CLUSTER_PROPERTY_NAME,!0);return this.updateIcon(),!0};FeatureCluster.prototype.getDataLayerClusterer=function(){return this.featureClusterer_};FeatureCluster.prototype.getBounds=function(){for(var n=new google.maps.LatLngBounds(this.center_,this.center_),i=this.features_.length,t=0;t!==i;++t)n=this.featureClusterer_.featureBounds_(this.features_[t],n);return n};FeatureCluster.prototype.remove=function(){this.clusterIcon_.remove();this.features_.length=0;delete this.features_};FeatureCluster.prototype.getSize=function(){return this.features_.length};FeatureCluster.prototype.getFeatures=function(){return this.features_};FeatureCluster.prototype.getCenter=function(){return this.center_};FeatureCluster.prototype.calculateBounds_=function(){var n=new google.maps.LatLngBounds(this.center_,this.center_);this.bounds_=this.featureClusterer_.getExtendedBounds(n)};FeatureCluster.prototype.isFeatureInClusterBounds=function(n){return this.bounds_.contains(this.featureClusterer_.featureCenter_(n))};FeatureCluster.prototype.getMap=function(){return this.map_};FeatureCluster.prototype.updateIcon=function(){var f=this.map_.getZoom(),t=this.featureClusterer_.getMaxZoom(),i,n,r,u;if(t&&f>t){for(i=this.features_.length,n=0;n!==i;++n)this.featureClusterer_.setProperty_?this.features_[n].setProperty(DataLayerClusterer.CLUSTER_PROPERTY_NAME,!1):this.featureClusterer_.overrideStyle(this.features_[n],DataLayerClusterer.VISIBLE_FEATURE),this.features_[n].setProperty(DataLayerClusterer.CLUSTER_PROPERTY_NAME,!1);return}if(this.features_.length<this.minClusterSize_&&!this.forced_){this.clusterIcon_.hide();return}r=this.featureClusterer_.getStyles().length;u=this.featureClusterer_.getCalculator()(this.features_,r);this.clusterIcon_.setSums(u);this.clusterIcon_.setCenter(this.center_);this.clusterIcon_.show()};FeatureClusterIcon.prototype.hide=function(){this.div_&&(this.div_.style.display="none");this.visible_=!1};FeatureClusterIcon.prototype.show=function(){if(this.div_){var n=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(n);this.div_.style.display=""}this.visible_=!0};FeatureClusterIcon.prototype.remove=function(){this.setMap(null)};FeatureClusterIcon.prototype.setCenter=function(n){this.center_=n};FeatureClusterIcon.prototype.onAdd=function(){var n,t,i;this.div_=document.createElement("DIV");this.visible_&&(n=this.getPosFromLatLng_(this.center_),this.div_.style.cssText=this.createCss(n),this.div_.innerHTML=this.sums_.text,this.div_.className=this.cluster_.featureClusterer_.className_+" "+this.classId);t=this.getPanes();t.overlayMouseTarget.appendChild(this.div_);i=this;google.maps.event.addDomListener(this.div_,"click",function(){i.triggerClusterClick()})};FeatureClusterIcon.prototype.draw=function(){if(this.visible_){var n=this.getPosFromLatLng_(this.center_);this.div_.style.top=n.y+"px";this.div_.style.left=n.x+"px"}};FeatureClusterIcon.prototype.onRemove=function(){this.div_&&this.div_.parentNode&&(this.hide(),this.div_.parentNode.removeChild(this.div_),this.div_=null)};FeatureClusterIcon.prototype.triggerClusterClick=function(){var n=this.cluster_.getDataLayerClusterer();google.maps.event.trigger(n,"clusterclick",this.cluster_);n.isZoomOnClick()&&this.map_.fitBounds(this.cluster_.getBounds())};FeatureClusterIcon.prototype.getPosFromLatLng_=function(n){var t=this.getProjection().fromLatLngToDivPixel(n);return t.x-=parseInt(this.width_/2,10),t.y-=parseInt(this.height_/2,10),t};FeatureClusterIcon.prototype.createCss=function(n){var t=[],i,r,u;return t.push("background-image:url("+this.url_+");"),this.cluster_.featureClusterer_.recolorSVG_&&t.push("background-size: contain;"),i=this.backgroundPosition_?this.backgroundPosition_:"0 0",t.push("background-position:"+i+";"),typeof this.anchor_=="object"?(typeof this.anchor_[0]=="number"&&this.anchor_[0]>0&&this.anchor_[0]<this.height_?t.push("height:"+(this.height_-this.anchor_[0])+"px; padding-top:"+this.anchor_[0]+"px;"):t.push("height:"+this.height_+"px; line-height:"+this.height_+"px;"),typeof this.anchor_[1]=="number"&&this.anchor_[1]>0&&this.anchor_[1]<this.width_?t.push("width:"+(this.width_-this.anchor_[1])+"px; padding-left:"+this.anchor_[1]+"px;"):t.push("width:"+this.width_+"px; text-align:center;")):t.push("height:"+this.height_+"px; line-height:"+this.height_+"px; width:"+this.width_+"px; text-align:center;"),r=this.textColor_?this.textColor_:"white",u=this.textSize_?this.textSize_:11,t.push("cursor:pointer; top:"+n.y+"px; left:"+n.x+"px; color:"+r+"; position:absolute; font-size:"+u+'px; font-family:"Heebo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; font-weight:bold'),t.join("")};FeatureClusterIcon.prototype.useStyle=function(){var t=Math.max(0,this.sums_.index-1),n;t=Math.min(this.styles_.length-1,t);n=this.styles_[t];this.url_=n.url;this.height_=n.height;this.width_=n.width;this.textColor_=n.textColor;this.anchor_=n.anchor;this.textSize_=n.textSize;this.backgroundPosition_=n.backgroundPosition};FeatureClusterIcon.prototype.setSums=function(n){this.sums_=n;this.text_=n.text;this.index_=n.index;this.div_&&(this.div_.innerHTML=n.text);this.useStyle()};DataLayerClusterer.MARKER_CLUSTER_IMAGE_PATH_="https://cdn.rawgit.com/Connum/data-layer-clusterer/master/images/m";DataLayerClusterer.MARKER_CLUSTER_IMAGE_EXTENSION_=document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1")?"svg":"png";DataLayerClusterer.prototype.init_=function(){this.setupStyles_();this.map!==null&&this.setMap(this.map)};DataLayerClusterer.prototype.setupStyles_=function(){var t,n;if(!this.styles_.length)for(t=this.sizes.length,n=0;n!==t;++n){var i=this.sizes[n],u=this.colors[n],r=this.imagePath_+(n+1)+"."+this.imageExtension_;this.recolorSVG_&&(this.baseSVG_.colorElement.style.fill=u,r="data:image/svg+xml;base64,"+btoa(this.baseSVG_.document.outerHTML));this.styles_.push({url:r,height:i,width:i})}};DataLayerClusterer.prototype.setStyles=function(n){this.styles_=n};DataLayerClusterer.prototype.getStyles=function(){return this.styles_};DataLayerClusterer.prototype.setCalculator=function(n){this.calculator_=n};DataLayerClusterer.prototype.getCalculator=function(){return this.calculator_};DataLayerClusterer.prototype.calculator_=function(n,t){for(var i=0,u=n.length,r=u;r!==0;)r=parseInt(r/10,10),i++;return i=Math.min(i,t),{text:u,index:i}};window.DataLayerClusterer=DataLayerClusterer;MapLabel.prototype=new google.maps.OverlayView;window.MapLabel=MapLabel;MapLabel.prototype.changed=function(n){switch(n){case"fontFamily":case"fontSize":case"fontColor":case"strokeWeight":case"strokeColor":case"align":case"text":return this.drawCanvas_();case"maxZoom":case"minZoom":case"position":return this.draw()}};MapLabel.prototype.drawCanvas_=function(){var i=this.canvas_,u,n,t,r,f,e;i&&(u=i.style,u.zIndex=this.get("zIndex"),n=i.getContext("2d"),n.clearRect(0,0,i.width,i.height),n.strokeStyle=this.get("strokeColor"),n.fillStyle=this.get("fontColor"),n.font=this.get("fontSize")+"px "+this.get("fontFamily"),t=Number(this.get("strokeWeight")),r=this.get("text"),r&&(t&&(n.lineWidth=t,n.strokeText(r,t,t)),n.fillText(r,t,t),f=n.measureText(r),e=f.width+t,u.marginLeft=this.getMarginLeft_(e)+"px",u.marginTop="-0.4em"))};MapLabel.prototype.onAdd=function(){var n=this.canvas_=document.createElement("canvas"),r,t,i;n.width=420;r=n.style;r.position="absolute";t=n.getContext("2d");t.lineJoin="round";t.textBaseline="top";this.drawCanvas_();i=this.getPanes();i&&i.mapPane.appendChild(n)};MapLabel.prototype.onAdd=MapLabel.prototype.onAdd;MapLabel.prototype.getMarginLeft_=function(n){switch(this.get("align")){case"left":return 0;case"right":return-n}return n/-2};MapLabel.prototype.draw=function(){var r=this.getProjection(),t,i,n;r&&this.canvas_&&(t=this.get("position"),t)&&(i=r.fromLatLngToDivPixel(t),n=this.canvas_.style,n.top=i.y+"px",n.left=i.x+"px",n.visibility=this.getVisible_())};MapLabel.prototype.draw=MapLabel.prototype.draw;MapLabel.prototype.getVisible_=function(){var i=this.get("minZoom"),r=this.get("maxZoom"),n,t;return i===undefined&&r===undefined?"":(n=this.getMap(),!n)?"":(t=n.getZoom(),t<i||t>r)?"hidden":""};MapLabel.prototype.onRemove=function(){var n=this.canvas_;n&&n.parentNode&&n.parentNode.removeChild(n)};MapLabel.prototype.onRemove=MapLabel.prototype.onRemove;ContextMenu.prototype=new google.maps.OverlayView;ContextMenu.prototype.draw=function(){if(this.isVisible_){var u=new google.maps.Size(this.mapDiv_.offsetWidth,this.mapDiv_.offsetHeight),n=new google.maps.Size(this.menu_.offsetWidth,this.menu_.offsetHeight),t=this.getProjection().fromLatLngToDivPixel(this.position_),i=t.x,r=t.y;t.x>u.width-n.width-this.pixelOffset.x?i=i-n.width-this.pixelOffset.x:i+=this.pixelOffset.x;t.y>u.height-n.height-this.pixelOffset.y?r=r-n.height-this.pixelOffset.y:r+=this.pixelOffset.y;this.menu_.style.left=i+"px";this.menu_.style.top=r+"px"}};ContextMenu.prototype.getVisible=function(){return this.isVisible_};ContextMenu.prototype.hide=function(){this.isVisible_&&(this.menu_.style.display="none",this.isVisible_=!1)};ContextMenu.prototype.onAdd=function(){function f(n){var i=document.createElement("div");return i.innerHTML=n.label,n.className&&(i.className=n.className||self.classNames_.menuItem),n.id&&(i.id=n.id),i.style.cssText="cursor:pointer; white-space:nowrap",i.onclick=function(){google.maps.event.trigger(t,"menu_item_selected",t.position_,n.eventName,t.source);t.hide()},i}function e(){var n=document.createElement("div");return t.classNames_.menuSeparator&&(n.className=t.classNames_.menuSeparator),n}var t=this,n=document.createElement("div"),i,r,u;for(this.classNames_.menu&&(n.className=this.classNames_.menu),n.style.cssText="display:none; position:absolute",this.zIndex!=null&&(n.style.zIndex=this.zIndex),i=function(n){var t=n?n:window.event;t.stopPropagation&&t.stopPropagation();t.cancelBubble!=null&&(t.cancelBubble=!0)},n.onclick=i,n.onmouseover=i,n.onmousemove=i,n.onmouseenter=i,n.onmouseleave=i,n.onmouseout=i,r=0,u=this.menuItems_.length;r<u;r++)this.menuItems_[r].label&&this.menuItems_[r].eventName?n.appendChild(f(this.menuItems_[r])):n.appendChild(e());delete this.classNames_;delete this.menuItems_;this.isVisible_=!1;this.menu_=n;this.position_=new google.maps.LatLng(0,0);google.maps.event.addListener(this.map_,"click",function(){t.hide()});this.getPanes().floatPane.appendChild(n)};ContextMenu.prototype.onRemove=function(){this.menu_.parentNode.removeChild(this.menu_);delete this.mapDiv_;delete this.menu_;delete this.position_};ContextMenu.prototype.show=function(n,t){this.source=t;this.isVisible_||(this.menu_.style.display="block",this.isVisible_=!0);this.position_=n;this.draw()};!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.moment=t()}(this,function(){function t(){return we.apply(null,arguments)}function bo(n){we=n}function tt(n){return n instanceof Array||"[object Array]"===Object.prototype.toString.call(n)}function si(n){return null!=n&&"[object Object]"===Object.prototype.toString.call(n)}function ko(n){for(var t in n)return!1;return!0}function p(n){return void 0===n}function dt(n){return"number"==typeof n||"[object Number]"===Object.prototype.toString.call(n)}function bi(n){return n instanceof Date||"[object Date]"===Object.prototype.toString.call(n)}function rf(n,t){for(var r=[],i=0;i<n.length;++i)r.push(t(n[i],i));return r}function l(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function vt(n,t){for(var i in t)l(t,i)&&(n[i]=t[i]);return l(t,"toString")&&(n.toString=t.toString),l(t,"valueOf")&&(n.valueOf=t.valueOf),n}function ut(n,t,i,r){return te(n,t,i,r,!0).utc()}function go(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function u(n){return null==n._pf&&(n._pf=go()),n._pf}function yr(n){if(null==n._isValid){var t=u(n),r=oy.call(t.parsedDateParts,function(n){return null!=n}),i=!isNaN(n._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&r);if(n._strict&&(i=i&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(n))return i;n._isValid=i}return n._isValid}function ki(n){var t=ut(NaN);return null!=n?vt(u(t),n):u(t).userInvalidated=!0,t}function pr(n,t){var i,r,f;if(p(t._isAMomentObject)||(n._isAMomentObject=t._isAMomentObject),p(t._i)||(n._i=t._i),p(t._f)||(n._f=t._f),p(t._l)||(n._l=t._l),p(t._strict)||(n._strict=t._strict),p(t._tzm)||(n._tzm=t._tzm),p(t._isUTC)||(n._isUTC=t._isUTC),p(t._offset)||(n._offset=t._offset),p(t._pf)||(n._pf=u(t)),p(t._locale)||(n._locale=t._locale),lu.length>0)for(i=0;i<lu.length;i++)r=lu[i],f=t[r],p(f)||(n[r]=f);return n}function hi(n){pr(this,n);this._d=new Date(null!=n._d?n._d.getTime():NaN);this.isValid()||(this._d=new Date(NaN));au===!1&&(au=!0,t.updateOffset(this),au=!1)}function yt(n){return n instanceof hi||null!=n&&null!=n._isAMomentObject}function d(n){return n<0?Math.ceil(n)||0:Math.floor(n)}function f(n){var t=+n,i=0;return 0!==t&&isFinite(t)&&(i=d(t)),i}function uf(n,t,i){for(var e=Math.min(n.length,t.length),o=Math.abs(n.length-t.length),u=0,r=0;r<e;r++)(i&&n[r]!==t[r]||!i&&f(n[r])!==f(t[r]))&&u++;return u+o}function ff(n){t.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+n)}function g(n,i){var r=!0;return vt(function(){var u,e,f,o;if(null!=t.deprecationHandler&&t.deprecationHandler(null,n),r){for(e=[],f=0;f<arguments.length;f++){if(u="","object"==typeof arguments[f]){u+="\n["+f+"] ";for(o in arguments[0])u+=o+": "+arguments[0][o]+", ";u=u.slice(0,-2)}else u=arguments[f];e.push(u)}ff(n+"\nArguments: "+Array.prototype.slice.call(e).join("")+"\n"+(new Error).stack);r=!1}return i.apply(this,arguments)},i)}function ef(n,i){null!=t.deprecationHandler&&t.deprecationHandler(n,i);ke[n]||(ff(i),ke[n]=!0)}function ft(n){return n instanceof Function||"[object Function]"===Object.prototype.toString.call(n)}function ns(n){var t;for(var i in n)t=n[i],ft(t)?this[i]=t:this["_"+i]=t;this._config=n;this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function of(n,t){var i,r=vt({},n);for(i in t)l(t,i)&&(si(n[i])&&si(t[i])?(r[i]={},vt(r[i],n[i]),vt(r[i],t[i])):null!=t[i]?r[i]=t[i]:delete r[i]);for(i in n)l(n,i)&&!l(t,i)&&si(n[i])&&(r[i]=vt({},r[i]));return r}function wr(n){null!=n&&this.set(n)}function ts(n,t,i){var r=this._calendar[n]||this._calendar.sameElse;return ft(r)?r.call(t,i):r}function is(n){var t=this._longDateFormat[n],i=this._longDateFormat[n.toUpperCase()];return t||!i?t:(this._longDateFormat[n]=i.replace(/MMMM|MM|DD|dddd/g,function(n){return n.slice(1)}),this._longDateFormat[n])}function rs(){return this._invalidDate}function us(n){return this._ordinal.replace("%d",n)}function fs(n,t,i,r){var u=this._relativeTime[i];return ft(u)?u(n,t,i,r):u.replace(/%d/i,n)}function es(n,t){var i=this._relativeTime[n>0?"future":"past"];return ft(i)?i(t):i.replace(/%s/i,t)}function w(n,t){var i=n.toLowerCase();vi[i]=vi[i+"s"]=vi[t]=n}function nt(n){if("string"==typeof n)return vi[n]||vi[n.toLowerCase()]}function br(n){var i,t,r={};for(t in n)l(n,t)&&(i=nt(t),i&&(r[i]=n[t]));return r}function b(n,t){no[n]=t}function os(n){var t=[];for(var i in n)t.push({unit:i,priority:no[i]});return t.sort(function(n,t){return n.priority-t.priority}),t}function ui(n,i){return function(r){return null!=r?(sf(this,n,r),t.updateOffset(this,i),this):di(this,n)}}function di(n,t){return n.isValid()?n._d["get"+(n._isUTC?"UTC":"")+t]():NaN}function sf(n,t,i){n.isValid()&&n._d["set"+(n._isUTC?"UTC":"")+t](i)}function ss(n){return n=nt(n),ft(this[n])?this[n]():this}function hs(n,t){if("object"==typeof n){n=br(n);for(var r=os(n),i=0;i<r.length;i++)this[r[i].unit](n[r[i].unit])}else if(n=nt(n),ft(this[n]))return this[n](t);return this}function ht(n,t,i){var r=""+Math.abs(n),u=t-r.length,f=n>=0;return(f?i?"+":"":"-")+Math.pow(10,Math.max(0,u)).toString().substr(1)+r}function r(n,t,i,r){var u=r;"string"==typeof r&&(u=function(){return this[r]()});n&&(oi[n]=u);t&&(oi[t[0]]=function(){return ht(u.apply(this,arguments),t[1],t[2])});i&&(oi[i]=function(){return this.localeData().ordinal(u.apply(this,arguments),n)})}function cs(n){return n.match(/\[[\s\S]/)?n.replace(/^\[|\]$/g,""):n.replace(/\\/g,"")}function ls(n){for(var t=n.match(to),i=0,r=t.length;i<r;i++)t[i]=oi[t[i]]?oi[t[i]]:cs(t[i]);return function(i){for(var f="",u=0;u<r;u++)f+=ft(t[u])?t[u].call(i,n):t[u];return f}}function kr(n,t){return n.isValid()?(t=hf(t,n.localeData()),vu[t]=vu[t]||ls(t),vu[t](n)):n.localeData().invalidDate()}function hf(n,t){function r(n){return t.longDateFormat(n)||n}var i=5;for(er.lastIndex=0;i>=0&&er.test(n);)n=n.replace(er,r),er.lastIndex=0,i-=1;return n}function i(n,t,i){wu[n]=ft(t)?t:function(n){return n&&i?i:t}}function as(n,t){return l(wu,n)?wu[n](t._strict,t._locale):new RegExp(vs(n))}function vs(n){return gt(n.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(n,t,i,r,u){return t||i||r||u}))}function gt(n){return n.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function s(n,t){var i,r=t;for("string"==typeof n&&(n=[n]),dt(t)&&(r=function(n,i){i[t]=f(n)}),i=0;i<n.length;i++)bu[n[i]]=r}function ci(n,t){s(n,function(n,i,r,u){r._w=r._w||{};t(n,r._w,r,u)})}function ys(n,t,i){null!=t&&l(bu,n)&&bu[n](t,i._a,i,n)}function dr(n,t){return new Date(Date.UTC(n,t+1,0)).getUTCDate()}function ps(n,t){return n?tt(this._months)?this._months[n.month()]:this._months[(this._months.isFormat||eo).test(t)?"format":"standalone"][n.month()]:tt(this._months)?this._months:this._months.standalone}function ws(n,t){return n?tt(this._monthsShort)?this._monthsShort[n.month()]:this._monthsShort[eo.test(t)?"format":"standalone"][n.month()]:tt(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function bs(n,t,i){var u,r,e,f=n.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],u=0;u<12;++u)e=ut([2e3,u]),this._shortMonthsParse[u]=this.monthsShort(e,"").toLocaleLowerCase(),this._longMonthsParse[u]=this.months(e,"").toLocaleLowerCase();return i?"MMM"===t?(r=y.call(this._shortMonthsParse,f),r!==-1?r:null):(r=y.call(this._longMonthsParse,f),r!==-1?r:null):"MMM"===t?(r=y.call(this._shortMonthsParse,f),r!==-1?r:(r=y.call(this._longMonthsParse,f),r!==-1?r:null)):(r=y.call(this._longMonthsParse,f),r!==-1?r:(r=y.call(this._shortMonthsParse,f),r!==-1?r:null))}function ks(n,t,i){var r,u,f;if(this._monthsParseExact)return bs.call(this,n,t,i);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++)if((u=ut([2e3,r]),i&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(u,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(u,"").replace(".","")+"$","i")),i||this._monthsParse[r]||(f="^"+this.months(u,"")+"|^"+this.monthsShort(u,""),this._monthsParse[r]=new RegExp(f.replace(".",""),"i")),i&&"MMMM"===t&&this._longMonthsParse[r].test(n))||i&&"MMM"===t&&this._shortMonthsParse[r].test(n)||!i&&this._monthsParse[r].test(n))return r}function cf(n,t){var i;if(!n.isValid())return n;if("string"==typeof t)if(/^\d+$/.test(t))t=f(t);else if(t=n.localeData().monthsParse(t),!dt(t))return n;return i=Math.min(n.date(),dr(n.year(),t)),n._d["set"+(n._isUTC?"UTC":"")+"Month"](t,i),n}function lf(n){return null!=n?(cf(this,n),t.updateOffset(this,!0),this):di(this,"Month")}function ds(){return dr(this.year(),this.month())}function gs(n){return this._monthsParseExact?(l(this,"_monthsRegex")||af.call(this),n?this._monthsShortStrictRegex:this._monthsShortRegex):(l(this,"_monthsShortRegex")||(this._monthsShortRegex=yy),this._monthsShortStrictRegex&&n?this._monthsShortStrictRegex:this._monthsShortRegex)}function nh(n){return this._monthsParseExact?(l(this,"_monthsRegex")||af.call(this),n?this._monthsStrictRegex:this._monthsRegex):(l(this,"_monthsRegex")||(this._monthsRegex=py),this._monthsStrictRegex&&n?this._monthsStrictRegex:this._monthsRegex)}function af(){function f(n,t){return t.length-n.length}for(var i,r=[],u=[],t=[],n=0;n<12;n++)i=ut([2e3,n]),r.push(this.monthsShort(i,"")),u.push(this.months(i,"")),t.push(this.months(i,"")),t.push(this.monthsShort(i,""));for(r.sort(f),u.sort(f),t.sort(f),n=0;n<12;n++)r[n]=gt(r[n]),u[n]=gt(u[n]);for(n=0;n<24;n++)t[n]=gt(t[n]);this._monthsRegex=new RegExp("^("+t.join("|")+")","i");this._monthsShortRegex=this._monthsRegex;this._monthsStrictRegex=new RegExp("^("+u.join("|")+")","i");this._monthsShortStrictRegex=new RegExp("^("+r.join("|")+")","i")}function li(n){return vf(n)?366:365}function vf(n){return n%4==0&&n%100!=0||n%400==0}function th(){return vf(this.year())}function ih(n,t,i,r,u,f,e){var o=new Date(n,t,i,r,u,f,e);return n<100&&n>=0&&isFinite(o.getFullYear())&&o.setFullYear(n),o}function gi(n){var t=new Date(Date.UTC.apply(null,arguments));return n<100&&n>=0&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(n),t}function nr(n,t,i){var r=7+t-i,u=(7+gi(n,0,r).getUTCDay()-t)%7;return-u+r-1}function yf(n,t,i,r,u){var f,o,s=(7+i-r)%7,h=nr(n,r,u),e=1+7*(t-1)+s+h;return e<=0?(f=n-1,o=li(f)+e):e>li(n)?(f=n+1,o=e-li(n)):(f=n,o=e),{year:f,dayOfYear:o}}function ai(n,t,i){var f,r,e=nr(n.year(),t,i),u=Math.floor((n.dayOfYear()-e-1)/7)+1;return u<1?(r=n.year()-1,f=u+ni(r,t,i)):u>ni(n.year(),t,i)?(f=u-ni(n.year(),t,i),r=n.year()+1):(r=n.year(),f=u),{week:f,year:r}}function ni(n,t,i){var r=nr(n,t,i),u=nr(n+1,t,i);return(li(n)-r+u)/7}function rh(n){return ai(n,this._week.dow,this._week.doy).week}function uh(){return this._week.dow}function fh(){return this._week.doy}function eh(n){var t=this.localeData().week(this);return null==n?t:this.add(7*(n-t),"d")}function oh(n){var t=ai(this,1,4).week;return null==n?t:this.add(7*(n-t),"d")}function sh(n,t){return"string"!=typeof n?n:isNaN(n)?(n=t.weekdaysParse(n),"number"==typeof n?n:null):parseInt(n,10)}function hh(n,t){return"string"==typeof n?t.weekdaysParse(n)%7||7:isNaN(n)?null:n}function ch(n,t){return n?tt(this._weekdays)?this._weekdays[n.day()]:this._weekdays[this._weekdays.isFormat.test(t)?"format":"standalone"][n.day()]:tt(this._weekdays)?this._weekdays:this._weekdays.standalone}function lh(n){return n?this._weekdaysShort[n.day()]:this._weekdaysShort}function ah(n){return n?this._weekdaysMin[n.day()]:this._weekdaysMin}function vh(n,t,i){var f,r,e,u=n.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],f=0;f<7;++f)e=ut([2e3,1]).day(f),this._minWeekdaysParse[f]=this.weekdaysMin(e,"").toLocaleLowerCase(),this._shortWeekdaysParse[f]=this.weekdaysShort(e,"").toLocaleLowerCase(),this._weekdaysParse[f]=this.weekdays(e,"").toLocaleLowerCase();return i?"dddd"===t?(r=y.call(this._weekdaysParse,u),r!==-1?r:null):"ddd"===t?(r=y.call(this._shortWeekdaysParse,u),r!==-1?r:null):(r=y.call(this._minWeekdaysParse,u),r!==-1?r:null):"dddd"===t?(r=y.call(this._weekdaysParse,u),r!==-1?r:(r=y.call(this._shortWeekdaysParse,u),r!==-1?r:(r=y.call(this._minWeekdaysParse,u),r!==-1?r:null))):"ddd"===t?(r=y.call(this._shortWeekdaysParse,u),r!==-1?r:(r=y.call(this._weekdaysParse,u),r!==-1?r:(r=y.call(this._minWeekdaysParse,u),r!==-1?r:null))):(r=y.call(this._minWeekdaysParse,u),r!==-1?r:(r=y.call(this._weekdaysParse,u),r!==-1?r:(r=y.call(this._shortWeekdaysParse,u),r!==-1?r:null)))}function yh(n,t,i){var r,u,f;if(this._weekdaysParseExact)return vh.call(this,n,t,i);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++)if((u=ut([2e3,1]).day(r),i&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(u,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(u,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(u,"").replace(".",".?")+"$","i")),this._weekdaysParse[r]||(f="^"+this.weekdays(u,"")+"|^"+this.weekdaysShort(u,"")+"|^"+this.weekdaysMin(u,""),this._weekdaysParse[r]=new RegExp(f.replace(".",""),"i")),i&&"dddd"===t&&this._fullWeekdaysParse[r].test(n))||i&&"ddd"===t&&this._shortWeekdaysParse[r].test(n)||i&&"dd"===t&&this._minWeekdaysParse[r].test(n)||!i&&this._weekdaysParse[r].test(n))return r}function ph(n){if(!this.isValid())return null!=n?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=n?(n=sh(n,this.localeData()),this.add(n-t,"d")):t}function wh(n){if(!this.isValid())return null!=n?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==n?t:this.add(n-t,"d")}function bh(n){if(!this.isValid())return null!=n?this:NaN;if(null!=n){var t=hh(n,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7}function kh(n){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||gr.call(this),n?this._weekdaysStrictRegex:this._weekdaysRegex):(l(this,"_weekdaysRegex")||(this._weekdaysRegex=dy),this._weekdaysStrictRegex&&n?this._weekdaysStrictRegex:this._weekdaysRegex)}function dh(n){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||gr.call(this),n?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(l(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=gy),this._weekdaysShortStrictRegex&&n?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function gh(n){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||gr.call(this),n?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(l(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=np),this._weekdaysMinStrictRegex&&n?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function gr(){function u(n,t){return t.length-n.length}for(var f,e,o,s,h=[],i=[],r=[],t=[],n=0;n<7;n++)f=ut([2e3,1]).day(n),e=this.weekdaysMin(f,""),o=this.weekdaysShort(f,""),s=this.weekdays(f,""),h.push(e),i.push(o),r.push(s),t.push(e),t.push(o),t.push(s);for(h.sort(u),i.sort(u),r.sort(u),t.sort(u),n=0;n<7;n++)i[n]=gt(i[n]),r[n]=gt(r[n]),t[n]=gt(t[n]);this._weekdaysRegex=new RegExp("^("+t.join("|")+")","i");this._weekdaysShortRegex=this._weekdaysRegex;this._weekdaysMinRegex=this._weekdaysRegex;this._weekdaysStrictRegex=new RegExp("^("+r.join("|")+")","i");this._weekdaysShortStrictRegex=new RegExp("^("+i.join("|")+")","i");this._weekdaysMinStrictRegex=new RegExp("^("+h.join("|")+")","i")}function nu(){return this.hours()%12||12}function nc(){return this.hours()||24}function pf(n,t){r(n,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function wf(n,t){return t._meridiemParse}function tc(n){return"p"===(n+"").toLowerCase().charAt(0)}function ic(n,t,i){return n>11?i?"pm":"PM":i?"am":"AM"}function bf(n){return n?n.toLowerCase().replace("_","-"):n}function rc(n){for(var i,t,f,r,u=0;u<n.length;){for(r=bf(n[u]).split("-"),i=r.length,t=bf(n[u+1]),t=t?t.split("-"):null;i>0;){if(f=kf(r.slice(0,i).join("-")))return f;if(t&&t.length>=i&&uf(r,t,!0)>=i-1)break;i--}u++}return null}function kf(n){var t=null;if(!a[n]&&"undefined"!=typeof module&&module&&module.exports)try{t=ar._abbr;require("./locale/"+n);fi(t)}catch(n){}return a[n]}function fi(n,t){var i;return n&&(i=p(t)?pt(n):tu(n,t),i&&(ar=i)),ar._abbr}function tu(n,t){if(null!==t){var i=so;if(t.abbr=n,null!=a[n])ef("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),i=a[n]._config;else if(null!=t.parentLocale){if(null==a[t.parentLocale])return pi[t.parentLocale]||(pi[t.parentLocale]=[]),pi[t.parentLocale].push({name:n,config:t}),null;i=a[t.parentLocale]._config}return a[n]=new wr(of(i,t)),pi[n]&&pi[n].forEach(function(n){tu(n.name,n.config)}),fi(n),a[n]}return delete a[n],null}function uc(n,t){if(null!=t){var i,r=so;null!=a[n]&&(r=a[n]._config);t=of(r,t);i=new wr(t);i.parentLocale=a[n];a[n]=i;fi(n)}else null!=a[n]&&(null!=a[n].parentLocale?a[n]=a[n].parentLocale:null!=a[n]&&delete a[n]);return a[n]}function pt(n){var t;if(n&&n._locale&&n._locale._abbr&&(n=n._locale._abbr),!n)return ar;if(!tt(n)){if(t=kf(n))return t;n=[n]}return rc(n)}function fc(){return sy(a)}function iu(n){var i,t=n._a;return t&&u(n).overflow===-2&&(i=t[ct]<0||t[ct]>11?ct:t[ot]<1||t[ot]>dr(t[it],t[ct])?ot:t[v]<0||t[v]>24||24===t[v]&&(0!==t[rt]||0!==t[lt]||0!==t[ri])?v:t[rt]<0||t[rt]>59?rt:t[lt]<0||t[lt]>59?lt:t[ri]<0||t[ri]>999?ri:-1,u(n)._overflowDayOfYear&&(i<it||i>ot)&&(i=ot),u(n)._overflowWeeks&&i===-1&&(i=cy),u(n)._overflowWeekday&&i===-1&&(i=ly),u(n).overflow=i),n}function df(n){var t,r,o,e,f,s,h=n._i,i=ip.exec(h)||rp.exec(h);if(i){for(u(n).iso=!0,t=0,r=vr.length;t<r;t++)if(vr[t][1].exec(i[1])){e=vr[t][0];o=vr[t][2]!==!1;break}if(null==e)return void(n._isValid=!1);if(i[3]){for(t=0,r=du.length;t<r;t++)if(du[t][1].exec(i[3])){f=(i[2]||" ")+du[t][0];break}if(null==f)return void(n._isValid=!1)}if(!o&&null!=f)return void(n._isValid=!1);if(i[4]){if(!up.exec(i[4]))return void(n._isValid=!1);s="Z"}n._f=e+(f||"")+(s||"");tr(n)}else n._isValid=!1}function gf(n){var f,t,e,o,s,h,i,r,c={" GMT":" +0000"," EDT":" -0400"," EST":" -0500"," CDT":" -0500"," CST":" -0600"," MDT":" -0600"," MST":" -0700"," PDT":" -0700"," PST":" -0800"},l,a;if(f=n._i.replace(/\([^\)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s|\s$/g,""),t=ep.exec(f)){if((e=t[1]?"ddd"+(5===t[1].length?", ":" "):"",o="D MMM "+(t[2].length>10?"YYYY ":"YY "),s="HH:mm"+(t[4]?":ss":""),t[1])&&(l=new Date(t[2]),a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][l.getDay()],t[1].substr(0,3)!==a))return u(n).weekdayMismatch=!0,void(n._isValid=!1);switch(t[5].length){case 2:0===r?i=" +0000":(r="YXWVUTSRQPONZABCDEFGHIKLM".indexOf(t[5][1].toUpperCase())-12,i=(r<0?" -":" +")+(""+r).replace(/^-?/,"0").match(/..$/)[0]+"00");break;case 4:i=c[t[5]];break;default:i=c[" GMT"]}t[5]=i;n._i=t.splice(1).join("");h=" ZZ";n._f=e+o+s+h;tr(n);u(n).rfc2822=!0}else n._isValid=!1}function ec(n){var i=fp.exec(n._i);return null!==i?void(n._d=new Date(+i[1])):(df(n),void(n._isValid===!1&&(delete n._isValid,gf(n),n._isValid===!1&&(delete n._isValid,t.createFromInputFallback(n)))))}function ei(n,t,i){return null!=n?n:null!=t?t:i}function oc(n){var i=new Date(t.now());return n._useUTC?[i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()]:[i.getFullYear(),i.getMonth(),i.getDate()]}function ru(n){var t,i,r,f,e=[];if(!n._d){for(r=oc(n),n._w&&null==n._a[ot]&&null==n._a[ct]&&sc(n),null!=n._dayOfYear&&(f=ei(n._a[it],r[it]),(n._dayOfYear>li(f)||0===n._dayOfYear)&&(u(n)._overflowDayOfYear=!0),i=gi(f,0,n._dayOfYear),n._a[ct]=i.getUTCMonth(),n._a[ot]=i.getUTCDate()),t=0;t<3&&null==n._a[t];++t)n._a[t]=e[t]=r[t];for(;t<7;t++)n._a[t]=e[t]=null==n._a[t]?2===t?1:0:n._a[t];24===n._a[v]&&0===n._a[rt]&&0===n._a[lt]&&0===n._a[ri]&&(n._nextDay=!0,n._a[v]=0);n._d=(n._useUTC?gi:ih).apply(null,e);null!=n._tzm&&n._d.setUTCMinutes(n._d.getUTCMinutes()-n._tzm);n._nextDay&&(n._a[v]=24)}}function sc(n){var t,o,f,i,r,e,h,s,l;(t=n._w,null!=t.GG||null!=t.W||null!=t.E)?(r=1,e=4,o=ei(t.GG,n._a[it],ai(c(),1,4).year),f=ei(t.W,1),i=ei(t.E,1),(i<1||i>7)&&(s=!0)):(r=n._locale._week.dow,e=n._locale._week.doy,l=ai(c(),r,e),o=ei(t.gg,n._a[it],l.year),f=ei(t.w,l.week),null!=t.d?(i=t.d,(i<0||i>6)&&(s=!0)):null!=t.e?(i=t.e+r,(t.e<0||t.e>6)&&(s=!0)):i=r);f<1||f>ni(o,r,e)?u(n)._overflowWeeks=!0:null!=s?u(n)._overflowWeekday=!0:(h=yf(o,f,i,r,e),n._a[it]=h.year,n._dayOfYear=h.dayOfYear)}function tr(n){if(n._f===t.ISO_8601)return void df(n);if(n._f===t.RFC_2822)return void gf(n);n._a=[];u(n).empty=!0;for(var i,f,s,r=""+n._i,c=r.length,h=0,o=hf(n._f,n._locale).match(to)||[],e=0;e<o.length;e++)f=o[e],i=(r.match(as(f,n))||[])[0],i&&(s=r.substr(0,r.indexOf(i)),s.length>0&&u(n).unusedInput.push(s),r=r.slice(r.indexOf(i)+i.length),h+=i.length),oi[f]?(i?u(n).empty=!1:u(n).unusedTokens.push(f),ys(f,i,n)):n._strict&&!i&&u(n).unusedTokens.push(f);u(n).charsLeftOver=c-h;r.length>0&&u(n).unusedInput.push(r);n._a[v]<=12&&u(n).bigHour===!0&&n._a[v]>0&&(u(n).bigHour=void 0);u(n).parsedDateParts=n._a.slice(0);u(n).meridiem=n._meridiem;n._a[v]=hc(n._locale,n._a[v],n._meridiem);ru(n);iu(n)}function hc(n,t,i){var r;return null==i?t:null!=n.meridiemHour?n.meridiemHour(t,i):null!=n.isPM?(r=n.isPM(i),r&&t<12&&(t+=12),r||12!==t||(t=0),t):t}function cc(n){var t,e,f,r,i;if(0===n._f.length)return u(n).invalidFormat=!0,void(n._d=new Date(NaN));for(r=0;r<n._f.length;r++)i=0,t=pr({},n),null!=n._useUTC&&(t._useUTC=n._useUTC),t._f=n._f[r],tr(t),yr(t)&&(i+=u(t).charsLeftOver,i+=10*u(t).unusedTokens.length,u(t).score=i,(null==f||i<f)&&(f=i,e=t));vt(n,e||t)}function lc(n){if(!n._d){var t=br(n._i);n._a=rf([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(n){return n&&parseInt(n,10)});ru(n)}}function ac(n){var t=new hi(iu(ne(n)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function ne(n){var t=n._i,i=n._f;return n._locale=n._locale||pt(n._l),null===t||void 0===i&&""===t?ki({nullInput:!0}):("string"==typeof t&&(n._i=t=n._locale.preparse(t)),yt(t)?new hi(iu(t)):(bi(t)?n._d=t:tt(i)?cc(n):i?tr(n):vc(n),yr(n)||(n._d=null),n))}function vc(n){var i=n._i;p(i)?n._d=new Date(t.now()):bi(i)?n._d=new Date(i.valueOf()):"string"==typeof i?ec(n):tt(i)?(n._a=rf(i.slice(0),function(n){return parseInt(n,10)}),ru(n)):si(i)?lc(n):dt(i)?n._d=new Date(i):t.createFromInputFallback(n)}function te(n,t,i,r,u){var f={};return i!==!0&&i!==!1||(r=i,i=void 0),(si(n)&&ko(n)||tt(n)&&0===n.length)&&(n=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=u,f._l=i,f._i=n,f._f=t,f._strict=r,ac(f)}function c(n,t,i,r){return te(n,t,i,r,!1)}function ie(n,t){var r,i;if(1===t.length&&tt(t[0])&&(t=t[0]),!t.length)return c();for(r=t[0],i=1;i<t.length;++i)t[i].isValid()&&!t[i][n](r)||(r=t[i]);return r}function yc(){var n=[].slice.call(arguments,0);return ie("isBefore",n)}function pc(){var n=[].slice.call(arguments,0);return ie("isAfter",n)}function wc(n){var i,r,t;for(i in n)if(wi.indexOf(i)===-1||null!=n[i]&&isNaN(n[i]))return!1;for(r=!1,t=0;t<wi.length;++t)if(n[wi[t]]){if(r)return!1;parseFloat(n[wi[t]])!==f(n[wi[t]])&&(r=!0)}return!0}function bc(){return this._isValid}function kc(){return et(NaN)}function ir(n){var t=br(n),i=t.year||0,r=t.quarter||0,u=t.month||0,f=t.week||0,e=t.day||0,o=t.hour||0,s=t.minute||0,h=t.second||0,c=t.millisecond||0;this._isValid=wc(t);this._milliseconds=+c+1e3*h+6e4*s+36e5*o;this._days=+e+7*f;this._months=+u+3*r+12*i;this._data={};this._locale=pt();this._bubble()}function uu(n){return n instanceof ir}function fu(n){return n<0?Math.round(-1*n)*-1:Math.round(n)}function re(n,t){r(n,0,0,function(){var n=this.utcOffset(),i="+";return n<0&&(n=-n,i="-"),i+ht(~~(n/60),2)+t+ht(~~n%60,2)})}function eu(n,t){var i=(t||"").match(n);if(null===i)return null;var e=i[i.length-1]||[],r=(e+"").match(ho)||["-",0,0],u=+(60*r[1])+f(r[2]);return 0===u?0:"+"===r[0]?u:-u}function ou(n,i){var r,u;return i._isUTC?(r=i.clone(),u=(yt(n)||bi(n)?n.valueOf():c(n).valueOf())-r.valueOf(),r._d.setTime(r._d.valueOf()+u),t.updateOffset(r,!1),r):c(n).local()}function su(n){return 15*-Math.round(n._d.getTimezoneOffset()/15)}function dc(n,i,r){var u,f=this._offset||0;if(!this.isValid())return null!=n?this:NaN;if(null!=n){if("string"==typeof n){if(n=eu(lr,n),null===n)return this}else Math.abs(n)<16&&!r&&(n=60*n);return!this._isUTC&&i&&(u=su(this)),this._offset=n,this._isUTC=!0,null!=u&&this.add(u,"m"),f!==n&&(!i||this._changeInProgress?oe(this,et(n-f,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?f:su(this)}function gc(n,t){return null!=n?("string"!=typeof n&&(n=-n),this.utcOffset(n,t),this):-this.utcOffset()}function nl(n){return this.utcOffset(0,n)}function tl(n){return this._isUTC&&(this.utcOffset(0,n),this._isUTC=!1,n&&this.subtract(su(this),"m")),this}function il(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var n=eu(hy,this._i);null!=n?this.utcOffset(n):this.utcOffset(0,!0)}return this}function rl(n){return!!this.isValid()&&(n=n?c(n).utcOffset():0,(this.utcOffset()-n)%60==0)}function ul(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function fl(){var n,t;return p(this._isDSTShifted)?(n={},(pr(n,this),n=ne(n),n._a)?(t=n._isUTC?ut(n._a):c(n._a),this._isDSTShifted=this.isValid()&&uf(n._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted):this._isDSTShifted}function el(){return!!this.isValid()&&!this._isUTC}function ol(){return!!this.isValid()&&this._isUTC}function ue(){return!!this.isValid()&&this._isUTC&&0===this._offset}function et(n,t){var u,e,o,i=n,r=null;return uu(n)?i={ms:n._milliseconds,d:n._days,M:n._months}:dt(n)?(i={},t?i[t]=n:i.milliseconds=n):(r=co.exec(n))?(u="-"===r[1]?-1:1,i={y:0,d:f(r[ot])*u,h:f(r[v])*u,m:f(r[rt])*u,s:f(r[lt])*u,ms:f(fu(1e3*r[ri]))*u}):(r=lo.exec(n))?(u="-"===r[1]?-1:1,i={y:ti(r[2],u),M:ti(r[3],u),w:ti(r[4],u),d:ti(r[5],u),h:ti(r[6],u),m:ti(r[7],u),s:ti(r[8],u)}):null==i?i={}:"object"==typeof i&&("from"in i||"to"in i)&&(o=sl(c(i.from),c(i.to)),i={},i.ms=o.milliseconds,i.M=o.months),e=new ir(i),uu(n)&&l(n,"_locale")&&(e._locale=n._locale),e}function ti(n,t){var i=n&&parseFloat(n.replace(",","."));return(isNaN(i)?0:i)*t}function fe(n,t){var i={milliseconds:0,months:0};return i.months=t.month()-n.month()+12*(t.year()-n.year()),n.clone().add(i.months,"M").isAfter(t)&&--i.months,i.milliseconds=+t-+n.clone().add(i.months,"M"),i}function sl(n,t){var i;return n.isValid()&&t.isValid()?(t=ou(t,n),n.isBefore(t)?i=fe(n,t):(i=fe(t,n),i.milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0}}function ee(n,t){return function(i,r){var u,f;return null===r||isNaN(+r)||(ef(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),f=i,i=r,r=f),i="string"==typeof i?+i:i,u=et(i,r),oe(this,u,n),this}}function oe(n,i,r,u){var o=i._milliseconds,f=fu(i._days),e=fu(i._months);n.isValid()&&(u=null==u||u,o&&n._d.setTime(n._d.valueOf()+o*r),f&&sf(n,"Date",di(n,"Date")+f*r),e&&cf(n,di(n,"Month")+e*r),u&&t.updateOffset(n,f||e))}function hl(n,t){var i=n.diff(t,"days",!0);return i<-6?"sameElse":i<-1?"lastWeek":i<0?"lastDay":i<1?"sameDay":i<2?"nextDay":i<7?"nextWeek":"sameElse"}function cl(n,i){var u=n||c(),f=ou(u,this).startOf("day"),r=t.calendarFormat(this,f)||"sameElse",e=i&&(ft(i[r])?i[r].call(this,u):i[r]);return this.format(e||this.localeData().calendar(r,this,c(u)))}function ll(){return new hi(this)}function al(n,t){var i=yt(n)?n:c(n);return!(!this.isValid()||!i.isValid())&&(t=nt(p(t)?"millisecond":t),"millisecond"===t?this.valueOf()>i.valueOf():i.valueOf()<this.clone().startOf(t).valueOf())}function vl(n,t){var i=yt(n)?n:c(n);return!(!this.isValid()||!i.isValid())&&(t=nt(p(t)?"millisecond":t),"millisecond"===t?this.valueOf()<i.valueOf():this.clone().endOf(t).valueOf()<i.valueOf())}function yl(n,t,i,r){return r=r||"()",("("===r[0]?this.isAfter(n,i):!this.isBefore(n,i))&&(")"===r[1]?this.isBefore(t,i):!this.isAfter(t,i))}function pl(n,t){var i,r=yt(n)?n:c(n);return!(!this.isValid()||!r.isValid())&&(t=nt(t||"millisecond"),"millisecond"===t?this.valueOf()===r.valueOf():(i=r.valueOf(),this.clone().startOf(t).valueOf()<=i&&i<=this.clone().endOf(t).valueOf()))}function wl(n,t){return this.isSame(n,t)||this.isAfter(n,t)}function bl(n,t){return this.isSame(n,t)||this.isBefore(n,t)}function kl(n,t,i){var f,e,r,u;return this.isValid()?(f=ou(n,this),f.isValid()?(e=6e4*(f.utcOffset()-this.utcOffset()),t=nt(t),"year"===t||"month"===t||"quarter"===t?(u=dl(this,f),"quarter"===t?u/=3:"year"===t&&(u/=12)):(r=this-f,u="second"===t?r/1e3:"minute"===t?r/6e4:"hour"===t?r/36e5:"day"===t?(r-e)/864e5:"week"===t?(r-e)/6048e5:r),i?u:d(u)):NaN):NaN}function dl(n,t){var r,f,u=12*(t.year()-n.year())+(t.month()-n.month()),i=n.clone().add(u,"months");return t-i<0?(r=n.clone().add(u-1,"months"),f=(t-i)/(i-r)):(r=n.clone().add(u+1,"months"),f=(t-i)/(r-i)),-(u+f)||0}function gl(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function na(){if(!this.isValid())return null;var n=this.clone().utc();return n.year()<0||n.year()>9999?kr(n,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):ft(Date.prototype.toISOString)?this.toDate().toISOString():kr(n,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function ta(){var n,t;if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";n="moment";t="";this.isLocal()||(n=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var i="["+n+'("]',r=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",u=t+'[")]';return this.format(i+r+"-MM-DD[T]HH:mm:ss.SSS"+u)}function ia(n){n||(n=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var i=kr(this,n);return this.localeData().postformat(i)}function ra(n,t){return this.isValid()&&(yt(n)&&n.isValid()||c(n).isValid())?et({to:this,from:n}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function ua(n){return this.from(c(),n)}function fa(n,t){return this.isValid()&&(yt(n)&&n.isValid()||c(n).isValid())?et({from:this,to:n}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function ea(n){return this.to(c(),n)}function se(n){var t;return void 0===n?this._locale._abbr:(t=pt(n),null!=t&&(this._locale=t),this)}function he(){return this._locale}function oa(n){switch(n=nt(n)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===n&&this.weekday(0),"isoWeek"===n&&this.isoWeekday(1),"quarter"===n&&this.month(3*Math.floor(this.month()/3)),this}function sa(n){return n=nt(n),void 0===n||"millisecond"===n?this:("date"===n&&(n="day"),this.startOf(n).add(1,"isoWeek"===n?"week":n).subtract(1,"ms"))}function ha(){return this._d.valueOf()-6e4*(this._offset||0)}function ca(){return Math.floor(this.valueOf()/1e3)}function la(){return new Date(this.valueOf())}function aa(){var n=this;return[n.year(),n.month(),n.date(),n.hour(),n.minute(),n.second(),n.millisecond()]}function va(){var n=this;return{years:n.year(),months:n.month(),date:n.date(),hours:n.hours(),minutes:n.minutes(),seconds:n.seconds(),milliseconds:n.milliseconds()}}function ya(){return this.isValid()?this.toISOString():null}function pa(){return yr(this)}function wa(){return vt({},u(this))}function ba(){return u(this).overflow}function ka(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function rr(n,t){r(0,[n,n.length],0,t)}function da(n){return ce.call(this,n,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function ga(n){return ce.call(this,n,this.isoWeek(),this.isoWeekday(),1,4)}function nv(){return ni(this.year(),1,4)}function tv(){var n=this.localeData()._week;return ni(this.year(),n.dow,n.doy)}function ce(n,t,i,r,u){var f;return null==n?ai(this,r,u).year:(f=ni(n,r,u),t>f&&(t=f),iv.call(this,n,t,i,r,u))}function iv(n,t,i,r,u){var e=yf(n,t,i,r,u),f=gi(e.year,0,e.dayOfYear);return this.year(f.getUTCFullYear()),this.month(f.getUTCMonth()),this.date(f.getUTCDate()),this}function rv(n){return null==n?Math.ceil((this.month()+1)/3):this.month(3*(n-1)+this.month()%3)}function uv(n){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==n?t:this.add(n-t,"d")}function fv(n,t){t[ri]=f(1e3*("0."+n))}function ev(){return this._isUTC?"UTC":""}function ov(){return this._isUTC?"Coordinated Universal Time":""}function sv(n){return c(1e3*n)}function hv(){return c.apply(null,arguments).parseZone()}function le(n){return n}function ur(n,t,i,r){var u=pt(),f=ut().set(r,t);return u[i](f,n)}function ae(n,t,i){if(dt(n)&&(t=n,n=void 0),n=n||"",null!=t)return ur(n,t,i,"month");for(var u=[],r=0;r<12;r++)u[r]=ur(n,r,i,"month");return u}function hu(n,t,i,r){var o,f,u,e;if("boolean"==typeof n?(dt(t)&&(i=t,t=void 0),t=t||""):(t=n,i=t,n=!1,dt(t)&&(i=t,t=void 0),t=t||""),o=pt(),f=n?o._week.dow:0,null!=i)return ur(t,(i+f)%7,r,"day");for(e=[],u=0;u<7;u++)e[u]=ur(t,(u+f)%7,r,"day");return e}function cv(n,t){return ae(n,t,"months")}function lv(n,t){return ae(n,t,"monthsShort")}function av(n,t,i){return hu(n,t,i,"weekdays")}function vv(n,t,i){return hu(n,t,i,"weekdaysShort")}function yv(n,t,i){return hu(n,t,i,"weekdaysMin")}function pv(){var n=this._data;return this._milliseconds=at(this._milliseconds),this._days=at(this._days),this._months=at(this._months),n.milliseconds=at(n.milliseconds),n.seconds=at(n.seconds),n.minutes=at(n.minutes),n.hours=at(n.hours),n.months=at(n.months),n.years=at(n.years),this}function ve(n,t,i,r){var u=et(t,i);return n._milliseconds+=r*u._milliseconds,n._days+=r*u._days,n._months+=r*u._months,n._bubble()}function wv(n,t){return ve(this,n,t,1)}function bv(n,t){return ve(this,n,t,-1)}function ye(n){return n<0?Math.floor(n):Math.ceil(n)}function kv(){var u,f,e,s,o,r=this._milliseconds,n=this._days,t=this._months,i=this._data;return r>=0&&n>=0&&t>=0||r<=0&&n<=0&&t<=0||(r+=864e5*ye(cu(t)+n),n=0,t=0),i.milliseconds=r%1e3,u=d(r/1e3),i.seconds=u%60,f=d(u/60),i.minutes=f%60,e=d(f/60),i.hours=e%24,n+=d(e/24),o=d(pe(n)),t+=o,n-=ye(cu(o)),s=d(t/12),t%=12,i.days=n,i.months=t,i.years=s,this}function pe(n){return 4800*n/146097}function cu(n){return 146097*n/4800}function dv(n){if(!this.isValid())return NaN;var t,r,i=this._milliseconds;if(n=nt(n),"month"===n||"year"===n)return t=this._days+i/864e5,r=this._months+pe(t),"month"===n?r:r/12;switch(t=this._days+Math.round(cu(this._months)),n){case"week":return t/7+i/6048e5;case"day":return t+i/864e5;case"hour":return 24*t+i/36e5;case"minute":return 1440*t+i/6e4;case"second":return 86400*t+i/1e3;case"millisecond":return Math.floor(864e5*t)+i;default:throw new Error("Unknown unit "+n);}}function gv(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*f(this._months/12):NaN}function wt(n){return function(){return this.as(n)}}function ny(n){return n=nt(n),this.isValid()?this[n+"s"]():NaN}function ii(n){return function(){return this.isValid()?this._data[n]:NaN}}function ty(){return d(this.days()/7)}function iy(n,t,i,r,u){return u.relativeTime(t||1,!!i,n,r)}function ry(n,t,i){var r=et(n).abs(),u=kt(r.as("s")),e=kt(r.as("m")),o=kt(r.as("h")),s=kt(r.as("d")),h=kt(r.as("M")),c=kt(r.as("y")),f=u<=st.ss&&["s",u]||u<st.s&&["ss",u]||e<=1&&["m"]||e<st.m&&["mm",e]||o<=1&&["h"]||o<st.h&&["hh",o]||s<=1&&["d"]||s<st.d&&["dd",s]||h<=1&&["M"]||h<st.M&&["MM",h]||c<=1&&["y"]||["yy",c];return f[2]=t,f[3]=+n>0,f[4]=i,iy.apply(null,f)}function uy(n){return void 0===n?kt:"function"==typeof n&&(kt=n,!0)}function fy(n,t){return void 0!==st[n]&&(void 0===t?st[n]:(st[n]=t,"s"===n&&(st.ss=t-1),!0))}function ey(n){if(!this.isValid())return this.localeData().invalidDate();var t=this.localeData(),i=ry(this,!n,t);return n&&(i=t.pastFuture(+this,i)),t.postformat(i)}function fr(){if(!this.isValid())return this.localeData().invalidDate();var n,e,o,t=tf(this._milliseconds)/1e3,a=tf(this._days),i=tf(this._months);n=d(t/60);e=d(n/60);t%=60;n%=60;o=d(i/12);i%=12;var s=o,h=i,c=a,r=e,u=n,f=t,l=this.asSeconds();return l?(l<0?"-":"")+"P"+(s?s+"Y":"")+(h?h+"M":"")+(c?c+"D":"")+(r||u||f?"T":"")+(r?r+"H":"")+(u?u+"M":"")+(f?f+"S":""):"P0D"}var we,be,de,y,ku,oo,ho,co,lo,ao,vo,gu,nf,yo,po,bt,wo,n,o;be=Array.prototype.some?Array.prototype.some:function(n){for(var i=Object(this),r=i.length>>>0,t=0;t<r;t++)if(t in i&&n.call(this,i[t],t,i))return!0;return!1};var oy=be,lu=t.momentProperties=[],au=!1,ke={};t.suppressDeprecationWarnings=!1;t.deprecationHandler=null;de=Object.keys?Object.keys:function(n){var t,i=[];for(t in n)l(n,t)&&i.push(t);return i};var ge,sy=de,vi={},no={},to=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,er=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,vu={},oi={},io=/\d/,k=/\d\d/,ro=/\d{3}/,yu=/\d{4}/,or=/[+-]?\d{6}/,h=/\d\d?/,uo=/\d\d\d\d?/,fo=/\d\d\d\d\d\d?/,sr=/\d{1,3}/,pu=/\d{1,4}/,hr=/[+-]?\d{1,6}/,cr=/[+-]?\d+/,hy=/Z|[+-]\d\d:?\d\d/gi,lr=/Z|[+-]\d\d(?::?\d\d)?/gi,yi=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,wu={},bu={},it=0,ct=1,ot=2,v=3,rt=4,lt=5,ri=6,cy=7,ly=8;ge=Array.prototype.indexOf?Array.prototype.indexOf:function(n){for(var t=0;t<this.length;++t)if(this[t]===n)return t;return-1};y=ge;r("M",["MM",2],"Mo",function(){return this.month()+1});r("MMM",0,0,function(n){return this.localeData().monthsShort(this,n)});r("MMMM",0,0,function(n){return this.localeData().months(this,n)});w("month","M");b("month",8);i("M",h);i("MM",h,k);i("MMM",function(n,t){return t.monthsShortRegex(n)});i("MMMM",function(n,t){return t.monthsRegex(n)});s(["M","MM"],function(n,t){t[ct]=f(n)-1});s(["MMM","MMMM"],function(n,t,i,r){var f=i._locale.monthsParse(n,r,i._strict);null!=f?t[ct]=f:u(i).invalidMonth=n});var eo=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,ay="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),vy="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),yy=yi,py=yi;r("Y",0,0,function(){var n=this.year();return n<=9999?""+n:"+"+n});r(0,["YY",2],0,function(){return this.year()%100});r(0,["YYYY",4],0,"year");r(0,["YYYYY",5],0,"year");r(0,["YYYYYY",6,!0],0,"year");w("year","y");b("year",1);i("Y",cr);i("YY",h,k);i("YYYY",pu,yu);i("YYYYY",hr,or);i("YYYYYY",hr,or);s(["YYYYY","YYYYYY"],it);s("YYYY",function(n,i){i[it]=2===n.length?t.parseTwoDigitYear(n):f(n)});s("YY",function(n,i){i[it]=t.parseTwoDigitYear(n)});s("Y",function(n,t){t[it]=parseInt(n,10)});t.parseTwoDigitYear=function(n){return f(n)+(f(n)>68?1900:2e3)};ku=ui("FullYear",!0);r("w",["ww",2],"wo","week");r("W",["WW",2],"Wo","isoWeek");w("week","w");w("isoWeek","W");b("week",5);b("isoWeek",5);i("w",h);i("ww",h,k);i("W",h);i("WW",h,k);ci(["w","ww","W","WW"],function(n,t,i,r){t[r.substr(0,1)]=f(n)});oo={dow:0,doy:6};r("d",0,"do","day");r("dd",0,0,function(n){return this.localeData().weekdaysMin(this,n)});r("ddd",0,0,function(n){return this.localeData().weekdaysShort(this,n)});r("dddd",0,0,function(n){return this.localeData().weekdays(this,n)});r("e",0,0,"weekday");r("E",0,0,"isoWeekday");w("day","d");w("weekday","e");w("isoWeekday","E");b("day",11);b("weekday",11);b("isoWeekday",11);i("d",h);i("e",h);i("E",h);i("dd",function(n,t){return t.weekdaysMinRegex(n)});i("ddd",function(n,t){return t.weekdaysShortRegex(n)});i("dddd",function(n,t){return t.weekdaysRegex(n)});ci(["dd","ddd","dddd"],function(n,t,i,r){var f=i._locale.weekdaysParse(n,r,i._strict);null!=f?t.d=f:u(i).invalidWeekday=n});ci(["d","e","E"],function(n,t,i,r){t[r]=f(n)});var wy="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),by="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),ky="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),dy=yi,gy=yi,np=yi;r("H",["HH",2],0,"hour");r("h",["hh",2],0,nu);r("k",["kk",2],0,nc);r("hmm",0,0,function(){return""+nu.apply(this)+ht(this.minutes(),2)});r("hmmss",0,0,function(){return""+nu.apply(this)+ht(this.minutes(),2)+ht(this.seconds(),2)});r("Hmm",0,0,function(){return""+this.hours()+ht(this.minutes(),2)});r("Hmmss",0,0,function(){return""+this.hours()+ht(this.minutes(),2)+ht(this.seconds(),2)});pf("a",!0);pf("A",!1);w("hour","h");b("hour",13);i("a",wf);i("A",wf);i("H",h);i("h",h);i("k",h);i("HH",h,k);i("hh",h,k);i("kk",h,k);i("hmm",uo);i("hmmss",fo);i("Hmm",uo);i("Hmmss",fo);s(["H","HH"],v);s(["k","kk"],function(n,t){var i=f(n);t[v]=24===i?0:i});s(["a","A"],function(n,t,i){i._isPm=i._locale.isPM(n);i._meridiem=n});s(["h","hh"],function(n,t,i){t[v]=f(n);u(i).bigHour=!0});s("hmm",function(n,t,i){var r=n.length-2;t[v]=f(n.substr(0,r));t[rt]=f(n.substr(r));u(i).bigHour=!0});s("hmmss",function(n,t,i){var r=n.length-4,e=n.length-2;t[v]=f(n.substr(0,r));t[rt]=f(n.substr(r,2));t[lt]=f(n.substr(e));u(i).bigHour=!0});s("Hmm",function(n,t){var i=n.length-2;t[v]=f(n.substr(0,i));t[rt]=f(n.substr(i))});s("Hmmss",function(n,t){var i=n.length-4,r=n.length-2;t[v]=f(n.substr(0,i));t[rt]=f(n.substr(i,2));t[lt]=f(n.substr(r))});var ar,tp=ui("Hours",!0),so={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:ay,monthsShort:vy,week:oo,weekdays:wy,weekdaysMin:ky,weekdaysShort:by,meridiemParse:/[ap]\.?m?\.?/i},a={},pi={},ip=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,rp=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,up=/Z|[+-]\d\d(?::?\d\d)?/,vr=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],du=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],fp=/^\/?Date\((\-?\d+)/i,ep=/^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/;t.createFromInputFallback=g("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(n){n._d=new Date(n._i+(n._useUTC?" UTC":""))});t.ISO_8601=function(){};t.RFC_2822=function(){};var op=g("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var n=c.apply(null,arguments);return this.isValid()&&n.isValid()?n<this?this:n:ki()}),sp=g("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var n=c.apply(null,arguments);return this.isValid()&&n.isValid()?n>this?this:n:ki()}),hp=function(){return Date.now?Date.now():+new Date},wi=["year","quarter","month","week","day","hour","minute","second","millisecond"];for(re("Z",":"),re("ZZ",""),i("Z",lr),i("ZZ",lr),s(["Z","ZZ"],function(n,t,i){i._useUTC=!0;i._tzm=eu(lr,n)}),ho=/([\+\-]|\d\d)/gi,t.updateOffset=function(){},co=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,lo=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/,et.fn=ir.prototype,et.invalid=kc,ao=ee(1,"add"),vo=ee(-1,"subtract"),t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]",gu=g("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(n){return void 0===n?this.localeData():this.locale(n)}),r(0,["gg",2],0,function(){return this.weekYear()%100}),r(0,["GG",2],0,function(){return this.isoWeekYear()%100}),rr("gggg","weekYear"),rr("ggggg","weekYear"),rr("GGGG","isoWeekYear"),rr("GGGGG","isoWeekYear"),w("weekYear","gg"),w("isoWeekYear","GG"),b("weekYear",1),b("isoWeekYear",1),i("G",cr),i("g",cr),i("GG",h,k),i("gg",h,k),i("GGGG",pu,yu),i("gggg",pu,yu),i("GGGGG",hr,or),i("ggggg",hr,or),ci(["gggg","ggggg","GGGG","GGGGG"],function(n,t,i,r){t[r.substr(0,2)]=f(n)}),ci(["gg","GG"],function(n,i,r,u){i[u]=t.parseTwoDigitYear(n)}),r("Q",0,"Qo","quarter"),w("quarter","Q"),b("quarter",7),i("Q",io),s("Q",function(n,t){t[ct]=3*(f(n)-1)}),r("D",["DD",2],"Do","date"),w("date","D"),b("date",9),i("D",h),i("DD",h,k),i("Do",function(n,t){return n?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),s(["D","DD"],ot),s("Do",function(n,t){t[ot]=f(n.match(h)[0],10)}),nf=ui("Date",!0),r("DDD",["DDDD",3],"DDDo","dayOfYear"),w("dayOfYear","DDD"),b("dayOfYear",4),i("DDD",sr),i("DDDD",ro),s(["DDD","DDDD"],function(n,t,i){i._dayOfYear=f(n)}),r("m",["mm",2],0,"minute"),w("minute","m"),b("minute",14),i("m",h),i("mm",h,k),s(["m","mm"],rt),yo=ui("Minutes",!1),r("s",["ss",2],0,"second"),w("second","s"),b("second",15),i("s",h),i("ss",h,k),s(["s","ss"],lt),po=ui("Seconds",!1),r("S",0,0,function(){return~~(this.millisecond()/100)}),r(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),r(0,["SSS",3],0,"millisecond"),r(0,["SSSS",4],0,function(){return 10*this.millisecond()}),r(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),r(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),r(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),r(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),r(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),w("millisecond","ms"),b("millisecond",16),i("S",sr,io),i("SS",sr,k),i("SSS",sr,ro),bt="SSSS";bt.length<=9;bt+="S")i(bt,/\d+/);for(bt="S";bt.length<=9;bt+="S")s(bt,fv);wo=ui("Milliseconds",!1);r("z",0,0,"zoneAbbr");r("zz",0,0,"zoneName");n=hi.prototype;n.add=ao;n.calendar=cl;n.clone=ll;n.diff=kl;n.endOf=sa;n.format=ia;n.from=ra;n.fromNow=ua;n.to=fa;n.toNow=ea;n.get=ss;n.invalidAt=ba;n.isAfter=al;n.isBefore=vl;n.isBetween=yl;n.isSame=pl;n.isSameOrAfter=wl;n.isSameOrBefore=bl;n.isValid=pa;n.lang=gu;n.locale=se;n.localeData=he;n.max=sp;n.min=op;n.parsingFlags=wa;n.set=hs;n.startOf=oa;n.subtract=vo;n.toArray=aa;n.toObject=va;n.toDate=la;n.toISOString=na;n.inspect=ta;n.toJSON=ya;n.toString=gl;n.unix=ca;n.valueOf=ha;n.creationData=ka;n.year=ku;n.isLeapYear=th;n.weekYear=da;n.isoWeekYear=ga;n.quarter=n.quarters=rv;n.month=lf;n.daysInMonth=ds;n.week=n.weeks=eh;n.isoWeek=n.isoWeeks=oh;n.weeksInYear=tv;n.isoWeeksInYear=nv;n.date=nf;n.day=n.days=ph;n.weekday=wh;n.isoWeekday=bh;n.dayOfYear=uv;n.hour=n.hours=tp;n.minute=n.minutes=yo;n.second=n.seconds=po;n.millisecond=n.milliseconds=wo;n.utcOffset=dc;n.utc=nl;n.local=tl;n.parseZone=il;n.hasAlignedHourOffset=rl;n.isDST=ul;n.isLocal=el;n.isUtcOffset=ol;n.isUtc=ue;n.isUTC=ue;n.zoneAbbr=ev;n.zoneName=ov;n.dates=g("dates accessor is deprecated. Use date instead.",nf);n.months=g("months accessor is deprecated. Use month instead",lf);n.years=g("years accessor is deprecated. Use year instead",ku);n.zone=g("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",gc);n.isDSTShifted=g("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",fl);o=wr.prototype;o.calendar=ts;o.longDateFormat=is;o.invalidDate=rs;o.ordinal=us;o.preparse=le;o.postformat=le;o.relativeTime=fs;o.pastFuture=es;o.set=ns;o.months=ps;o.monthsShort=ws;o.monthsParse=ks;o.monthsRegex=nh;o.monthsShortRegex=gs;o.week=rh;o.firstDayOfYear=fh;o.firstDayOfWeek=uh;o.weekdays=ch;o.weekdaysMin=ah;o.weekdaysShort=lh;o.weekdaysParse=yh;o.weekdaysRegex=kh;o.weekdaysShortRegex=dh;o.weekdaysMinRegex=gh;o.isPM=tc;o.meridiem=ic;fi("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(n){var t=n%10,i=1===f(n%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return n+i}});t.lang=g("moment.lang is deprecated. Use moment.locale instead.",fi);t.langData=g("moment.langData is deprecated. Use moment.localeData instead.",pt);var at=Math.abs,cp=wt("ms"),lp=wt("s"),ap=wt("m"),vp=wt("h"),yp=wt("d"),pp=wt("w"),wp=wt("M"),bp=wt("y"),kp=ii("milliseconds"),dp=ii("seconds"),gp=ii("minutes"),nw=ii("hours"),tw=ii("days"),iw=ii("months"),rw=ii("years"),kt=Math.round,st={ss:44,s:45,m:45,h:22,d:26,M:11},tf=Math.abs,e=ir.prototype;return e.isValid=bc,e.abs=pv,e.add=wv,e.subtract=bv,e.as=dv,e.asMilliseconds=cp,e.asSeconds=lp,e.asMinutes=ap,e.asHours=vp,e.asDays=yp,e.asWeeks=pp,e.asMonths=wp,e.asYears=bp,e.valueOf=gv,e._bubble=kv,e.get=ny,e.milliseconds=kp,e.seconds=dp,e.minutes=gp,e.hours=nw,e.days=tw,e.weeks=ty,e.months=iw,e.years=rw,e.humanize=ey,e.toISOString=fr,e.toString=fr,e.toJSON=fr,e.locale=se,e.localeData=he,e.toIsoString=g("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",fr),e.lang=gu,r("X",0,0,"unix"),r("x",0,0,"valueOf"),i("x",cr),i("X",/[+-]?\d+(\.\d{1,3})?/),s("X",function(n,t,i){i._d=new Date(1e3*parseFloat(n,10))}),s("x",function(n,t,i){i._d=new Date(f(n))}),t.version="2.18.1",bo(c),t.fn=n,t.min=yc,t.max=pc,t.now=hp,t.utc=ut,t.unix=sv,t.months=cv,t.isDate=bi,t.locale=fi,t.invalid=ki,t.duration=et,t.isMoment=yt,t.weekdays=av,t.parseZone=hv,t.localeData=pt,t.isDuration=uu,t.monthsShort=lv,t.weekdaysMin=yv,t.defineLocale=tu,t.updateLocale=uc,t.locales=fc,t.weekdaysShort=vv,t.normalizeUnits=nt,t.relativeTimeRounding=uy,t.relativeTimeThreshold=fy,t.calendarFormat=hl,t.prototype=n,t});!function(n,t){if("function"==typeof define&&define.amd)define("SnazzyInfoWindow",["module","exports"],t);else if("undefined"!=typeof exports)t(module,exports);else{var i={exports:{}};t(i,i.exports);n.SnazzyInfoWindow=i.exports}}(this,function(n,t){function c(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function s(n,t){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?n:t}function l(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(n,t):n.__proto__=t)}function f(n,t){n&&t&&Object.keys(t).forEach(function(i){n[i]=t[i]})}function a(n){var t={};return f(t,u),f(t,n),Object.keys(u).forEach(function(n){var r=u[n],i;"object"===(void 0===r?"undefined":p(r))&&(i={},f(i,r),f(i,t[n]),t[n]=i)}),t}function i(n,t){var u=/^(-{0,1}\.{0,1}\d+(\.\d+)?)[\s|\.]*(\w*)$/,r;return n&&u.test(n)?(r=u.exec(n),{value:1*r[1],units:r[3]||"px",original:n}):t?i(t):{original:t}}function e(n,t){if(n){for(;n.firstChild;)n.removeChild(n.firstChild);t&&("string"==typeof t?n.innerHTML=t:n.appendChild(t))}}function v(n){return"top"===n?"bottom":"bottom"===n?"top":"left"===n?"right":"right"===n?"left":n}function o(n){return n.charAt(0).toUpperCase()+n.slice(1)}function h(n){if(void 0!==n&&null!==n){if(n instanceof google.maps.LatLng)return n;if(void 0!==n.lat&&void 0!==n.lng)return new google.maps.LatLng(n)}return null}Object.defineProperty(t,"__esModule",{value:!0});var y=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}(),p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},r={h:"0px",v:"3px",blur:"6px",spread:"0px",color:"#000"},u={placement:"top",pointer:!0,openOnMarkerClick:!0,closeOnMapClick:!0,closeWhenOthersOpen:!1,showCloseButton:!0,panOnOpen:!0,edgeOffset:{top:20,right:20,bottom:20,left:20}},w=function(n){function t(n){var i,r;return(c(this,t),i=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,n)),"undefined"==typeof google)?(console.warn("Snazzy Info Window: Google Maps is not defined!"),s(i)):(i._html=null,i._opts=a(n),i._callbacks=i._opts.callbacks||{},i._marker=i._opts.marker,i._map=i._opts.map,i._position=h(i._opts.position),i._isOpen=!1,i._listeners=[],i._marker&&i._opts.openOnMarkerClick&&i.trackListener(google.maps.event.addListener(i._marker,"click",function(){i.getMap()||i.open()}),!0),i._position&&!i._opts.offset&&(i._opts.offset={top:"0px",left:"0px"}),r=n.placement||i._opts.position,("string"==typeof r||r instanceof String)&&(r=r.toLowerCase()),i._opts.placement="top"!==r&&"bottom"!==r&&"left"!==r&&"right"!==r?u.placement:r,r=i._opts.position,void 0===r||null===r||"string"==typeof r||r instanceof String||(i._opts.position=r),void 0!==i._opts.border&&i._opts.border!==!0||(i._opts.border={}),void 0===i._opts.pointer&&(i._opts.pointer=u.pointer),void 0!==i._opts.shadow&&i._opts.shadow!==!0||(i._opts.shadow={}),i)}return l(t,n),y(t,[{key:"activateCallback",value:function(n){var t=this._callbacks[n];if(t)return t.apply(this)}},{key:"trackListener",value:function(n,t){this._listeners.push({listener:n,persistent:t})}},{key:"clearListeners",value:function(n){this._listeners&&(this._listeners.forEach(function(t){!n&&t.persistent||(google.maps.event.removeListener(t.listener),t.listener=null)}),this._listeners=this._listeners.filter(function(n){return null!=n.listener}))}},{key:"isOpen",value:function(){return this._isOpen}},{key:"open",value:function(){var n=this.activateCallback("beforeOpen");(void 0===n||n)&&(this._marker?this.setMap(this._marker.getMap()):this._map&&this._position&&this.setMap(this._map))}},{key:"close",value:function(){var n=this.activateCallback("beforeClose");(void 0===n||n)&&(this.clearListeners(),this.setMap(null))}},{key:"destroy",value:function(){this.getMap()&&this.setMap(null);this.clearListeners(!0)}},{key:"setContent",value:function(n){this._opts.content=n;this._html&&this._html.content&&e(this._html.content,n)}},{key:"setPosition",value:function(n){this._position=h(n);this._isOpen&&this._position&&(this.draw(),this.resize(),this.reposition())}},{key:"setWrapperClass",value:function(n){if(this._html&&this._html.wrapper){var t=this._html.wrapper;t.className="si-wrapper-"+this._opts.placement;this._opts.border&&(t.className+=" si-has-border");n&&(t.className+=" "+n)}this._opts.wrapperClass=n}},{key:"getWrapper",value:function(){return this._html?this._html.wrapper:null}},{key:"draw",value:function(){var u,h,n,f,s,p,c,t,e,b,k,y;if(this.getMap()&&this._html&&(this._marker||this._position)){if(u=this._opts.offset,u&&(u.left&&(this._html.wrapper.style.marginLeft=u.left),u.top&&(this._html.wrapper.style.marginTop=u.top)),h=this._opts.backgroundColor,(h&&(this._html.contentWrapper.style.backgroundColor=h,this._opts.pointer&&(this._html.pointerBg.style["border"+o(this._opts.placement)+"Color"]=h)),this._opts.padding&&(this._html.contentWrapper.style.padding=this._opts.padding,this._opts.shadow&&(this._html.shadowFrame.style.padding=this._opts.padding)),this._opts.borderRadius&&(this._html.contentWrapper.style.borderRadius=this._opts.borderRadius,this._opts.shadow&&(this._html.shadowFrame.style.borderRadius=this._opts.borderRadius)),this._opts.fontSize&&(this._html.wrapper.style.fontSize=this._opts.fontSize),this._opts.fontColor&&(this._html.contentWrapper.style.color=this._opts.fontColor),this._opts.pointer&&this._opts.pointer!==!0&&(this._opts.shadow&&(this._html.shadowPointer.style.width=this._opts.pointer,this._html.shadowPointer.style.height=this._opts.pointer),this._html.pointerBorder&&(this._html.pointerBorder.style.borderWidth=this._opts.pointer),this._html.pointerBg.style.borderWidth=this._opts.pointer),this._opts.border)&&(n=0,(void 0!==this._opts.border.width&&(n=i(this._opts.border.width,"0px"),this._html.contentWrapper.style.borderWidth=n.value+n.units),n=Math.round((this._html.contentWrapper.offsetWidth-this._html.contentWrapper.clientWidth)/2),n=i(n+"px","0px"),this._opts.pointer)&&(f=Math.min(this._html.pointerBorder.offsetHeight,this._html.pointerBorder.offsetWidth),f=i(f+"px","0px"),s=Math.round(n.value*(1.41421356237-1)),s=Math.min(s,f.value),this._html.pointerBg.style.borderWidth=f.value-s+f.units,p=o(v(this._opts.placement)),this._html.pointerBg.style["margin"+p]=s+n.units,this._html.pointerBg.style[this._opts.placement]=-n.value+n.units),c=this._opts.border.color,c&&(this._html.contentWrapper.style.borderColor=c,this._html.pointerBorder&&(this._html.pointerBorder.style["border"+o(this._opts.placement)+"Color"]=c))),this._opts.shadow){if(t=this._opts.shadow,e=function(n){var i=t[n];return void 0!==i&&null!=i},e("h")||e("v")||e("blur")||e("spread")||e("color")){var l=i(t.h,r.h),a=i(t.v,r.v),d=i(t.blur,r.blur),g=i(t.spread,r.spread),nt=t.color||r.color,w=function(n,t){return n+" "+t+" "+d.original+" "+g.original+" "+nt};this._html.shadowFrame.style.boxShadow=w(l.original,a.original);b=.70710678118654735*(l.value-a.value)+l.units;k=.70710678118654735*(l.value+a.value)+a.units;this._html.shadowPointerInner&&(this._html.shadowPointerInner.style.boxShadow=w(b,k))}this._opts.shadow.opacity&&(this._html.shadowWrapper.style.opacity=this._opts.shadow.opacity)}y=this.getProjection().fromLatLngToDivPixel(this._position||this._marker.position);y&&(this._html.floatWrapper.style.top=Math.floor(y.y)+"px",this._html.floatWrapper.style.left=Math.floor(y.x)+"px");this._isOpen||(this._isOpen=!0,this.resize(),this.reposition(),this.activateCallback("afterOpen"),google.maps.event.trigger(this.getMap(),"snazzy-info-window-opened",this))}}},{key:"onAdd",value:function(){var n=this,r,t,u,i;this._html||(r=function(n,t){var i,r;if(n&&t)for(i=0;i<t.length;i++)r=t[i],r&&(n.className&&(n.className+=" "),n.className+="si-"+r)},t=function(){for(var t,i=arguments.length,u=Array(i),n=0;n<i;n++)u[n]=arguments[n];return t=document.createElement("div"),r(t,u),t},(this._html={},this._html.wrapper=t(),this.setWrapperClass(this._opts.wrapperClass),this._opts.shadow&&(this._html.shadowWrapper=t("shadow-wrapper-"+this._opts.placement),this._html.shadowFrame=t("frame","shadow-frame"),this._html.shadowWrapper.appendChild(this._html.shadowFrame),this._opts.pointer&&(this._html.shadowPointer=t("shadow-pointer-"+this._opts.placement),this._html.shadowPointerInner=t("shadow-inner-pointer-"+this._opts.placement),this._html.shadowPointer.appendChild(this._html.shadowPointerInner),this._html.shadowWrapper.appendChild(this._html.shadowPointer)),this._html.wrapper.appendChild(this._html.shadowWrapper)),this._html.contentWrapper=t("frame","content-wrapper"),this._html.content=t("content"),this._opts.content&&e(this._html.content,this._opts.content),this._opts.showCloseButton)&&(this._opts.closeButtonMarkup?(u=document.createElement("div"),e(u,this._opts.closeButtonMarkup),this._html.closeButton=u.firstChild):(this._html.closeButton=document.createElement("button"),this._html.closeButton.setAttribute("type","button"),this._html.closeButton.innerHTML="&#215;",r(this._html.closeButton,["close-button"])),this._html.contentWrapper.appendChild(this._html.closeButton)),this._html.contentWrapper.appendChild(this._html.content),this._html.wrapper.appendChild(this._html.contentWrapper),this._opts.pointer&&(this._opts.border&&(this._html.pointerBorder=t("pointer-"+this._opts.placement,"pointer-border-"+this._opts.placement),this._html.wrapper.appendChild(this._html.pointerBorder)),this._html.pointerBg=t("pointer-"+this._opts.placement,"pointer-bg-"+this._opts.placement),this._html.wrapper.appendChild(this._html.pointerBg)),this._html.floatWrapper=t("float-wrapper"),this._html.floatWrapper.appendChild(this._html.wrapper),this.getPanes().floatPane.appendChild(this._html.floatWrapper),i=this.getMap(),this.clearListeners(),this._opts.closeOnMapClick&&this.trackListener(google.maps.event.addListener(i,"click",function(){n.close()})),this._opts.closeWhenOthersOpen&&this.trackListener(google.maps.event.addListener(i,"snazzy-info-window-opened",function(t){n!==t&&n.close()})),this._previousWidth=null,this._previousHeight=null,this.trackListener(google.maps.event.addListener(i,"bounds_changed",function(){var t=i.getDiv(),r=t.offsetWidth,u=t.offsetHeight,f=n._previousWidth,e=n._previousHeight;null!==f&&null!==e&&f===r&&e===u||(n._previousWidth=r,n._previousHeight=u,n.resize())})),this._marker&&this.trackListener(google.maps.event.addListener(this._marker,"position_changed",function(){n.draw()})),this._opts.showCloseButton&&!this._opts.closeButtonMarkup&&this.trackListener(google.maps.event.addDomListener(this._html.closeButton,"click",function(t){t.cancelBubble=!0;t.stopPropagation&&t.stopPropagation();n.close()})),["click","dblclick","rightclick","contextmenu","drag","dragend","dragstart","mousedown","mouseout","mouseover","mouseup","touchstart","touchend","touchmove","wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"].forEach(function(t){n.trackListener(google.maps.event.addDomListener(n._html.wrapper,t,function(n){n.cancelBubble=!0;n.stopPropagation&&n.stopPropagation()}))}),this.activateCallback("open"))}},{key:"onRemove",value:function(){if(this.activateCallback("close"),this._html){var n=this._html.floatWrapper.parentElement;n&&n.removeChild(this._html.floatWrapper);this._html=null}this._isOpen=!1;this.activateCallback("afterClose")}},{key:"getMapInnerBounds",value:function(){var t=this.getMap().getDiv().getBoundingClientRect(),n={top:t.top+this._opts.edgeOffset.top,right:t.right-this._opts.edgeOffset.right,bottom:t.bottom-this._opts.edgeOffset.bottom,left:t.left+this._opts.edgeOffset.left};return n.width=n.right-n.left,n.height=n.bottom-n.top,n}},{key:"reposition",value:function(){if(this._opts.panOnOpen&&this._html){var t=this.getMapInnerBounds(),n=this._html.wrapper.getBoundingClientRect(),i=0,r=0;t.left>=n.left?i=n.left-t.left:t.right<=n.right&&(i=n.left-(t.right-n.width));t.top>=n.top?r=n.top-t.top:t.bottom<=n.bottom&&(r=n.top-(t.bottom-n.height));0===i&&0===r||this.getMap().panBy(i,r)}}},{key:"resize",value:function(){var i,n,t;this._html&&(i=this.getMapInnerBounds(),n=i.width,void 0!==this._opts.maxWidth&&(n=Math.min(n,this._opts.maxWidth)),n-=this._html.wrapper.offsetWidth-this._html.content.offsetWidth,this._html.content.style.maxWidth=n+"px",t=i.height,void 0!==this._opts.maxHeight&&(t=Math.min(t,this._opts.maxHeight)),t-=this._html.wrapper.offsetHeight-this._html.content.offsetHeight,this._html.content.style.maxHeight=t+"px")}}]),t}(function(){return"undefined"!=typeof google?google.maps.OverlayView:function(){}}());t.default=w;n.exports=t.default}),function(){function o(n,t,i){var r=t===""?0:n.indexOf(t),u=i===""?n.length:n.indexOf(i,r+t.length);return n.substring(r+t.length,u)}function it(n){return n&&typeof n=="string"}function h(n){return n&&n.splice}function yi(n){return typeof n=="number"}function i(n,t,i){if(n&&t)for(var r in n)!i&&r in t||(t[r]=n[r]);return t}function a(){n.event.trigger.apply(this,arguments)}function v(n,t){n&&t&&t.error&&n(t.error)}function ii(n,t){var i="";return n&&(i+=n.getTime()-n.getTimezoneOffset()*6e4),t&&(i+=", "+(t.getTime()-t.getTimezoneOffset()*6e4)),i}function rt(n,t){if(t=Math.min(Math.max(t,0),1),n){var i=n.style;typeof i.opacity!="undefined"&&(i.opacity=t);typeof i.filters!="undefined"&&(i.filters.alpha.opacity=Math.floor(100*t));typeof i.filter!="undefined"&&(i.filter="alpha(opacity:"+Math.floor(t*100)+")")}}function bt(n){var t="";for(var i in n)n.hasOwnProperty(i)&&(t.length>0&&(t+=";"),t+=i+":"+n[i]);return t}function pi(){if(typeof XMLHttpRequest=="undefined"){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(n){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(i){}throw new Error("This browser does not support XMLHttpRequest.");}else return new XMLHttpRequest}function at(t){var i=t;return(h(t)&&t.length>0&&(i=t[0]),i instanceof n.LatLng||i instanceof n.Marker)?h(t)&&t.length>1?s.MULTIPOINT:s.POINT:i instanceof n.Polyline?s.POLYLINE:i instanceof n.Polygon?s.POLYGON:i instanceof n.LatLngBounds?s.ENVELOPE:i.x!==undefined&&i.y!==undefined?s.POINT:i.points?s.MULTIPOINT:i.paths?s.POLYLINE:i.rings?s.POLYGON:null}function kt(t){var i=t;return(h(t)&&t.length>0&&(i=t[0]),h(i)&&i.length>0&&(i=i[0]),i instanceof n.LatLng||i instanceof n.Marker||i instanceof n.Polyline||i instanceof n.Polygon||i instanceof n.LatLngBounds)?!0:!1}function ht(n){return n?yi(n)?n:n.wkid?n.wkid:n.toJSON():null}function ri(n,t){for(var i=[],r,u=0,f=n.getLength();u<f;u++)r=n.getAt(u),i.push("["+r.lng()+","+r.lat()+"]");return t&&i.length>0&&i.push("["+n.getAt(0).lng()+","+n.getAt(0).lat()+"]"),i.join(",")}function ut(t){var c=at(t),i,e,r,u,f="{",o;switch(c){case s.POINT:i=h(t)?t[0]:t;i instanceof n.Marker&&(i=i.getPosition());f+="x:"+i.lng()+",y:"+i.lat();break;case s.MULTIPOINT:for(u=[],r=0;r<t.length;r++)i=t[r]instanceof n.Marker?t[r].getPosition():t[r],u.push("["+i.lng()+","+i.lat()+"]");f+="points: ["+u.join(",")+"]";break;case s.POLYLINE:for(u=[],e=h(t)?t:[t],r=0;r<e.length;r++)u.push("["+ri(e[r].getPath())+"]");f+="paths:["+u.join(",")+"]";break;case s.POLYGON:for(u=[],i=h(t)?t[0]:t,o=i.getPaths(),r=0;r<o.getLength();r++)u.push("["+ri(o.getAt(r),!0)+"]");f+="rings:["+u.join(",")+"]";break;case s.ENVELOPE:i=h(t)?t[0]:t;f+="xmin:"+i.getSouthWest().lng()+",ymin:"+i.getSouthWest().lat()+",xmax:"+i.getNorthEast().lng()+",ymax:"+i.getNorthEast().lat()}return f+=", spatialReference:{wkid:4326}",f+"}"}function wi(n){function i(n){for(var i=[],t=0,r=n.length;t<r;t++)i.push("["+n[t][0]+","+n[t][1]+"]");return"["+i.join(",")+"]"}function r(n){for(var r=[],t=0,u=n.length;t<u;t++)r.push(i(n[t]));return"["+r.join(",")+"]"}var t="{";return n.x?t+="x:"+n.x+",y:"+n.y:n.xmin?t+="xmin:"+n.xmin+",ymin:"+n.ymin+",xmax:"+n.xmax+",ymax:"+n.ymax:n.points?t+="points:"+i(n.points):n.paths?t+="paths:"+r(n.paths):n.rings&&(t+="rings:"+r(n.rings)),t+"}"}function dt(t){var i=k[t.spatialReference.wkid||t.spatialReference.wkt],r,u;return i=i||tt,r=i.inverse([t.xmin,t.ymin]),u=i.inverse([t.xmax,t.ymax]),new n.LatLngBounds(new n.LatLng(r[1],r[0]),new n.LatLng(u[1],u[0]))}function ft(t,r){var f=null,u,o,v,s,y,h,e,l,c,a;if(r=r||{},t)if(f=[],t.x)u=new n.Marker(i(r.markerOptions||r,{position:new n.LatLng(t.y,t.x)})),f.push(u);else{if(h=t.points||t.paths||t.rings,!h)return f;for(a=[],o=0,v=h.length;o<v;o++)if(e=h[o],t.points)u=new n.Marker(i(r.markerOptions||r,{position:new n.LatLng(e[1],e[0])})),f.push(u);else{for(c=[],s=0,y=e.length;s<y;s++)l=e[s],c.push(new n.LatLng(l[1],l[0]));t.paths?(u=new n.Polyline(i(r.polylineOptions||r,{path:c})),f.push(u)):t.rings&&a.push(c)}t.rings&&(u=new n.Polygon(i(r.polygonOptions||r,{paths:a})),f.push(u))}return f}function ui(n,t){if(n)for(var r,i=0,u=n.length;i<u;i++)r=n[i],r.geometry&&(r.geometry=ft(r.geometry,t))}function gt(n){var t,i,u,r;if(typeof n=="object"){if(h(n)){for(t=[],i=0,u=n.length;i<u;i++)t.push(gt(n[i]));return"["+t.join(",")+"]"}if(kt(n))return ut(n);if(n.toJSON)return n.toJSON();t="";for(r in n)n.hasOwnProperty(r)&&(t.length>0&&(t+=", "),t+=r+":"+gt(n[r]));return"{"+t+"}"}return n.toString()}function fi(t){for(var i,f=[],r=0,u=t.length;r<u;r++)i=t[r],i instanceof n.Marker&&(i=i.getPosition()),f.push({geometry:{x:i.lng(),y:i.lat(),spatialReference:{wkid:4326}}});return{type:'"features"',features:f,doNotLocateOnRestrictedElements:!1}}function ei(n){var t={},r,u,f,i,e;if(!n)return null;if(r=[],n.geometries&&n.geometries.length>0)for(u=n.geometries[0],f=kt(u),i=0,e=n.geometries.length;i<e;i++)f?r.push(ut(n.geometries[i])):r.push(wi(n.geometries[i]));return n.geometryType||(n.geometryType=at(u)),f?t.inSR=tt.wkid:n.inSpatialReference&&(t.inSR=ht(n.inSpatialReference)),n.outSpatialReference&&(t.outSR=ht(n.outSpatialReference)),t.geometries='{geometryType:"'+n.geometryType+'", geometries:['+r.join(",")+"]}",t}function oi(n){var i="",t,r;if(n){n.f=n.f||"json";for(t in n)n.hasOwnProperty(t)&&n[t]!==null&&n[t]!==undefined&&(r=gt(n[t]),i+=(i.length>0?"&":"")+(t+"="+(escape?escape(r):encodeURIComponent(r))))}return i}function bi(n,t){for(var r=[],i=2,u=arguments.length;i<u;i++)r.push(arguments[i]);return function(){n.apply(t,r)}}function ni(t,i,r){i.hasLoaded()?t.push(i.copyrightText):n.event.addListenerOnce(i,"load",function(){et(r)})}function et(t){var r=null,e,s,o,u,h,c,a,i,f;if(t){if(e=t.controls[n.ControlPosition.BOTTOM_RIGHT],e)for(i=0,f=e.getLength();i<f;i++)if(e.getAt(i).id==="agsCopyrights"){r=e.getAt(i);break}if(r||(r=document.createElement("div"),r.style.fontFamily="Arial,sans-serif",r.style.fontSize="10px",r.style.textAlign="right",r.id="agsCopyrights",t.controls[n.ControlPosition.BOTTOM_RIGHT].push(r),n.event.addListener(t,"maptypeid_changed",function(){et(t)})),s=t.agsOverlays,o=[],s)for(i=0,f=s.getLength();i<f;i++)ni(o,s.getAt(i).mapService_,t);if(h=t.overlayMapTypes,h)for(i=0,f=h.getLength();i<f;i++)if(u=h.getAt(i),u instanceof l)for(c=0,a=u.tileLayers_.length;c<a;c++)ni(o,u.tileLayers_[c].mapService_,t);if(u=t.mapTypes.get(t.getMapTypeId()),u instanceof l){for(i=0,f=u.tileLayers_.length;i<f;i++)ni(o,u.tileLayers_[i].mapService_,t);r.style.color=u.negative?"#ffffff":"#000000"}r.innerHTML=o.join("<br/>")}}function u(n,t,i,r){var f="ags_jsonp_"+vi+++"_"+Math.floor(Math.random()*1e6),e=null,s,h,l,u;if(t=t||{},t[i||"callback"]="ags_jsonp."+f,s=oi(t),h=document.getElementsByTagName("head")[0],!h)throw new Error("document must have header tag");if(l=function(){window.ags_jsonp[f]&&delete window.ags_jsonp[f];e&&h.removeChild(e);e=null;r.apply(null,arguments);a(w,"jsonpend",f)},window.ags_jsonp[f]=l,(s+n).length<2e3&&!st.alwaysUseProxy)e=document.createElement("script"),e.src=n+(n.indexOf("?")===-1?"?":"&")+s,e.id=f,h.appendChild(e);else{var o=window.location,v=o.protocol+"//"+o.hostname+(!o.port||o.port===80?"":":"+o.port+"/"),c=!0;if(n.toLowerCase().indexOf(v.toLowerCase())!==-1&&(c=!1),st.alwaysUseProxy&&(c=!0),c&&!st.proxyUrl)throw new Error("No proxyUrl property in Config is defined");u=pi();u.onreadystatechange=function(){if(u.readyState===4)if(u.status===200)eval(u.responseText);else throw new Error("Error code "+u.status);};u.open("POST",c?st.proxyUrl+"?"+n:n,!0);u.setRequestHeader("Content-Type","application/x-www-form-urlencoded");u.send(s)}return a(w,"jsonpstart",f),f}function r(n){n=n||{};this.wkid=n.wkid;this.wkt=n.wkt}function vt(n){n=n||{};r.call(this,n)}function y(n){var i,u;n=n||{};r.call(this,n);var h=n.inverse_flattening,f=n.standard_parallel_1*t,e=n.standard_parallel_2*t,c=n.latitude_of_origin*t;this.a_=n.semi_major/n.unit;this.lamda0_=n.central_meridian*t;this.FE_=n.false_easting;this.FN_=n.false_northing;i=1/h;u=2*i-i*i;this.e_=Math.sqrt(u);var o=this.calc_m_(f,u),l=this.calc_m_(e,u),a=this.calc_t_(c,this.e_),s=this.calc_t_(f,this.e_),v=this.calc_t_(e,this.e_);this.n_=Math.log(o/l)/Math.log(s/v);this.F_=o/(this.n_*Math.pow(s,this.n_));this.rho0_=this.calc_rho_(this.a_,this.F_,a,this.n_)}function d(n){var u,f,i;n=n||{};r.call(this,n);this.a_=n.semi_major/n.unit;u=n.inverse_flattening;this.k0_=n.scale_factor;f=n.latitude_of_origin*t;this.lamda0_=n.central_meridian*t;this.FE_=n.false_easting;this.FN_=n.false_northing;i=1/u;this.es_=2*i-i*i;this.ep4_=this.es_*this.es_;this.ep6_=this.ep4_*this.es_;this.eas_=this.es_/(1-this.es_);this.M0_=this.calc_m_(f,this.a_,this.es_,this.ep4_,this.ep6_)}function g(n){n=n||{};r.call(this,n);this.a_=(n.semi_major||6378137)/(n.unit||1);this.lamda0_=(n.central_meridian||0)*t}function p(n){var i,u;n=n||{};r.call(this,n);var c=n.inverse_flattening,e=n.standard_parallel_1*t,o=n.standard_parallel_2*t,l=n.latitude_of_origin*t;this.a_=n.semi_major/n.unit;this.lamda0_=n.central_meridian*t;this.FE_=n.false_easting;this.FN_=n.false_northing;i=1/c;u=2*i-i*i;this.e_=Math.sqrt(u);var f=this.calc_m_(e,u),s=this.calc_m_(o,u),h=this.calc_q_(e,this.e_),a=this.calc_q_(o,this.e_),v=this.calc_q_(l,this.e_);this.n_=(f*f-s*s)/(a-h);this.C_=f*f+this.n_*h;this.rho0_=this.calc_rho_(this.a_,this.C_,this.n_,v)}function ki(n){this.url=n;var t=this;u(n,{},"",function(n){i(n,t);a(t,"load")})}function nt(n){this.url=n;this.definition=null}function f(n,t){var i,r;this.url=n;this.loaded_=!1;i=n.split("/");this.name=i[i.length-2].replace(/_/g," ");t=t||{};t.delayLoad?(r=this,window.setTimeout(function(){r.loadServiceInfo()},t.delayLoad*1e3)):this.loadServiceInfo()}function ct(n){this.url=n;this.loaded_=!1;var t=this;u(n,{},"",function(n){t.init_(n)})}function ti(n){this.url=n;this.t="geocodeservice"}function di(n){this.url=n;this.loaded_=!1;var t=this;u(n,{},"",function(n){i(n,t);t.loaded_=!0;a(t,"load")})}function ci(n){this.url=n;this.loaded_=!1;var t=this;u(n,{},"",function(n){i(n,t);t.loaded_=!0;a(t,"load")})}function li(n){this.url=n}function c(t){var r,i;if(this.lods_=t?t.lods:null,this.spatialReference_=t?k[t.spatialReference.wkid||t.spatialReference.wkt]:ot,!this.spatialReference_)throw new Error("unsupported Spatial Reference");if(this.resolution0_=t?t.lods[0].resolution:156543.033928,this.minZoom=Math.floor(Math.log(this.spatialReference_.getCircum()/this.resolution0_/256)/Math.LN2+.5),this.maxZoom=t?this.minZoom+this.lods_.length-1:20,n.Size&&(this.tileSize_=t?new n.Size(t.cols,t.rows):new n.Size(256,256)),this.scale_=Math.pow(2,this.minZoom)*this.resolution0_,this.originX_=t?t.origin.x:-20037508.342787,this.originY_=t?t.origin.y:20037508.342787,t)for(i=0;i<t.lods.length-1;i++)if(r=t.lods[i].resolution/t.lods[i+1].resolution,r>2.001||r<1.999)throw new Error("This type of map cache is not supported in V3. \nScale ratio between zoom levels must be 2");}function b(t,r){var e;if(r=r||{},r.opacity&&(this.opacity_=r.opacity,delete r.opacity),i(r,this),this.mapService_=t instanceof f?t:new f(t),r.hosts){var u=o(this.mapService_.url,"","://"),s=o(this.mapService_.url,"://","/"),h=o(this.mapService_.url,u+"://"+s,"");this.urlTemplate_=u+"://"+r.hosts+h;this.numOfHosts_=parseInt(o(r.hosts,"[","]"),10)}this.name=r.name||this.mapService_.name;this.maxZoom=r.maxZoom||19;this.minZoom=r.minZoom||0;this.dynaZoom=r.dynaZoom||this.maxZoom;this.mapService_.loaded_?this.init_(r):(e=this,n.event.addListenerOnce(this.mapService_,"load",function(){e.init_(r)}));this.tiles_={};this.map_=r.map}function l(t,r){var e,u,o;if(r=r||{},r.opacity&&(this.opacity_=r.opacity,delete r.opacity),i(r,this),u=t,it(t))u=[new b(t,r)];else if(t instanceof f)u=[new b(t,r)];else if(t instanceof b)u=[t];else if(t.length>0&&it(t[0]))for(u=[],e=0;e<t.length;e++)u[e]=new b(t[e],r);if(this.tileLayers_=u,this.tiles_={},r.maxZoom!==undefined)this.maxZoom=r.maxZoom;else{for(o=0,e=0;e<u.length;e++)o=Math.max(o,u[e].maxZoom);this.maxZoom=o}u[0].projection_?(this.tileSize=u[0].projection_.tileSize_,this.projection=u[0].projection_):this.tileSize=new n.Size(256,256);this.name||(this.name=u[0].name)}function e(n,t){t=t||{};this.mapService_=n instanceof f?n:new f(n);this.minZoom=t.minZoom;this.maxZoom=t.maxZoom;this.opacity_=t.opacity||1;this.exportOptions_=t.exportOptions||{};this.drawing_=!1;this.needsNewRefresh_=!1;this.overlay_=null;this.div_=null;t.map&&this.setMap(t.map);this.map_=null;this.listeners_=[]}function lt(n,t,i,r){this.bounds_=n;this.url_=t;this.map_=i;this.div_=null;this.op_=r;this.setMap(i)}function ai(n){this.map_=n;et(n)}var yt=yt||{},t=Math.PI/180,vi=0,s,si,hi;window.ags_jsonp=window.ags_jsonp||{};var n=google.maps,tt,pt,ot,wt,st={proxyUrl:null,alwaysUseProxy:!1},k={},w={};s={POINT:"esriGeometryPoint",MULTIPOINT:"esriGeometryMultipoint",POLYLINE:"esriGeometryPolyline",POLYGON:"esriGeometryPolygon",ENVELOPE:"esriGeometryEnvelope"};w.getJSON=function(n,t,i,r){u(n,t,i,r)};w.addToMap=function(n,t){var i,r,u;if(h(t))for(r=0,u=t.length;r<u;r++)i=t[r],h(i)?w.addToMap(n,i):kt(i)&&i.setMap(n)};w.removeFromMap=function(n,t){w.addToMap(null,n);t&&(n.length=0)};r.prototype.forward=function(n){return n};r.prototype.inverse=function(n){return n};r.prototype.getCircum=function(){return 360};r.prototype.toJSON=function(){return"{"+(this.wkid?" wkid:"+this.wkid:"wkt: '"+this.wkt+"'")+"}"};vt.prototype=new r;y.prototype=new r;y.prototype.calc_m_=function(n,t){var i=Math.sin(n);return Math.cos(n)/Math.sqrt(1-t*i*i)};y.prototype.calc_t_=function(n,t){var i=t*Math.sin(n);return Math.tan(Math.PI/4-n/2)/Math.pow((1-i)/(1+i),t/2)};y.prototype.calc_rho_=function(n,t,i,r){return n*t*Math.pow(i,r)};y.prototype.calc_phi_=function(n,t,i){var r=t*Math.sin(i);return Math.PI/2-2*Math.atan(n*Math.pow((1-r)/(1+r),t/2))};y.prototype.solve_phi_=function(n,t,i){for(var f=0,r=i,u=this.calc_phi_(n,t,r);Math.abs(u-r)>1e-9&&f<10;)f++,r=u,u=this.calc_phi_(n,t,r);return u};y.prototype.forward=function(n){var u=n[1]*t,f=n[0]*t,e=this.calc_t_(u,this.e_),i=this.calc_rho_(this.a_,this.F_,e,this.n_),r=this.n_*(f-this.lamda0_),o=this.FE_+i*Math.sin(r),s=this.FN_+this.rho0_-i*Math.cos(r);return[o,s]};y.prototype.inverse=function(n){var i=n[0]-this.FE_,r=n[1]-this.FN_,f=Math.atan(i/(this.rho0_-r)),e=(this.n_>0?1:-1)*Math.sqrt(i*i+(this.rho0_-r)*(this.rho0_-r)),u=Math.pow(e/(this.a_*this.F_),1/this.n_),o=Math.PI/2-2*Math.atan(u),s=this.solve_phi_(u,this.e_,o),h=f/this.n_+this.lamda0_;return[h/t,s/t]};y.prototype.getCircum=function(){return Math.PI*2*this.a_};d.prototype=new r;d.prototype.calc_m_=function(n,t,i,r,u){return t*((1-i/4-3*r/64-5*u/256)*n-(3*i/8+3*r/32+45*u/1024)*Math.sin(2*n)+(15*r/256+45*u/1024)*Math.sin(4*n)-35*u/3072*Math.sin(6*n))};d.prototype.forward=function(n){var u=n[1]*t,o=n[0]*t,e=this.a_/Math.sqrt(1-this.es_*Math.pow(Math.sin(u),2)),i=Math.pow(Math.tan(u),2),f=this.eas_*Math.pow(Math.cos(u),2),r=(o-this.lamda0_)*Math.cos(u),s=this.calc_m_(u,this.a_,this.es_,this.ep4_,this.ep6_),h=this.FE_+this.k0_*e*(r+(1-i+f)*Math.pow(r,3)/6+(5-18*i+i*i+72*f-58*this.eas_)*Math.pow(r,5)/120),c=this.FN_+this.k0_*(s-this.M0_)+e*Math.tan(u)*(r*r/2+(5-i+9*f+4*f*f)*Math.pow(r,4)/120+(61-58*i+i*i+600*f-330*this.eas_)*Math.pow(r,6)/720);return[h,c]};d.prototype.inverse=function(n){var h=n[0],c=n[1],u=(1-Math.sqrt(1-this.es_))/(1+Math.sqrt(1-this.es_)),l=this.M0_+(c-this.FN_)/this.k0_,o=l/(this.a_*(1-this.es_/4-3*this.ep4_/64-5*this.ep6_/256)),f=o+(3*u/2-27*Math.pow(u,3)/32)*Math.sin(2*o)+(21*u*u/16-55*Math.pow(u,4)/32)*Math.sin(4*o)+151*Math.pow(u,3)/6*Math.sin(6*o)+1097*Math.pow(u,4)/512*Math.sin(8*o),i=this.eas_*Math.pow(Math.cos(f),2),r=Math.pow(Math.tan(f),2),s=this.a_/Math.sqrt(1-this.es_*Math.pow(Math.sin(f),2)),a=this.a_*(1-this.es_)/Math.pow(1-this.es_*Math.pow(Math.sin(f),2),3/2),e=(h-this.FE_)/(s*this.k0_),v=f-s*Math.tan(f)/a*(e*e/2-(5+3*r+10*i-4*i*i-9*this.eas_)*Math.pow(e,4)/24+(61+90*r+28*i+45*r*r-252*this.eas_-3*i*i)*Math.pow(e,6)/720),y=this.lamda0_+(e-(1+2*r+i)*Math.pow(e,3)/6+(5-2*i+28*r-3*i*i+8*this.eas_+24*r*r)*Math.pow(e,5)/120)/Math.cos(f);return[y/t,v/t]};d.prototype.getCircum=function(){return Math.PI*2*this.a_};g.prototype=new r;g.prototype.forward=function(n){var i=n[1]*t,r=n[0]*t,u=this.a_*(r-this.lamda0_),f=this.a_/2*Math.log((1+Math.sin(i))/(1-Math.sin(i)));return[u,f]};g.prototype.inverse=function(n){var i=n[0],r=n[1],u=Math.PI/2-2*Math.atan(Math.exp(-r/this.a_)),f=i/this.a_+this.lamda0_;return[f/t,u/t]};g.prototype.getCircum=function(){return Math.PI*2*this.a_};p.prototype=new r;p.prototype.calc_m_=function(n,t){var i=Math.sin(n);return Math.cos(n)/Math.sqrt(1-t*i*i)};p.prototype.calc_q_=function(n,t){var i=t*Math.sin(n);return(1-t*t)*(Math.sin(n)/(1-i*i)-1/(2*t)*Math.log((1-i)/(1+i)))};p.prototype.calc_rho_=function(n,t,i,r){return n*Math.sqrt(t-i*r)/i};p.prototype.calc_phi_=function(n,t,i){var r=t*Math.sin(i);return i+(1-r*r)*(1-r*r)/(2*Math.cos(i))*(n/(1-t*t)-Math.sin(i)/(1-r*r)+Math.log((1-r)/(1+r))/(2*t))};p.prototype.solve_phi_=function(n,t,i){for(var f=0,r=i,u=this.calc_phi_(n,t,r);Math.abs(u-r)>1e-8&&f<10;)f++,r=u,u=this.calc_phi_(n,t,r);return u};p.prototype.forward=function(n){var u=n[1]*t,f=n[0]*t,e=this.calc_q_(u,this.e_),i=this.calc_rho_(this.a_,this.C_,this.n_,e),r=this.n_*(f-this.lamda0_),o=this.FE_+i*Math.sin(r),s=this.FN_+this.rho0_-i*Math.cos(r);return[o,s]};p.prototype.inverse=function(n){var i=n[0]-this.FE_,r=n[1]-this.FN_,f=Math.sqrt(i*i+(this.rho0_-r)*(this.rho0_-r)),u=this.n_>0?1:-1,o=Math.atan(u*i/(u*this.rho0_-u*r)),e=(this.C_-f*f*this.n_*this.n_/(this.a_*this.a_))/this.n_,s=Math.asin(e/2),h=this.solve_phi_(e,this.e_,s),c=o/this.n_+this.lamda0_;return[c/t,h/t]};p.prototype.getCircum=function(){return Math.PI*2*this.a_};p.prototype.getCircum=function(){return Math.PI*2*this.a_};tt=new vt({wkid:4326});pt=new vt({wkid:4269});ot=new g({wkid:102113,semi_major:6378137,central_meridian:0,unit:1});wt=new g({wkid:102100,semi_major:6378137,central_meridian:0,unit:1});k={"4326":tt,"4269":pt,"102113":ot,"102100":wt};r.WGS84=tt;r.NAD83=pt;r.WEB_MERCATOR=ot;r.WEB_MERCATOR_AUX=wt;w.registerSR=function(n,t){var f=k[""+n],u,i,e,s;if(f)return f;if(t instanceof r)k[""+n]=t,f=t;else{u=t||n;i={wkt:n};n===parseInt(n,10)&&(i={wkid:n});e=o(u,'PROJECTION["','"]');s=o(u,"SPHEROID[","]").split(",");e!==""&&(i.unit=parseFloat(o(o(u,"PROJECTION",""),"UNIT[","]").split(",")[1]),i.semi_major=parseFloat(s[1]),i.inverse_flattening=parseFloat(s[2]),i.latitude_of_origin=parseFloat(o(u,'"Latitude_Of_Origin",',"]")),i.central_meridian=parseFloat(o(u,'"Central_Meridian",',"]")),i.false_easting=parseFloat(o(u,'"False_Easting",',"]")),i.false_northing=parseFloat(o(u,'"False_Northing",',"]")));switch(e){case"":f=new r(i);break;case"Lambert_Conformal_Conic":i.standard_parallel_1=parseFloat(o(u,'"Standard_Parallel_1",',"]"));i.standard_parallel_2=parseFloat(o(u,'"Standard_Parallel_2",',"]"));f=new y(i);break;case"Transverse_Mercator":i.scale_factor=parseFloat(o(u,'"Scale_Factor",',"]"));f=new d(i);break;case"Albers":i.standard_parallel_1=parseFloat(o(u,'"Standard_Parallel_1",',"]"));i.standard_parallel_2=parseFloat(o(u,'"Standard_Parallel_2",',"]"));f=new p(i);break;case'GEOGCS["Lon':f=new r(i);break;default:throw new Error(e+"  not supported");}f&&(k[""+n]=f)}return f};nt.prototype.load=function(){var n=this;this.loaded_||u(this.url,{},"",function(t){i(t,n);n.loaded_=!0;a(n,"load")})};nt.prototype.isInScale=function(n){return this.maxScale&&this.maxScale>n?!1:this.minScale&&this.minScale<n?!1:!0};si={INTERSECTS:"esriSpatialRelIntersects",CONTAINS:"esriSpatialRelContains",CROSSES:"esriSpatialRelCrosses",ENVELOPE_INTERSECTS:"esriSpatialRelEnvelopeIntersects",INDEX_INTERSECTS:"esriSpatialRelIndexIntersects",OVERLAPS:"esriSpatialRelOverlaps",TOUCHES:"esriSpatialRelTouches",WITHIN:"esriSpatialRelWithin"};nt.prototype.query=function(n,t,r){if(n){var f=i(n,{});n.geometry&&!it(n.geometry)&&(f.geometry=ut(n.geometry),f.geometryType=at(n.geometry),f.inSR=4326);n.spatialRelationship&&(f.spatialRel=n.spatialRelationship,delete f.spatialRelationship);n.outFields&&h(n.outFields)&&(f.outFields=n.outFields.join(","));n.objectIds&&(f.objectIds=n.objectIds.join(","));n.time&&(f.time=ii(n.time,n.endTime));f.outSR=4326;f.returnGeometry=n.returnGeometry===!1?!1:!0;f.returnIdsOnly=n.returnIdsOnly===!0?!0:!1;delete f.overlayOptions;u(this.url+"/query",f,"",function(i){ui(i.features,n.overlayOptions);t(i,i.error);v(r,i)})}};nt.prototype.queryRelatedRecords=function(n,t,r){if(n){var f=i(n,{});f.f=f.f||"json";f.outFields&&!it(f.outFields)&&(f.outFields=f.outFields.join(","));f.returnGeometry=f.returnGeometry===!1?!1:!0;u(this.url+"/query",f,"",function(n){v(r,n);t(n)})}};f.prototype.loadServiceInfo=function(){var n=this;u(this.url,{},"",function(t){n.init_(t)})};f.prototype.init_=function(n){var t=this;if(n.error)throw new Error(n.error.message);i(n,this);this.spatialReference=n.spatialReference.wkt?w.registerSR(n.spatialReference.wkt):k[n.spatialReference.wkid];n.tables!==undefined?u(this.url+"/layers",{},"",function(n){t.initLayers_(n);u(t.url+"/legend",{},"",function(n){t.initLegend_(n);t.setLoaded_()})}):(t.initLayers_(n),t.setLoaded_())};f.prototype.setLoaded_=function(){this.loaded_=!0;a(this,"load")};f.prototype.initLayers_=function(n){var e=[],h=[],t,r,u,f,o,c,s;for(this.layers=e,n.tables&&(this.tables=h),r=0,u=n.layers.length;r<u;r++)f=n.layers[r],t=new nt(this.url+"/"+f.id),i(f,t),t.visible=t.defaultVisibility,e.push(t);if(n.tables)for(r=0,u=n.tables.length;r<u;r++)f=n.tables[r],t=new nt(this.url+"/"+f.id),i(f,t),h.push(t);for(r=0,u=e.length;r<u;r++)if(t=e[r],t.subLayerIds)for(t.subLayers=[],o=0,c=t.subLayerIds.length;o<c;o++)s=this.getLayer(t.subLayerIds[o]),t.subLayers.push(s),s.parentLayer=t};f.prototype.initLegend_=function(n){var e=this.layers,u,t,f,r;if(n.layers)for(t=0,f=n.layers.length;t<f;t++)r=n.layers[t],u=e[r.layerId],i(r,u)};f.prototype.getLayer=function(n){var i=this.layers,t,r;if(i)for(t=0,r=i.length;t<r;t++)if(n===i[t].id||it(n)&&i[t].name.toLowerCase()===n.toLowerCase())return i[t];return null};f.prototype.getLayerDefs_=function(){var i={},n,r,t;if(this.layers)for(n=0,r=this.layers.length;n<r;n++)t=this.layers[n],t.definition&&(i[String(t.id)]=t.definition);return i};f.prototype.hasLoaded=function(){return this.loaded_};f.prototype.getVisibleLayerIds_=function(){var u=[],n,t,i,r,f;if(this.layers){for(t=0,i=this.layers.length;t<i;t++)if(n=this.layers[t],n.subLayers)for(r=0,f=n.subLayers.length;r<f;r++)if(n.subLayers[r].visible===!1){n.visible=!1;break}for(t=0,i=this.layers.length;t<i;t++)(n=this.layers[t],n.subLayers&&n.subLayers.length>0)||n.visible===!0&&u.push(n.id)}return u};f.prototype.getInitialBounds=function(){return this.initialExtent?(this.initBounds_=this.initBounds_||dt(this.initialExtent),this.initBounds_):null};f.prototype.getFullBounds=function(){return this.fullExtent?(this.fullBounds_=this.fullBounds_||dt(this.fullExtent),this.fullBounds_):null};f.prototype.exportMap=function(n,t,i){var r,s,f,c;if(n&&n.bounds){r={};r.f=n.f;var e=n.bounds,o=e.getSouthWest().lng(),h=e.getNorthEast().lng();if(o>h&&(o=o-180),r.bbox=""+o+","+e.getSouthWest().lat()+","+h+","+e.getNorthEast().lat(),r.size=""+n.width+","+n.height,r.dpi=n.dpi,n.imageSR&&(r.imageSR=n.imageSR.wkid?n.imageSR.wkid:"{wkt:"+n.imageSR.wkt+"}"),r.bboxSR="4326",r.format=n.format,s=n.layerDefinitions,s===undefined&&(s=this.getLayerDefs_()),r.layerDefs=bt(s),f=n.layerIds,c=n.layerOption||"show",f===undefined&&(f=this.getVisibleLayerIds_()),f.length>0)r.layers=c+":"+f.join(",");else if(this.loaded_&&t){t({href:null});return}if(r.transparent=n.transparent===!1?!1:!0,n.time&&(r.time=ii(n.time,n.endTime)),r.layerTimeOptions=n.layerTimeOptions,r.f==="image")return this.url+"/export?"+oi(r);u(this.url+"/export",r,"",function(n){n.extent?(n.bounds=dt(n.extent),delete n.extent,t(n)):v(i,n.error)})}};f.prototype.identify=function(n,t,i){if(n){var r={};r.geometry=ut(n.geometry);r.geometryType=at(n.geometry);r.mapExtent=ut(n.bounds);r.tolerance=n.tolerance||2;r.sr=4326;r.imageDisplay=""+n.width+","+n.height+","+(n.dpi||96);r.layers=n.layerOption||"all";n.layerIds&&(r.layers+=":"+n.layerIds.join(","));n.layerDefs&&(r.layerDefs=bt(n.layerDefs));r.maxAllowableOffset=n.maxAllowableOffset;r.returnGeometry=n.returnGeometry===!1?!1:!0;u(this.url+"/identify",r,"",function(r){var o=null,f,u,e;if(r.results)for(o=[],f=0;f<r.results.length;f++)u=r.results[f],e=ft(u.geometry,n.overlayOptions),u.feature={geometry:e,attributes:u.attributes},delete u.attributes;t(r);v(i,r)})}};f.prototype.find=function(n,t,r){if(n){var f=i(n,{});n.layerIds&&(f.layers=n.layerIds.join(","),delete f.layerIds);n.searchFields&&(f.searchFields=n.searchFields.join(","));f.contains=n.contains===!1?!1:!0;n.layerDefinitions&&(f.layerDefs=bt(n.layerDefinitions),delete f.layerDefinitions);f.sr=4326;f.returnGeometry=n.returnGeometry===!1?!1:!0;u(this.url+"/find",f,"",function(i){var o=null,f,u,e;if(i.results)for(o=[],f=0;f<i.results.length;f++)u=i.results[f],e=ft(u.geometry,n.overlayOptions),u.feature={geometry:e,attributes:u.attributes},delete u.attributes;t(i);v(r,i)})}};f.prototype.queryLayer=function(n,t,i,r){var u=this.getLayer(n);u&&u.query(t,i,r)};ct.prototype.init_=function(n){i(n,this);n.spatialReference&&(this.spatialReference=k[n.spatialReference.wkid||n.spatialReference.wkt]||tt);this.loaded_=!0;a(this,"load")};ct.prototype.findAddressCandidates=function(t,r,f){var e=i(t,{}),o;e.inputs&&(i(e.inputs,e),delete e.inputs);h(e.outFields)&&(e.outFields=e.outFields.join(","));o=this;u(this.url+"/findAddressCandidates",e,"",function(i){var s,u,h,c,e,l;if(i.candidates)for(h=[],c=0;c<i.candidates.length;c++)s=i.candidates[c],u=s.location,isNaN(u.x)||isNaN(u.y)||(e=[u.x,u.y],l=o.spatialReference,t.outSR&&(l=k[t.outSR]),l&&(e=l.inverse(e)),s.location=new n.LatLng(e[1],e[0]),h[h.length]=s);r({candidates:h});v(f,i)})};ct.prototype.geocode=function(n,t){this.findAddressCandidates(n,t)};ct.prototype.reverseGeocode=function(t,i,r){it(t.location)||(t.location=ut(t.location));t.outSR=4326;var f=this;u(this.url+"/reverseGeocode",t,"",function(t){var u,e;t.location&&(u=t.location,isNaN(u.x)||isNaN(u.y)||(e=[u.x,u.y],f.spatialReference&&(e=f.spatialReference.inverse(e)),t.location=new n.LatLng(e[1],e[0])));i(t);v(r,t)})};ti.prototype.project=function(n,t,i){var r=ei(n);u(this.url+"/project",r,"callback",function(r){var f=[],u,e;if(n.outSpatialReference===4326||n.outSpatialReference.wkid===4326){for(u=0,e=r.geometries.length;u<e;u++)f.push(ft(r.geometries[u]));r.geometries=f}t(r);v(i,r)})};hi={METER:9001,FOOT:9002,SURVEY_FOOT:9003,SURVEY_MILE:9035,KILLOMETER:9036,RADIAN:9101,DEGREE:9102};ti.prototype.buffer=function(n,t,i){var r=ei(n);n.bufferSpatialReference&&(r.bufferSR=ht(n.bufferSpatialReference));r.outSR=4326;r.distances=n.distances.join(",");n.unit&&(r.unit=n.unit);u(this.url+"/buffer",r,"callback",function(r){var f=[],u,e;if(r.geometries)for(u=0,e=r.geometries.length;u<e;u++)f.push(ft(r.geometries[u],n.overlayOptions));r.geometries=f;t(r);v(i,r)})};ci.prototype.execute=function(n,t,r){var f={};n.parameters&&i(n.parameters,f);f["env:outSR"]=n.outSpatialReference?ht(n.outSpatialReference):4326;n.processSpatialReference&&(f["env:processSR"]=ht(n.processSpatialReference));u(this.url+"/execute",f,"",function(i){var u,f,e,o,s;if(i.results)for(e=0;e<i.results.length;e++)if(u=i.results[e],u.dataType==="GPFeatureRecordSetLayer")for(o=0,s=u.value.features.length;o<s;o++)f=u.value.features[o],f.geometry&&(f.geometry=ft(f.geometry,n.overlayOptions));t(i);v(r,i)})};li.prototype.solve=function(n,t,r){if(n){var f=i(n,{});h(n.stops)&&(f.stops=fi(n.stops));h(n.barriers)&&(n.barriers.length>0?f.barriers=fi(n.barriers):delete f.barriers);f.returnRoutes=n.returnRoutes===!1?!1:!0;f.returnDirections=n.returnDirections===!0?!0:!1;f.returnBarriers=n.returnBarriers===!0?!0:!1;f.returnStops=n.returnStops===!0?!0:!1;u(this.url+"/solve",f,"",function(i){i.routes&&ui(i.routes.features,n.overlayOptions);t(i);v(r,i)})}};c.prototype.fromLatLngToPoint=function(t,i){if(!t||isNaN(t.lat())||isNaN(t.lng()))return null;var u=this.spatialReference_.forward([t.lng(),t.lat()]),r=i||new n.Point(0,0);return r.x=(u[0]-this.originX_)/this.scale_,r.y=(this.originY_-u[1])/this.scale_,r};c.prototype.fromLatLngToPoint=c.prototype.fromLatLngToPoint;c.prototype.fromPointToLatLng=function(t){if(t===null)return null;var r=t.x*this.scale_+this.originX_,u=this.originY_-t.y*this.scale_,i=this.spatialReference_.inverse([r,u]);return new n.LatLng(i[1],i[0])};c.prototype.getScale=function(n){var t=n-this.minZoom,i=0;return this.lods_[t]&&(i=this.lods_[t].scale),i};c.WEB_MECATOR=new c;b.prototype.init_=function(n){this.mapService_.tileInfo&&(this.projection_=new c(this.mapService_.tileInfo),this.minZoom=n.minZoom||this.projection_.minZoom,this.maxZoom=n.maxZoom||this.projection_.maxZoom)};b.prototype.getTileUrl=function(t,i){var h=i-(this.projection_?this.projection_.minZoom:this.minZoom),o="",s,r,u;if(!isNaN(t.x)&&!isNaN(t.y)&&h>=0&&t.x>=0&&t.y>=0){s=this.mapService_.url;this.urlTemplate_&&(s=this.urlTemplate_.replace("["+this.numOfHosts_+"]",""+(t.y+t.x)%this.numOfHosts_));r=this.projection_||(this.map_?this.map_.getProjection():c.WEB_MECATOR);!r instanceof c&&(r=c.WEB_MECATOR);var f=r.tileSize_,e=1<<i,v=new n.Point(t.x*f.width/e,(t.y+1)*f.height/e),y=new n.Point((t.x+1)*f.width/e,t.y*f.height/e),l=new n.LatLngBounds(r.fromPointToLatLng(v),r.fromPointToLatLng(y)),a=this.mapService_.getFullBounds();this.mapService_.singleFusedMapCache===!1||i>this.dynaZoom?(u={f:"image"},u.bounds=l,u.format="png32",u.width=f.width,u.height=f.height,u.imageSR=r.spatialReference_,o=this.mapService_.exportMap(u)):o=a&&!a.intersects(l)?"":s+"/tile/"+h+"/"+t.y+"/"+t.x}return o};b.prototype.setOpacity=function(n){var t,i;this.opacity_=n;t=this.tiles_;for(i in t)t.hasOwnProperty(i)&&rt(t[i],n)};b.prototype.getOpacity=function(){return this.opacity_};b.prototype.getMapService=function(){return this.mapService_};l.prototype.getTile=function(n,t,i){for(var u,e,r,f=i.createElement("div"),o="_"+n.x+"_"+n.y+"_"+t,s=0;s<this.tileLayers_.length;s++)u=this.tileLayers_[s],t<=u.maxZoom&&t>=u.minZoom&&(e=u.getTileUrl(n,t),e&&(r=i.createElement(document.all?"img":"div"),r.style.border="0px none",r.style.margin="0px",r.style.padding="0px",r.style.overflow="hidden",r.style.position="absolute",r.style.top="0px",r.style.left="0px",r.style.width=""+this.tileSize.width+"px",r.style.height=""+this.tileSize.height+"px",document.all?r.src=e:r.style.backgroundImage="url("+e+")",f.appendChild(r),u.tiles_[o]=r,u.opacity_!==undefined?rt(r,u.opacity_):this.opacity_!==undefined&&rt(r,this.opacity_)));return this.tiles_[o]=f,f.setAttribute("tid",o),f};l.prototype.getTile=l.prototype.getTile;l.prototype.releaseTile=function(n){var t,i,r;if(n.getAttribute("tid"))for(t=n.getAttribute("tid"),this.tiles_[t]&&delete this.tiles_[t],i=0;i<this.tileLayers_.length;i++)r=this.tileLayers_[i],r.tiles_[t]&&delete r.tiles_[t]};l.prototype.releaseTile=l.prototype.releaseTile;l.prototype.setOpacity=function(n){var t,r,u,i;this.opacity_=n;t=this.tiles_;for(r in t)if(t.hasOwnProperty(r))for(u=t[r].childNodes,i=0;i<u.length;i++)rt(u[i],n)};l.prototype.getOpacity=function(){return this.opacity_};l.prototype.getTileLayers=function(){return this.tileLayers_};e.prototype=new n.OverlayView;e.prototype.onAdd=function(){var i=this,t;this.listeners_.push(n.event.addListener(this.getMap(),"bounds_changed",bi(this.refresh,this)));this.listeners_.push(n.event.addListener(this.getMap(),"dragstart",function(){i.dragging=!0}));this.listeners_.push(n.event.addListener(this.getMap(),"dragend",function(){i.dragging=!1}));t=this.getMap();t.agsOverlays=t.agsOverlays||new n.MVCArray;t.agsOverlays.push(this);et(t);this.map_=t};e.prototype.onAdd=e.prototype.onAdd;e.prototype.onRemove=function(){for(var r,i,f,t=0,u=this.listeners_.length;t<u;t++)n.event.removeListener(this.listeners_[t]);if(this.overlay_&&this.overlay_.setMap(null),r=this.map_,i=r.agsOverlays,i)for(t=0,f=i.getLength();t<f;t++)if(i.getAt(t)==this){i.removeAt(t);break}et(r);this.map_=null};e.prototype.onRemove=e.prototype.onRemove;e.prototype.draw=function(){};e.prototype.draw=e.prototype.draw;e.prototype.getOpacity=function(){return this.opacity_};e.prototype.setOpacity=function(n){var t=Math.min(Math.max(n,0),1);this.opacity_=t;this.overlay_&&rt(this.overlay_.div_,t)};e.prototype.getMapService=function(){return this.mapService_};e.prototype.refresh=function(){var i,f,t,e,r,u,n;if(this.drawing_===!0){this.needsNewRefresh_=!0;return}(i=this.getMap(),f=i?i.getBounds():null,f)&&(t=this.exportOptions_,t.bounds=f,e=ot,r=i.getDiv(),t.width=r.offsetWidth,t.height=r.offsetHeight,r.offsetWidth!=0&&r.offsetHeight!=0)&&(u=i.getProjection(),u&&u instanceof c&&(e=u.spatialReference_),t.imageSR=e,a(this,"drawstart"),n=this,this.drawing_=!0,!this.dragging&&this.overlay_&&(this.overlay_.setMap(null),this.overlay_=null),this.mapService_.exportMap(t,function(t){if(n.drawing_=!1,n.needsNewRefresh_===!0){n.needsNewRefresh_=!1;n.refresh();return}t.href&&(n.overlay_&&(n.overlay_.setMap(null),n.overlay_=null),n.overlay_=new lt(t.bounds,t.href,n.map_,n.opacity_));a(n,"drawend")}))};e.prototype.isHidden=function(){return!(this.visible_&&this.isInZoomRange_())};e.prototype.isInZoomRange_=function(){var n=this.getMap().getZoom();return this.minZoom!==undefined&&n<this.minZoom||this.maxZoom!==undefined&&n>this.maxZoom?!1:!0};e.prototype.show=function(){this.visible_=!0;this.div_.style.visibility="visible";this.refresh()};e.prototype.hide=function(){this.visible_=!1;this.div_.style.visibility="hidden"};lt.prototype=new n.OverlayView;lt.prototype.onAdd=function(){var n=document.createElement("DIV"),t,i;n.style.border="none";n.style.borderWidth="0px";n.style.position="absolute";t=this.map_.getDiv();n.style.width=t.offsetWidth+"px";n.style.height=t.offsetHeight+"px";n.style.backgroundImage="url("+this.url_+")";this.div_=n;i=this.getPanes();rt(n,this.op_);i.overlayLayer.appendChild(n)};lt.prototype.draw=function(){var n=this.getProjection(),i=n.fromLatLngToDivPixel(this.bounds_.getSouthWest()),r=n.fromLatLngToDivPixel(this.bounds_.getNorthEast()),t=this.div_;t.style.left=i.x+"px";t.style.top=r.y+"px"};lt.prototype.onRemove=function(){this.div_!=null&&(this.div_.parentNode.removeChild(this.div_),this.div_=null)};ai.prototype.refresh=function(){et(this.map_)};yt.ags={SpatialReference:r,Geographic:vt,LambertConformalConic:y,SphereMercator:g,TransverseMercator:d,SpatialRelationship:si,GeometryType:s,SRUnit:hi,Catalog:ki,MapService:f,Layer:nt,GeocodeService:ct,GeometryService:ti,GPService:di,GPTask:ci,RouteTask:li,Util:w,Config:st,Projection:c,TileLayer:b,MapOverlay:e,MapType:l,CopyrightControl:ai};window.gmaps=yt}(),function(n){var t;(function(t){var i=function(){function t(){this.currentMapTypeId=n.Map.getInstance().GoogleMap.getMapTypeId();this.setupDiv();this.setupEvents()}return t.prototype.GetControlDiv=function(){return this.htmlDiv},t.prototype.setupDiv=function(){this.htmlDiv=$('<div class="mapStyleControl mrwaGoogleControl">\n                    <div class="mapStyleToggleBtn" title="Click to change the map style"><\/div>\n                <\/div>')[0]},t.prototype.setupEvents=function(){var t=this;$(this.htmlDiv).find(".mapStyleToggleBtn").click(function(){t.currentMapTypeId==="mrwaGreyscale"?(n.Map.getInstance().GoogleMap.setMapTypeId("mrwaRoadmap"),$(t.htmlDiv).find(".mapStyleToggleBtn").css("background-image","url('/Content/images/greyscaleMap.png')")):t.currentMapTypeId==="mrwaRoadmap"&&(n.Map.getInstance().GoogleMap.setMapTypeId("mrwaGreyscale"),$(t.htmlDiv).find(".mapStyleToggleBtn").css("background-image","url('/Content/images/roadcolourMap.png')"));t.currentMapTypeId=n.Map.getInstance().GoogleMap.getMapTypeId()})},t}();t.MapStyleControl=i})(t=n.GoogleControls||(n.GoogleControls={}))}(Mrwa||(Mrwa={})),function(n){var t;(function(t){var i=function(){function t(){this.setupDiv();this.setupEvents()}return t.prototype.GetControlDiv=function(){return this.htmlDiv},t.prototype.setupDiv=function(){this.htmlDiv=$('<div class="zoomControl mrwaGoogleControl">\n                    <div class="zoomBtn zoomIn" title="Click to zoom into the map">\n                        <i class="fa fa-plus"><\/i>\n                    <\/div>\n                    <div class="zoomBtn zoomOut" title="Click to zoom out of the map">\n                        <i class="fa fa-minus"><\/i>\n                    <\/div>\n                <\/div>')[0]},t.prototype.setupEvents=function(){$(this.htmlDiv).find(".zoomIn").click(function(){n.Map.getInstance().ZoomIn()});$(this.htmlDiv).find(".zoomOut").click(function(){n.Map.getInstance().ZoomOut()})},t}();t.ZoomControl=i})(t=n.GoogleControls||(n.GoogleControls={}))}(Mrwa||(Mrwa={})),function(n){var t;(function(t){var i=function(){function t(){this.ZoomControl=new n.GoogleControls.ZoomControl;this.MapStyleControl=new n.GoogleControls.MapStyleControl;this.setupControl()}return t.prototype.GetControlDiv=function(){return this.htmlDiv},t.prototype.setupControl=function(){this.htmlDiv=$('<div class="rightBottomParent"><\/div>')[0];this.htmlDiv.appendChild(this.MapStyleControl.GetControlDiv());this.htmlDiv.appendChild(this.ZoomControl.GetControlDiv())},t}();t.RightBottomParentControl=i})(t=n.GoogleControls||(n.GoogleControls={}))}(Mrwa||(Mrwa={})),function(n){var t=function(){function t(){this.FeaturePointGroups=ko.computed(function(){return n.ArcGisService.getInstance().GetAlertFeaturePointGroups()});this.IsAllFeatureGroupsVisible=ko.observable(!0);this.IsOpen=ko.observable(!0);this.appInsightsClassKey="Mrwa.CurrentAlertsControl"}return t.prototype.Initialise=function(){},t.prototype.Toggle=function(){this.IsOpen()?($("#currentalertscontrol > .collapse").collapse("hide"),this.IsOpen(!1)):($("#currentalertscontrol  > .collapse").collapse("show"),this.IsOpen(!0));n.AppInsightsService.TrackEvent(this.appInsightsClassKey+".Toggle",{IsOpen:this.IsOpen()})},t.prototype.ShowHideAllFeatureGroups=function(){this.IsAllFeatureGroupsVisible(!this.IsAllFeatureGroupsVisible());this.IsAllFeatureGroupsVisible()?this.turnAllAlertsOff():this.turnAllAlertsOn();n.AppInsightsService.TrackEvent(this.appInsightsClassKey+".ShowHideAllFeatureGroups",{IsAllFeatureGroupsVisible:this.IsAllFeatureGroupsVisible()})},t.prototype.Close=function(){$("#currentalertscontrol > .collapse").collapse("hide");this.IsOpen(!1)},t.prototype.turnAllAlertsOn=function(){var t=n.ArcGisService.getInstance().GetAlertFeaturePointGroupsThatCanHide();$.each(t,function(n,t){t.HideAllFeatures()})},t.prototype.turnAllAlertsOff=function(){var t=n.ArcGisService.getInstance().GetAlertFeaturePointGroupsThatCanHide();$.each(t,function(n,t){t.ShowAllFeatures()})},t}();n.CurrentAlertsControl=t}(Mrwa||(Mrwa={})),function(n){var i=function(){function n(n,t,i){this.ClusterName=ko.observable("");this.ClassName=ko.observable("");this.Feature=ko.observable(null);this.ClusterName(n);this.ClassName(t);this.Feature(i)}return n}(),t,r;n.RouteAlert=i;t=function(){function t(){var n=this;this.SearchBoxInputValue=ko.observable("");this.Id=ko.observable(0);this.ElementId=ko.computed(function(){return"searchbox"+n.Id()});this.Icon=ko.observable("");this.markers=[];this.infoWindows=[]}return t.prototype.Initialise=function(t){var i=this,u,r;this.Id(t);this.Icon(this.getIconSvg(this.numberToLetter(this.Id()+2)));this.Id.subscribe(function(n){i.Icon(i.getIconSvg(i.numberToLetter(n+2)))});this.searchBoxInput=$("#"+this.ElementId())[0];u=this.searchBoxInput.addEventListener||this.searchBoxInput.attachEvent;r=function(n,t){var r=t;n==="keyup"&&(t=function(n){n.keyCode!==13&&n.keyCode!==40&&n.keyCode!==38&&i.searchBoxInput.value.length>=3&&r.apply(i.searchBoxInput,[n])});u.apply(i.searchBoxInput,[n,t])};this.searchBoxInput.addEventListener=r;this.searchBoxInput.attachEvent=r;var f=new google.maps.LatLng(-35.803938,112.414691),e=new google.maps.LatLng(-12.880811,128.850237),o=new google.maps.LatLngBounds(f,e);this.SearchBox=new google.maps.places.SearchBox(this.searchBoxInput,{bounds:o});this.placesChangedListner=google.maps.event.addListener(this.SearchBox,"places_changed",function(){var t=i.SearchBox.getPlaces()[0];i.SearchBoxInputValue(t.formatted_address);i.ClearAllMarkers();n.LeftPanel.getInstance().PlanJourneyControl.CalculateRoute()})},t.prototype.Unload=function(){google.maps.event.removeListener(this.placesChangedListner);this.ClearAllMarkers()},t.prototype.getIconSvg=function(n){return'<svg xmlns="http://www.w3.org/2000/svg" width="23.229" height="36.226" viewBox="0 0 23.229 36.226"><defs>\n                    <style>\n                        .a{fill:%232d2f32;}\n                      .b\n                      {\n                        fill:%23fff;\n                        font-size:16px;\n                        font-family: "Heebo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;\n                      }\n                    <\/style>\n                  <\/defs>\n                  <g transform="translate(-1227 -96)">\n                    <g transform="translate(1227 96)">\n                      <g transform="translate(0)">\n                        <path class="a" d="M11.614,0c6.414,0,11.614,5.5,11.614,12.291S11.614,36.226,11.614,36.226,0,19.079,0,12.291,5.2,0,11.614,0Z"/>\n                      <\/g>\n                    <\/g>\n                  <\/g>\n                  <text class="b" transform="translate(11.999 19)">\n                    <tspan x="-5.88" y="0">'+n+"<\/tspan>\n                  <\/text>\n                <\/svg>"},t.prototype.ClearAllMarkers=function(){$.each(this.markers,function(n,t){t!=null&&(t.setMap(null),t=null)});$.each(this.infoWindows,function(n,t){t!=null&&(google.maps.event.clearInstanceListeners(t),t.close(),t=null)})},t.prototype.ClearSearchBoxInput=function(){this.SearchBoxInputValue("")},t.prototype.GetAddress=function(){var n=this.SearchBox.getPlaces()[0];return n?n.formatted_address:null},t.prototype.GetLocation=function(){var n=this.SearchBox.getPlaces()[0];return n?n.geometry.location:null},t.prototype.MakeMarker=function(t,i,r){var u=new google.maps.Marker({position:t,map:n.Map.getInstance().GoogleMap,icon:i,title:r}),f=new google.maps.InfoWindow({content:r});u.addListener("click",function(){f.open(n.Map.getInstance().GoogleMap,u)});this.markers.push(u)},t.prototype.numberToLetter=function(n){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZ",i="",r=n%t.length,u=n/t.length;if(r-1==-1&&(r=t.length,u--),i=t.charAt(r-1)+i,u>=1)this.numberToLetter(parseInt(u));else return i},t}();n.Waypoint=t;r=function(){function r(){this.fromInputValue=ko.observable("");this.currentRouteIndex=ko.observable(0);this.RouteAlerts=ko.observableArray([]);this.TravelingOnValue=ko.observable("");this.dateFilteredFeatures=ko.observableArray([]);this.Waypoints=ko.observableArray([]);this.markers=[];this.infoWindows=[];this.appInsightsClassKey="Mrwa.PlanJourneyControl"}return r.prototype.Initialise=function(){var t=this,r,i;this.htmlControlElementId="#planjourneycontrol";this.travelingOn=$(".traveldatefiltertrip").find("#travelingOn")[0];this.TravelingOnValue.subscribe(function(i){if(i===""){t.resetDateFilter();t.findRoute();return}var r=moment(i,"DDMMMYYYY");t.dateFilterFeatures(r);t.findRoute();n.AppInsightsService.TrackEvent(t.appInsightsClassKey+".TravelingOnValue",{date:i})});this.fromInput=$(this.htmlControlElementId).find("#routingFrom")[0];r=this.fromInput.addEventListener||this.fromInput.attachEvent;i=function(n,i){var u=i;n==="keyup"&&(i=function(n){n.keyCode!==13&&n.keyCode!==40&&n.keyCode!==38&&t.fromInput.value.length>=3&&u.apply(t.fromInput,[n])});r.apply(t.fromInput,[n,i])};this.fromInput.addEventListener=i;this.fromInput.attachEvent=i;var u=new google.maps.LatLng(-35.803938,112.414691),f=new google.maps.LatLng(-12.880811,128.850237),e=new google.maps.LatLngBounds(u,f);this.FromSearchBox=new google.maps.places.SearchBox(this.fromInput,{bounds:e});google.maps.event.addListener(this.FromSearchBox,"places_changed",function(){var i=t.FromSearchBox.getPlaces()[0];t.fromInputValue(i.formatted_address);i&&(t.setMarker('<div class="place-adress">'+i.formatted_address+"<\/div>",i.geometry.location,i.name,"/Content/images/Point.svg"),i.geometry.viewport?n.Map.getInstance().GoogleMap.fitBounds(i.geometry.viewport):(n.Map.getInstance().GoogleMap.setCenter(i.geometry.location),n.Map.getInstance().GoogleMap.setZoom(16)));t.Waypoints().length>0&&t.CalculateRoute();n.Settings.IsMobile&&n.LeftPanel.getInstance().Toggle()});this.routePanel=$(this.htmlControlElementId).find("#route-panel")[0];this.directionRenderer=new google.maps.DirectionsRenderer({map:n.Map.getInstance().GoogleMap,draggable:!1,polylineOptions:{strokeWeight:10,strokeColor:"#707070"},suppressMarkers:!0});this.directionRenderer.setPanel(this.routePanel);google.maps.event.addListener(this.directionRenderer,"routeindex_changed",function(){t.currentRouteIndex()!==t.directionRenderer.getRouteIndex()&&(t.currentRouteIndex(t.directionRenderer.getRouteIndex()),t.calculateWarnings())});google.maps.event.addListener(this.directionRenderer,"directions_changed",function(){t.findRoute()});this.directionService=new google.maps.DirectionsService;this.participatingFeatureClusters=$.grep(n.ArcGisService.getInstance().GetAllFeaturePointGroups(),function(n){return n.ShowOnRoute()})},r.prototype.AddWaypoint=function(){var i=this.Waypoints().length,n;i>=10||(n=new t,this.Waypoints.push(n),n.Initialise(i))},r.prototype.RemoveWaypoint=function(n){var t=$.grep(this.Waypoints(),function(t){return t.Id()===n})[0];t&&(t.Unload(),this.Waypoints.remove(t),this.resetWaypointSequence(),this.CalculateRoute())},r.prototype.ReorderWaypoint=function(n){var t=$.grep(this.Waypoints(),function(t){return t.Id()===n})[0],i,r;if(t&&n!=null)if(n===0)i=this.fromInputValue(),r=t.SearchBoxInputValue(),this.fromInputValue(r),t.SearchBoxInputValue(i),this.CalculateRoute();else if(n>=1){var u=this.Waypoints()[n-1],f=u.SearchBoxInputValue(),e=t.SearchBoxInputValue();u.SearchBoxInputValue(e);t.SearchBoxInputValue(f);this.CalculateRoute()}},r.prototype.resetWaypointSequence=function(){$.each(this.Waypoints(),function(n,t){t.Id(n)})},r.prototype.setMarker=function(t,i,r,u,f){u===void 0&&(u=null);f===void 0&&(f=!0);this.ClearAllMarkers();var o=new google.maps.InfoWindow({content:t}),e=new google.maps.Marker({position:i,map:n.Map.getInstance().GoogleMap,title:r,clickable:!0});u&&e.setIcon(u);e.addListener("click",function(){o.open(n.Map.getInstance().GoogleMap,e)});f&&o.open(n.Map.getInstance().GoogleMap,e);this.markers.push(e);this.infoWindows.push(o)},r.prototype.ClearAllMarkers=function(){$.each(this.markers,function(n,t){t!=null&&(t.setMap(null),t=null)});$.each(this.infoWindows,function(n,t){t!=null&&(google.maps.event.clearInstanceListeners(t),t.close(),t=null)})},r.prototype.findRoute=function(){$(this.htmlControlElementId).LoadingOverlay("show",{});var t=this.directionRenderer.getDirections();if(t==null){$(this.htmlControlElementId).LoadingOverlay("hide",{});return}this.calculateWarnings();$(this.htmlControlElementId).LoadingOverlay("hide",{});n.Settings.IsMobile&&n.LeftPanel.getInstance().Toggle()},r.prototype.dateFilterFeatures=function(t){var i=this;$.each(n.ArcGisService.getInstance().GetAlertFeaturePointGroups(),function(r,u){u.IsDateFilterable()&&$.each(u.Features(),function(r,u){t.isBetween(u.StartDate(),u.EndDate())?(u.RemoveFilter(n.Enums.FilteredBy.TripTravelDateFilterControl),i.dateFilteredFeatures.remove(u)):(u.AddFilter(n.Enums.FilteredBy.TripTravelDateFilterControl),i.dateFilteredFeatures().indexOf(u)<0&&i.dateFilteredFeatures.push(u))})});n.ArcGisService.getInstance().DataLayerCluster().redraw()},r.prototype.resetDateFilter=function(){$.each(this.dateFilteredFeatures(),function(t,i){i.RemoveFilter(n.Enums.FilteredBy.TripTravelDateFilterControl)});this.dateFilteredFeatures([]);n.ArcGisService.getInstance().DataLayerCluster().redraw()},r.prototype.ClearDateFilterVal=function(){this.TravelingOnValue("");n.AppInsightsService.TrackEvent(this.appInsightsClassKey+".ClearDateFilterVal")},r.prototype.CalculateRoute=function(){var n=this,i=this.Waypoints().length,t,r;(this.Reset(),$(this.fromInput).val()===""||i<=0)||($(this.htmlControlElementId).LoadingOverlay("show",{}),t=[],i>1&&(t=$.map(this.Waypoints(),function(n){return{location:n.SearchBoxInputValue(),stopover:!0}}),t.pop()),r={origin:$(this.fromInput).val(),waypoints:t,destination:this.Waypoints()[i-1].SearchBoxInputValue(),travelMode:google.maps.TravelMode.DRIVING,provideRouteAlternatives:!0},this.directionService.route(r,function(t,i){if(i===google.maps.DirectionsStatus.OK){n.directionRenderer.setDirections(t);var r=n.Waypoints().length;$.each(t.routes,function(t,i){if($.each(i.legs,function(t,i){var r="/Content/images/Point.svg",u,f;t>0?(u=n.Waypoints()[t-1],f=u.Icon(),r={url:"data:image/svg+xml;utf-8, "+f},u.MakeMarker(i.start_location,r,i.start_address)):n.setMarker(i.start_address,i.start_location,i.start_address,r,!1)}),r>0){var u=n.Waypoints()[r-1],e={url:"data:image/svg+xml;utf-8, "+u.Icon()},f=i.legs[i.legs.length-1];u.MakeMarker(f.end_location,e,f.end_address)}})}}))},r.prototype.calculateWarnings=function(){var n=this,t;(this.RouteAlerts.removeAll(),t=this.directionRenderer.getDirections(),t)&&(t.routes.length<=0||$.each(this.participatingFeatureClusters,function(t,i){n.getWarningsOnRoute(i,n.directionRenderer.getDirections().routes[n.currentRouteIndex()])}))},r.prototype.getWarningsOnRoute=function(t,r){var u=this;$.each(t.Features(),function(f,e){var o;if(e.IsVisible()){var s=new google.maps.Polyline({path:r.overview_path}),h=e.GoogleFeature().getGeometry().get(),c=google.maps.geometry.poly.isLocationOnEdge(h,s,.001);c&&(o=t.Type()===n.Enums.FeaturePointGroupTypes.Alerts?"route-danger":"route-warning",u.RouteAlerts.push(new i(t.DisplayName(),o,e)))}})},r.prototype.ClearFromInput=function(){this.fromInputValue("");this.Reset();n.AppInsightsService.TrackEvent(this.appInsightsClassKey+".ClearFromInput")},r.prototype.Reset=function(){$(this.routePanel).html("");this.directionRenderer.set("directions",null);this.RouteAlerts.removeAll();this.ClearAllMarkers();$.each(this.Waypoints(),function(n,t){t.ClearAllMarkers()})},r}();n.PlanJourneyControl=r}(Mrwa||(Mrwa={})),function(n){var t=function(){function t(){this.isAllLinesOn=ko.observable(!0);this.FeatureLineGroups=ko.computed(function(){return n.ArcGisService.getInstance().GetAllFeatureLineGroups()})}return t.prototype.Initialise=function(){},t.prototype.Toggle=function(){var t=this;this.isAllLinesOn(!this.isAllLinesOn());this.FeatureLineGroups().forEach(function(i){t.isAllLinesOn()?i.DataLayer.setMap(n.Map.getInstance().GoogleMap):i.DataLayer.setMap(null)})},t.prototype.ToggleOn=function(){this.FeatureLineGroups().forEach(function(t){t.DataLayer.setMap(n.Map.getInstance().GoogleMap)})},t.prototype.ToggleOff=function(){this.FeatureLineGroups().forEach(function(n){n.DataLayer.setMap(null)})},t}();n.RoadClosureLinesControl=t}(Mrwa||(Mrwa={})),function(n){var t=function(){function t(){this.TrafficLayerActive=ko.observable(!1);this.FeaturePoiGroups=ko.computed(function(){return n.ArcGisService.getInstance().GetPoiFeaturePointGroups()});this.appInsightsClassKey="Mrwa.PoiControl"}return t.prototype.Initialise=function(){var t=this;this.trafficLayer=new google.maps.TrafficLayer;this.TrafficLayerActive.subscribe(function(i){i?t.trafficLayer.setMap(n.Map.getInstance().GoogleMap):t.trafficLayer.setMap(null)})},t.prototype.ToggleGoogleTraffic=function(){this.TrafficLayerActive(!this.TrafficLayerActive());n.AppInsightsService.TrackEvent(this.appInsightsClassKey+".ToggleGoogleTraffic",{isactive:this.TrafficLayerActive()})},t}();n.PoiControl=t}(Mrwa||(Mrwa={})),function(n){var t=function(){function n(){this.LastUpdated=ko.observable("");this.appInsightsClassKey="Mrwa.GlobalControls"}return n.prototype.Initialise=function(){},n}();n.GlobalControls=t}(Mrwa||(Mrwa={})),function(n){var t=function(){function t(n,t,i,r){this.Id=ko.observable();this.Name=ko.observable();this.Icon=ko.observable();this.FilterType=ko.observable(null);this.FilterActive=ko.observable(!1);this.appInsightsClassKey="Mrwa.RestAreaFilter";this.Id(n);this.Name(t);this.FilterType(i);this.Icon(r)}return t.prototype.ToggleRestAreas=function(t){var i=this,r,u;this.FilterActive(t);r=n.ArcGisService.getInstance().GetRestAreaFeaturePointGroups()[0];r&&(u=$.grep(r.Features(),function(n){return $.inArray(i.FilterType(),n.RestAreaType())>=0}),u.forEach(function(n){t?n.AddViewable(i.FilterType()):n.RemoveViewable(i.FilterType())}),n.ArcGisService.getInstance().DataLayerCluster().redraw())},t.prototype.ToggleFilter=function(t,i){var r=this,u,f;this.FilterActive(!this.FilterActive());u=n.ArcGisService.getInstance().GetRestAreaFeaturePointGroups()[0];u&&(f=$.grep(u.Features(),function(n){return $.inArray(r.FilterType(),n.RestAreaType())>=0}),f.forEach(function(n){r.FilterActive()?n.AddViewable(r.FilterType()):n.RemoveViewable(r.FilterType())}),n.ArcGisService.getInstance().DataLayerCluster().redraw());n.AppInsightsService.TrackEvent(this.appInsightsClassKey+".ToggleFilter",{name:this.Name(),active:this.FilterActive()});i&&i.stopPropagation()},t}();n.RestAreaFilter=t}(Mrwa||(Mrwa={})),function(n){var t=function(){function t(){this.RestAreaFilters=ko.observableArray([]);this.IsOpen=ko.observable(!0);this.AllFilterActive=ko.observable(!1);this.appInsightsClassKey="Mrwa.RestAreasControl"}return t.prototype.Initialise=function(){var t=n.Settings.SiteRelativePath+"Content/images/RestAreaIcons/",i=n.ArcGisService.getInstance().GetRestAreaFeaturePointGroups()[0];i&&(this.RestAreaFilters.push(new n.RestAreaFilter("os","Overnight Stopping",n.Enums.RestAreaTypes.OvernightStopping,t+"24HourRestArea-Circle.svg")),this.RestAreaFilters.push(new n.RestAreaFilter("lvp","Light Vehicle Parking",n.Enums.RestAreaTypes.LightVehicleParking,t+"LightVehicle-Circle.svg")),this.RestAreaFilters.push(new n.RestAreaFilter("hvp","Heavy Vehicle Parking",n.Enums.RestAreaTypes.HeavyVehicleParking,t+"HeavyVehicle-Circle.svg")),this.RestAreaFilters.push(new n.RestAreaFilter("t","Toilets",n.Enums.RestAreaTypes.Toilets,t+"Toilets-Circle.svg")),this.RestAreaFilters.push(new n.RestAreaFilter("at","Accessible Toilets",n.Enums.RestAreaTypes.AccessibleToilets,t+"AccessibleToilets-Circle.svg")),this.RestAreaFilters.push(new n.RestAreaFilter("ib","Information Bay",n.Enums.RestAreaTypes.InformationBay,t+"Information-Circle.svg")),this.RestAreaFilters.push(new n.RestAreaFilter("pf","Picnic Facilities",n.Enums.RestAreaTypes.PicnicFacilities,t+"PicnicArea-Circle.svg")),this.RestAreaFilters.push(new n.RestAreaFilter("r","Roadhouse",n.Enums.RestAreaTypes.Roadhouse,t+"Roadhouse-Circle.svg")),this.RestAreaFilters.push(new n.RestAreaFilter("b","Bin",n.Enums.RestAreaTypes.Bin,t+"Bins-Circle.svg")),this.RestAreaFilters.push(new n.RestAreaFilter("eds","Effluent Dump Site",n.Enums.RestAreaTypes.EffluentDumpSite,t+"EffluentDumpSite-Circle.svg")))},t.prototype.Toggle=function(){this.IsOpen()?($("#restareascontrol > .collapse").collapse("hide"),this.IsOpen(!1)):($("#restareascontrol  > .collapse").collapse("show"),this.IsOpen(!0));n.AppInsightsService.TrackEvent(this.appInsightsClassKey+".Toggle",{IsOpen:this.IsOpen()})},t.prototype.GetRestAreaFilterById=function(n){return $.grep(this.RestAreaFilters(),function(t){return t.Id()===n})[0]},t.prototype.GetActiveRestAreaFilters=function(){return $.grep(this.RestAreaFilters(),function(n){return n.FilterActive()===!0})},t.prototype.ToggleAllFilters=function(){this.AllFilterActive(!this.AllFilterActive());this.AllFilterActive()?this.toggleAllFiltersOff():this.toggleAllFiltersOn();n.AppInsightsService.TrackEvent(this.appInsightsClassKey+".ToggleAllFilters",{AllFilterActive:this.AllFilterActive()})},t.prototype.toggleAllFiltersOff=function(){this.RestAreaFilters().forEach(function(n){n.ToggleRestAreas(!0)})},t.prototype.toggleAllFiltersOn=function(){this.RestAreaFilters().forEach(function(n){n.ToggleRestAreas(!1)})},t.prototype.Close=function(){$("#restareascontrol > .collapse").collapse("hide");this.IsOpen(!1)},t}();n.RestAreasControl=t}(Mrwa||(Mrwa={})),function(n){var t=function(){function t(){this.IsOpen=ko.observable(!0);this.leftPanelHtmlElementId="#leftpanel";this.menuClosedCssClass="menu-closed";this.menuOpenCssClass="leftpanel-open";this.appInsightsClassKey="Mrwa.LeftPanel";this.PlanJourneyControl=new n.PlanJourneyControl;this.CurrentAlertsControl=new n.CurrentAlertsControl;this.RoadClosureLinesControl=new n.RoadClosureLinesControl;this.PoiControl=new n.PoiControl;this.GlobalControls=new n.GlobalControls;this.RestAreasControl=new n.RestAreasControl}return t.prototype.Initialise=function(t){var i=this;this.CurrentAlertsControl.Initialise();this.PlanJourneyControl.Initialise();this.RoadClosureLinesControl.Initialise();this.PoiControl.Initialise();this.GlobalControls.Initialise();this.RestAreasControl.Initialise();this.IsOpen.subscribe(function(n){n?i.openLeftPanel():i.closeLeftPanel()});n.Settings.IsMobile&&this.IsOpen(!1);this.resize();$(this.leftPanelHtmlElementId).show();$(window).resize(function(){i.resize()});t()},t.prototype.Toggle=function(){this.IsOpen(!this.IsOpen());n.AppInsightsService.TrackEvent(this.appInsightsClassKey+".Toggle",{isopen:this.IsOpen()})},t.prototype.resize=function(){var n=$("#map").height();$(this.leftPanelHtmlElementId).css("max-height",n)},t.prototype.openLeftPanel=function(){var n=$(this.leftPanelHtmlElementId);n.removeClass(this.menuClosedCssClass);n.addClass(this.menuOpenCssClass)},t.prototype.closeLeftPanel=function(){var n=$(this.leftPanelHtmlElementId);n.addClass(this.menuClosedCssClass);n.removeClass(this.menuOpenCssClass)},t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t}();n.LeftPanel=t}(Mrwa||(Mrwa={})),function(n){var t=function(){function n(){this.GreyScale=new google.maps.StyledMapType([{elementType:"geometry",stylers:[{color:"#f5f5f5"}]},{elementType:"labels.icon",stylers:[{visibility:"off"}]},{elementType:"labels.text.fill",stylers:[{color:"#616161"}]},{elementType:"labels.text.stroke",stylers:[{color:"#f5f5f5"}]},{featureType:"administrative.land_parcel",elementType:"labels.text.fill",stylers:[{color:"#bdbdbd"}]},{featureType:"administrative.province",elementType:"geometry.stroke",stylers:[{color:"#000000"}]},{featureType:"poi",stylers:[{visibility:"off"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#eeeeee"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#757575"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#e5e5e5"}]},{featureType:"poi.park",elementType:"labels.text.fill",stylers:[{color:"#9e9e9e"}]},{featureType:"road",elementType:"geometry",stylers:[{color:"#ffffff"}]},{featureType:"road.arterial",elementType:"labels.text.fill",stylers:[{color:"#757575"}]},{featureType:"road.highway",elementType:"geometry",stylers:[{color:"#dadada"}]},{featureType:"road.highway",elementType:"labels.text.fill",stylers:[{color:"#616161"}]},{featureType:"road.local",elementType:"labels.text.fill",stylers:[{color:"#9e9e9e"}]},{featureType:"transit",stylers:[{visibility:"off"}]},{featureType:"transit.line",elementType:"geometry",stylers:[{color:"#e5e5e5"}]},{featureType:"transit.station",elementType:"geometry",stylers:[{color:"#eeeeee"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#c9c9c9"}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{color:"#9e9e9e"}]}],{name:"Greyscale"});this.Roadmap=new google.maps.StyledMapType([{featureType:"poi",stylers:[{visibility:"off"}]},{featureType:"administrative",stylers:[{visibility:"on"}]},{featureType:"transit",stylers:[{visibility:"off"}]},{featureType:"road",stylers:[{visibility:"on"},{saturation:-100}]}],{name:"Roadmap"})}return n}();n.MapStyles=t}(Mrwa||(Mrwa={})),function(n){var t=function(){function t(){this.ViewPortFilteringActive=ko.observable(!1);this.filteredFeatures=ko.observableArray([]);this.appInsightsClassKey="Mrwa.Map";this.mapMaxZoom=20;this.mapMinZoom=5}return t.prototype.Initialise=function(t,i){var r=this,u,f;this.GoogleMap=new google.maps.Map(t.mapDiv,{center:t.center,zoom:t.zoom,minZoom:this.mapMinZoom,maxZoom:this.mapMaxZoom,zoomControl:!1,mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!1,gestureHandling:"greedy"});u=new n.MapStyles;this.GoogleMap.mapTypes.set("mrwaRoadmap",u.Roadmap);this.GoogleMap.mapTypes.set("mrwaGreyscale",u.GreyScale);this.GoogleMap.setMapTypeId("mrwaGreyscale");this.GoogleMap.setTilt(0);f=new n.GoogleControls.RightBottomParentControl;this.GoogleMap.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(f.GetControlDiv());this.ViewPortFilteringActive.subscribe(function(n){n?r.filterFeaturesByMapBounds():r.resetFilterByMapBounds()});google.maps.event.addListenerOnce(this.GoogleMap,"idle",function(){r.setupInfoWindow();r.AddPointGroupClusterToMap();n.ArcGisService.getInstance().GetAllFeatureLineGroups().forEach(function(n){n.SetupFeatureLineGroupDataLayer()});i()});google.maps.event.addListener(this.GoogleMap,"idle",function(){r.ViewPortFilteringActive()&&r.filterFeaturesByMapBounds();n.ArcGisService.getInstance().DataLayerCluster().redraw()})},t.prototype.AddPointGroupClusterToMap=function(){var t=this;n.ArcGisService.getInstance().DataLayerCluster().SetMap(this.GoogleMap);google.maps.event.clearListeners(n.ArcGisService.getInstance().DataLayerCluster()._dataLayer,"click");n.ArcGisService.getInstance().DataLayerCluster().addListener("click",function(i){n.Settings.IsMobile&&n.LeftPanel.getInstance().IsOpen()&&n.LeftPanel.getInstance().Toggle();var r=n.ArcGisService.getInstance().GetFeaturePointGroupByType(i.feature.getProperty("FeaturePointGroupType"));t.ToggleInfoWindow(i,r);i.zoomIn&&t.GoToFeatureZoom(i.latLng,i.zoomIn)});n.ArcGisService.getInstance().DataLayerCluster().redraw()},t.prototype.GoToPlaceWithZoom=function(n,t,i){this.GoogleMap.panTo(n);this.GoogleMap.setZoom(t);this.marker!=null&&(this.marker.setMap(null),this.marker=null);this.marker=new google.maps.Marker({position:n,map:this.GoogleMap,title:i.name});this.infoWindow.isOpen()&&this.infoWindow.close();this.infoWindow.setContent('<div class="place-adress">'+i.formatted_address+"<\/div>");this.infoWindow.setPosition(n);this.infoWindow.open()},t.prototype.ClearPlacesMarker=function(){this.marker!=null&&(this.marker.setMap(null),this.marker=null);this.infoWindow.isOpen()&&this.infoWindow.close()},t.prototype.GoToPointNoZoom=function(t){this.GoogleMap.panTo(t);var i=$("#map").height();n.Settings.IsMobile?this.GoogleMap.panBy(0,-(i/16*6)):this.GoogleMap.panBy(0,-(i/4))},t.prototype.ToggleInfoWindow=function(t,i){var r,u,f,e;this.infoWindow.isOpen()&&this.infoWindow.destroy();this.infoWindow.setContent(i.GetInfoWindowFor(t.feature));r=n.ArcGisService.GetFeatureMarkerUrl(t.feature);t.feature.getProperty("FeaturePointGroupType")==n.Enums.FeaturePointGroupTypes.RestArea&&(u=n.LeftPanel.getInstance().RestAreasControl.GetActiveRestAreaFilters(),f=$.map(u,function(n){return n.Id()}).join("|"),r+="&fn="+f);this.infoWindow.set("featureUrl",r);this.infoWindow.setPosition(t.latLng);this.infoWindow.open();e=t.feature.getProperty("in_cluster");e?this.GoToFeatureZoom(t.latLng,16):this.GoToPointNoZoom(t.latLng)},t.prototype.ToggleInfoWindowForLineFeature=function(n,t){this.infoWindow.isOpen()&&this.infoWindow.destroy();this.infoWindow.setContent(t.GetInfoWindowFor(n.feature));this.infoWindow.setPosition(n.latLng);this.infoWindow.open();this.GoToPointNoZoom(n.latLng)},t.prototype.GetInfoWindow=function(){return this.infoWindow},t.prototype.GoToFeatureZoom=function(n,t){this.GoogleMap.setZoom(t);this.GoToPointNoZoom(n)},t.prototype.ZoomIn=function(){var n=this.GoogleMap.getZoom();n!==this.mapMaxZoom&&this.GoogleMap.setZoom(n+1)},t.prototype.ZoomOut=function(){var n=this.GoogleMap.getZoom();n!==this.mapMinZoom&&this.GoogleMap.setZoom(n-1)},t.prototype.setupInfoWindow=function(){var i=this;this.infoWindow&&(this.infoWindow.close(),this.infoWindow=null);var r=!1,u=function(){$(i.infoWindow.getWrapper()).removeClass("active");setTimeout(function(){r=!0;i.infoWindow.close()},300)},f=function(n){var r=$(i.infoWindow.getWrapper()),t=parseFloat(r.css("zoom"));n==="down"&&t<=1||n==="up"&&t>=1.5||r.css("zoom",n==="up"?t+=.1:t-=.1)};this.infoWindow=new SnazzyInfoWindow({wrapperClass:"custom-window",map:this.GoogleMap,offset:{top:"-50px"},border:!1,panOnOpen:!1,closeOnMapClick:!1,closeWhenOthersOpen:!0,closeButtonMarkup:'<button type="button" class="custom-close">&#215;<\/button>',callbacks:{open:function(){$(this.getWrapper()).addClass("open")},afterOpen:function(){var r=this,i=$(this.getWrapper());i.addClass("active");i.find(".custom-close").on("click",u);i.find(".font-dec").on("click",function(){f("down")});i.find(".font-inc").on("click",function(){f("up")});i.find(".zoom").on("click",function(){var n=t.getInstance().GoogleMap.getZoom();t.getInstance().GoToFeatureZoom(r._position,n<16?16:n+1)});i.find(".share").on("click",function(){var u=r.get("featureUrl")+"&z="+t.getInstance().GoogleMap.getZoom(),n=i.find(".copyLinkWrapper");n.find(".copyLinkText").text(u);n.show()});i.find(".copyBtn").on("click",function(){var u=r.get("featureUrl")+"&z="+t.getInstance().GoogleMap.getZoom(),f=$("<div/>").html(u).text(),n=$("<input>");$("body").append(n);n.val(f).select();document.execCommand("copy");n.remove();i.find(".copiedText").show()});n.Settings.IsMobile||$('.custom-body img[data-toggle="tooltip"]').tooltip()},beforeClose:function(){return r?!0:(u(),!1)},afterClose:function(){var n=$(this.getWrapper());n.find(".custom-close").off();n.removeClass("open");r=!1}}})},t.prototype.filterFeaturesByMapBounds=function(){var t=this,i=this.GoogleMap.getBounds();$.each(n.ArcGisService.getInstance().GetPoiFeaturePointGroups(),function(r,u){$.each(u.Features(),function(r,u){var f=null,e=!1;f=u.GoogleFeature().getGeometry().get();e=i.contains(f);e?(u.RemoveFilter(n.Enums.FilteredBy.MapBounds),t.filteredFeatures.remove(u)):(u.AddFilter(n.Enums.FilteredBy.MapBounds),t.filteredFeatures().indexOf(u)<0&&t.filteredFeatures.push(u))})});n.ArcGisService.getInstance().DataLayerCluster().redraw()},t.prototype.resetFilterByMapBounds=function(){$.each(this.filteredFeatures(),function(t,i){i.RemoveFilter(n.Enums.FilteredBy.MapBounds)});this.filteredFeatures([]);n.ArcGisService.getInstance().DataLayerCluster().redraw()},t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t}();n.Map=t}(Mrwa||(Mrwa={})),function(n){var t=function(){function t(){this.LastUpdatedDateTime=ko.observable(moment());this.featureServers=[];this.hiddenClusters=ko.observableArray([]);this.visibleRestAreas=ko.observableArray([]);this.isAllFeatureLinesActive=!0}return t.prototype.Initialise=function(){var t=this;n.ArcGisService.getInstance().IsInitialising.subscribe(function(i){if(!i){var r=n.Settings.IsMobile?new google.maps.LatLng(-29.434752,118.204406):new google.maps.LatLng(-27.333108,119.47614);n.Map.getInstance().Initialise({mapDiv:$("#map")[0],center:r,zoom:n.Settings.IsMobile?4:6,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.DROPDOWN_MENU,position:google.maps.ControlPosition.RIGHT_BOTTOM,mapTypeIds:["mrwaRoadmap","mrwaGreyscale"]}},function(){var u,f,i,s;if(n.LeftPanel.getInstance().Initialise(function(){t.updateLastUpdatedTime(!0);setInterval(function(){t.updateLastUpdatedTime(!1)},6e4);setInterval(function(){t.RefreshDataForMap()},3e5)}),u=new n.FeatureServer(n.Settings.BiosecurityAreasFeatureServerUrl),u.Load(n.Settings.BiosecurityAreaFeatureLayers),t.featureServers.push(u),f=new n.FeatureServer(n.Settings.RegionalBoundariesFeatureServerUrl),f.Load(n.Settings.RegionalBoundaryFeatureLayers),t.featureServers.push(f),ko.applyBindings({Map:n.Map.getInstance(),LeftPanel:n.LeftPanel.getInstance()}),n.Settings.IsMobile||$('[data-toggle="tooltip"]').tooltip(),i=t.getUrlVars(),i){var r=parseInt(i.t),h=i.id,c=parseInt(i.z),e=i.fn,o=n.ArcGisService.getInstance().GetFeaturePointByTypeAndId(r,h);o&&(r===n.Enums.FeaturePointGroupTypes.Cameras?(s=n.ArcGisService.getInstance().GetFeaturePointGroupByType(r),s.ShowAllFeatures()):r===n.Enums.FeaturePointGroupTypes.RestArea&&e&&$.each(e.split("|"),function(t,i){var r=n.LeftPanel.getInstance().RestAreasControl.GetRestAreaFilterById(i);r.ToggleRestAreas(!0)}),o.ClickWithZoom(c))}$(".mainsection").LoadingOverlay("hide",{})})}})},t.prototype.RefreshDataForMap=function(){var t=this;this.hiddenClusters.removeAll();this.visibleRestAreas.removeAll();$.each(n.ArcGisService.getInstance().GetAllFeaturePointGroups(),function(i,r){r.Type()!==n.Enums.FeaturePointGroupTypes.RestArea&&(r.IsAllFeaturesVisible()||t.hiddenClusters.push(r.LayerId()))});$.each(n.LeftPanel.getInstance().RestAreasControl.RestAreaFilters(),function(n,i){i.FilterActive()&&t.visibleRestAreas.push(i.FilterType())});n.ArcGisService.getInstance().RemoveAllFeaturePointGroups();n.ArcGisService.getInstance().SetupDataClusterLayer();n.ArcGisService.getInstance().LoadAgolFeaturePointGroups(function(){var i,r;n.ArcGisService.getInstance().SortAgolFeaturePointGroupsByDisplayOrder();t.updateLastUpdatedTime(!0);$.each(n.ArcGisService.getInstance().GetAgolFeaturePointGroups(),function(i,r){r.Type()!==n.Enums.FeaturePointGroupTypes.RestArea&&(t.hiddenClusters().indexOf(r.LayerId())>=0?r.HideAllFeatures():r.ShowAllFeatures())});i=n.LeftPanel.getInstance().PlanJourneyControl.TravelingOnValue();i&&(r=moment(i,"DDMMMYYYY"),n.LeftPanel.getInstance().PlanJourneyControl.dateFilterFeatures(r));n.ArcGisService.getInstance().DataLayerCluster().redraw()});n.ArcGisService.getInstance().LoadMrwaFeaturePointGroups(function(){$.each(n.ArcGisService.getInstance().GetMrwaFeaturePointGroups(),function(i,r){r.Type()!==n.Enums.FeaturePointGroupTypes.RestArea&&(t.hiddenClusters().indexOf(r.LayerId())>=0?r.HideAllFeatures():r.ShowAllFeatures())});$.each(n.LeftPanel.getInstance().RestAreasControl.RestAreaFilters(),function(n,i){t.visibleRestAreas().indexOf(i.FilterType())>=0?i.ToggleRestAreas(!0):i.ToggleRestAreas(!1)});n.ArcGisService.getInstance().DataLayerCluster().redraw()});n.Map.getInstance().AddPointGroupClusterToMap();this.isAllFeatureLinesActive=n.LeftPanel.getInstance().RoadClosureLinesControl.isAllLinesOn();n.ArcGisService.getInstance().RemoveAllFeatureLineGroups();n.ArcGisService.getInstance().LoadFeatureLineGroups(function(){n.ArcGisService.getInstance().SortFeatureLineGroupsByDisplayOrder();n.ArcGisService.getInstance().GetAllFeatureLineGroups().forEach(function(n){n.SetupFeatureLineGroupDataLayer()});t.isAllFeatureLinesActive?n.LeftPanel.getInstance().RoadClosureLinesControl.isAllLinesOn||n.LeftPanel.getInstance().RoadClosureLinesControl.ToggleOn():n.LeftPanel.getInstance().RoadClosureLinesControl.isAllLinesOn&&n.LeftPanel.getInstance().RoadClosureLinesControl.ToggleOff();n.ArcGisService.getInstance().DataLayerCluster().redraw()})},t.prototype.updateLastUpdatedTime=function(t){t&&this.LastUpdatedDateTime(moment());n.LeftPanel.getInstance().GlobalControls.LastUpdated("Updated "+this.LastUpdatedDateTime().fromNow())},t.prototype.getUrlVars=function(){for(var n=[],t,r=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),i=0;i<r.length;i++)t=r[i].split("="),n.push(t[0]),n[t[0]]=t[1];return n.id?n:null},t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t}();n.MapView=t}(Mrwa||(Mrwa={}))