!function(e){var t={};function r(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(a,i,function(t){return e[t]}.bind(null,i));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/static/js/react/",r(r.s=1041)}({1041:function(e,t,r){"use strict";r.r(t);var a=r(858);r(1042),Object(a.a)(),function(e,t,r,a,i){var o=e(".g-coverage-map");t.ags.Config.proxyUrl=o.attr("data-map-proxy-url")||"https://map.one.nz/proxy/proxy.ashx",t.ags.Config.alwaysUseProxy=!0;var n={coverageTypes:[]},s="https://map.one.nz/server/rest/services/"+o.attr("data-map-identifier")+"/";e.ajax({url:t.ags.Config.proxyUrl+"?"+s+encodeURI("?f=json&_ts=")+Date.now(),dataType:"json",method:"GET"}).done(function(r){if(r.error)console.error("Response error accessing ArcGIS services.",r.error.message+". Code: "+r.error.code);else{r.services.forEach(function(e){if("MapServer"===e.type){var t=e.name.split("/"),r=t[t.length-1],a=r.split("_");if(a&&5===a.length){for(var i=a[0],o=a[1],l=parseInt(a[2]),p=a[3].toLowerCase(),c=a[4],h=null,_=0;_<n.coverageTypes.length;_++)if(i===n.coverageTypes[_].name){h=n.coverageTypes[_];break}h||(h={name:i,speeds:[]},n.coverageTypes.push(h));var f=null;for(_=0;_<h.speeds.length;_++)if(o===h.speeds[_].name){f=h.speeds[_];break}f||(f={name:o,colour:"#"+c,layers:[]},h.speeds.push(f)),f.layers[l]={url:s+r+"/MapServer",type:p}}}});for(var a=function(e){for(var t=0;t<n.coverageTypes.length;t++)for(var r=n.coverageTypes[t],a=0;a<r.speeds.length;a++){var i=r.speeds[a];if(i.name===e)return i}return console.log("No matching speed found for "+e),null},i=function(t){var r=a(t);if(r){for(var i=0;i<r.layers.length;i++){var o=r.layers[i];if(o)if("t"===o.type){for(var n=p.overlayMapTypes.getLength();n>0;n--)if(p.overlayMapTypes.getAt(n-1).name===o.url){p.overlayMapTypes.removeAt(n-1);break}}else for(n=p.agsOverlays.getLength();n>0;n--){var s=p.agsOverlays.getAt(n-1);if(s.mapService_.url===o.url){s.setMap(null);break}}}var l=e("#"+r.name).next();l.removeClass("g-coverage-map__nav-label--active"),l.css("backgroundColor",""),l.css("borderColor","inherit")}},o=function(r){var i=a(r);if(i){for(var o=0;o<i.layers.length;o++){var n=i.layers[o];if(n)if("t"===n.type){var s=new t.ags.TileLayer(n.url),l=new t.ags.MapType([s],{name:n.url});p.overlayMapTypes.insertAt(p.overlayMapTypes.getLength(),l)}else(l=new t.ags.MapOverlay(n.url,{name:n.url,opacity:1,needsNewRefresh_:!0})).setMap(p)}var c=e("#"+i.name).next();c.addClass("g-coverage-map__nav-label--active"),c.css("backgroundColor",i.colour),c.css("borderColor",i.colour)}},l=0;l<n.coverageTypes.length;l++){var c=n.coverageTypes[l],h=c.name,_=h.replace(/qq/g," "),f=h.toLowerCase();e(".g-coverage-map__nav-tabs-spacer").append('<button class="g-coverage-map__nav-tab g-coverage-map__nav-tab--'+f+'">'+_+"</button>"),e(".g-coverage-map__nav").append('<div class="g-coverage-map__nav-section g-coverage-map__nav-section--'+f+'"><div id="'+f+'" class="g-coverage-map__nav-section-spacer"></div></div>');for(var u=0;u<c.speeds.length;u++){var y=c.speeds[u],g=y.name,m=y.name.replace(/qq/g," "),d=e('<div class="g-coverage-map__nav-button"><div class="g-coverage-map__nav-border"><input type="checkbox" class="g-coverage-map__nav-checkbox" name="layer" id = "'+g+'" value="'+g+'" /><label for="'+g+'" class="g-coverage-map__nav-label"><span style="word-spacing: normal">'+m+"</span></label></div></div>");if(d.on("change",function(t){var r=e(t.target).attr("value");e("#"+r).is(":checked")?o(r):i(r)}),e("#"+f).append(d),"defaultOn"==y.visibility){e("#"+g).prop("checked",!0);var v=y.colour;e("#"+g).parent().css("backgroundColor",v)}}}var S=e(".g-coverage-map__nav-section"),M=e(".g-coverage-map__nav-tab");S.each(function(t){var r=e(this),a=e(".g-coverage-map__nav-button",r),i=a.length;a.addClass("mob-max-per-lane-"+i)}),M.each(function(t){e(this).addClass("mob-max-per-lane-"+M.length)}),e("body").on("click",".g-coverage-map__nav-tab",function(){var t=e(this);e(".g-coverage-map__nav-section").hide(),e(".g-coverage-map__nav-tab--active").removeClass("g-coverage-map__nav-tab--active");var r=t.attr("class").split(" ")[1].split("--")[1],a=e(".g-coverage-map__nav-section--"+r),i=e(".g-coverage-map__nav-checkbox:checked");t.addClass("g-coverage-map__nav-tab--active"),a.show(),i.length&&i.each(function(){e(this).click()})}),e(".g-coverage-map__nav-tab").first().click()}}).fail(function(e,t){console.error("Error accessing ArcGIS services.",e.responseText||t)}),e(".g-coverage-map").data("mapApiKey"),e(".g-coverage-map").data("mapAssetId");var l={center:new r.maps.LatLng(-41.16,172.43),zoom:6},p=new r.maps.Map(i.getElementById("g-coverage-map__canvas"),l),c=[],h=i.getElementById("pac-search"),_=new r.maps.places.SearchBox(h);r.maps.event.addListener(_,"places_changed",function(){var e=_.getPlaces();if(0!=e.length){for(var t=0;n=c[t];t++)n.setMap(null);c=[];var a,i=new r.maps.LatLngBounds;for(t=0;a=e[t];t++){var o={url:a.icon,size:new r.maps.Size(71,71),origin:new r.maps.Point(0,0),anchor:new r.maps.Point(17,34),scaledSize:new r.maps.Size(25,25)},n=new r.maps.Marker({map:p,icon:o,title:a.name,position:a.geometry.location});c.push(n),i.extend(a.geometry.location)}p.fitBounds(i),p.setZoom(15)}}),r.maps.event.addListener(p,"bounds_changed",function(){var e=p.getBounds();_.setBounds(e)}),r.maps.event.addDomListener(a,"resize",function(){var t=e(a).width(),i=e(a).height(),o=e(".g-coverage-map__canvas"),n=i-120;if(t<1039||n<600){o.css("height",n+"px","important");var s=p.getCenter();r.maps.event.trigger(p,"resize"),p.setCenter(s)}})}(jQuery,gmaps,google,window,document)},1042:function(e,t,r){r(23)(r(1043),{hmr:!0})},1043:function(e,t,r){e.exports=r.p+"app/module/network-outage-map/index.min.css"},23:function(e,t,r){(function(e){e.exports=function(t,r){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(r=r||{}).attrs="object"==typeof r.attrs?r.attrs:{},r.hmr=void 0===r.hmr||r.hmr;var a=document.createElement("link");a.rel="stylesheet",a.type="text/css",a.href=t,function(e,t){Object.keys(t).forEach(function(r){e.setAttribute(r,t[r])})}(a,r.attrs);var i=document.getElementsByTagName("head")[0];if(i.appendChild(a),r.hmr&&e.hot)return function(e){"string"==typeof e?a.href=e:i.removeChild(a)}}}).call(this,r(52)(e))},52:function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},858:function(module,__webpack_exports__,__webpack_require__){"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var ArgcisLink=function ArgcisLink(){
/**
   * @preserve http://google-maps-utility-library-v3.googlecode.com
   */
var gmaps=gmaps||{},RAD_DEG=Math.PI/180,jsonpID_=0;window.ags_jsonp=window.ags_jsonp||{};var G=google.maps,WGS84,NAD83,WEB_MERCATOR,WEB_MERCATOR_AUX,Config={proxyUrl:null,alwaysUseProxy:!1},spatialReferences_={},Util={};function extractString_(e,t,r){var a=""===t?0:e.indexOf(t),i=""===r?e.length:e.indexOf(r,a+t.length);return e.substring(a+t.length,i)}function isString_(e){return e&&"string"==typeof e}function isArray_(e){return e&&e.splice}function isNumber_(e){return"number"==typeof e}function augmentObject_(e,t,r){var a;if(e&&t)for(a in e)!r&&a in t||(t[a]=e[a]);return t}function triggerEvent_(e,t,r){G.event.trigger.apply(this,arguments)}function handleErr_(e,t){e&&t&&t.error&&e(t.error)}function formatTimeString_(e,t){var r="";return e&&(r+=e.getTime()-6e4*e.getTimezoneOffset()),t&&(r+=", "+(t.getTime()-6e4*t.getTimezoneOffset())),r}function setNodeOpacity_(e,t){if(t=Math.min(Math.max(t,0),1),e){var r=e.style;void 0!==r.opacity&&(r.opacity=t),void 0!==r.filters&&(r.filters.alpha.opacity=Math.floor(100*t)),void 0!==r.filter&&(r.filter="alpha(opacity:"+Math.floor(100*t)+")")}}function getLayerDefsString_(e){var t="";for(var r in e)e.hasOwnProperty(r)&&(t.length>0&&(t+=";"),t+=r+":"+e[r]);return t}function getXmlHttp_(){if("undefined"==typeof XMLHttpRequest){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw new Error("This browser does not support XMLHttpRequest.")}return new XMLHttpRequest}var GeometryType={POINT:"esriGeometryPoint",MULTIPOINT:"esriGeometryMultipoint",POLYLINE:"esriGeometryPolyline",POLYGON:"esriGeometryPolygon",ENVELOPE:"esriGeometryEnvelope"};function getGeometryType_(e){var t=e;return isArray_(e)&&e.length>0&&(t=e[0]),t instanceof G.LatLng||t instanceof G.Marker?isArray_(e)&&e.length>1?GeometryType.MULTIPOINT:GeometryType.POINT:t instanceof G.Polyline?GeometryType.POLYLINE:t instanceof G.Polygon?GeometryType.POLYGON:t instanceof G.LatLngBounds?GeometryType.ENVELOPE:void 0!==t.x&&void 0!==t.y?GeometryType.POINT:t.points?GeometryType.MULTIPOINT:t.paths?GeometryType.POLYLINE:t.rings?GeometryType.POLYGON:null}function isOverlay_(e){var t=e;return isArray_(e)&&e.length>0&&(t=e[0]),isArray_(t)&&t.length>0&&(t=t[0]),t instanceof G.LatLng||t instanceof G.Marker||t instanceof G.Polyline||t instanceof G.Polygon||t instanceof G.LatLngBounds}function formatSRParam_(e){return e?isNumber_(e)?e:e.wkid?e.wkid:e.toJSON():null}function fromLatLngsToJSON_(e,t){for(var r,a=[],i=0,o=e.getLength();i<o;i++)r=e.getAt(i),a.push("["+r.lng()+","+r.lat()+"]");return t&&a.length>0&&a.push("["+e.getAt(0).lng()+","+e.getAt(0).lat()+"]"),a.join(",")}function fromOverlaysToJSON_(e){var t,r,a,i,o="{";switch(getGeometryType_(e)){case GeometryType.POINT:(t=isArray_(e)?e[0]:e)instanceof G.Marker&&(t=t.getPosition()),o+="x:"+t.lng()+",y:"+t.lat();break;case GeometryType.MULTIPOINT:for(i=[],a=0;a<e.length;a++)t=e[a]instanceof G.Marker?e[a].getPosition():e[a],i.push("["+t.lng()+","+t.lat()+"]");o+="points: ["+i.join(",")+"]";break;case GeometryType.POLYLINE:for(i=[],r=isArray_(e)?e:[e],a=0;a<r.length;a++)i.push("["+fromLatLngsToJSON_(r[a].getPath())+"]");o+="paths:["+i.join(",")+"]";break;case GeometryType.POLYGON:i=[];var n=(t=isArray_(e)?e[0]:e).getPaths();for(a=0;a<n.getLength();a++)i.push("["+fromLatLngsToJSON_(n.getAt(a),!0)+"]");o+="rings:["+i.join(",")+"]";break;case GeometryType.ENVELOPE:o+="xmin:"+(t=isArray_(e)?e[0]:e).getSouthWest().lng()+",ymin:"+t.getSouthWest().lat()+",xmax:"+t.getNorthEast().lng()+",ymax:"+t.getNorthEast().lat()}return(o+=", spatialReference:{wkid:4326}")+"}"}function fromGeometryToJSON_(e){function t(e){for(var t=[],r=0,a=e.length;r<a;r++)t.push("["+e[r][0]+","+e[r][1]+"]");return"["+t.join(",")+"]"}function r(e){for(var r=[],a=0,i=e.length;a<i;a++)r.push(t(e[a]));return"["+r.join(",")+"]"}var a="{";return e.x?a+="x:"+e.x+",y:"+e.y:e.xmin?a+="xmin:"+e.xmin+",ymin:"+e.ymin+",xmax:"+e.xmax+",ymax:"+e.ymax:e.points?a+="points:"+t(e.points):e.paths?a+="paths:"+r(e.paths):e.rings&&(a+="rings:"+r(e.rings)),a+"}"}function fromEnvelopeToLatLngBounds_(e){var t=spatialReferences_[e.spatialReference.wkid||e.spatialReference.wkt],r=(t=t||WGS84).inverse([e.xmin,e.ymin]),a=t.inverse([e.xmax,e.ymax]);return new G.LatLngBounds(new G.LatLng(r[1],r[0]),new G.LatLng(a[1],a[0]))}function fromJSONToOverlays_(e,t){var r,a,i,o,n,s,l,p,c,h=null;if(t=t||{},e)if(h=[],e.x)r=new G.Marker(augmentObject_(t.markerOptions||t,{position:new G.LatLng(e.y,e.x)})),h.push(r);else{if(!(s=e.points||e.paths||e.rings))return h;var _=[];for(a=0,i=s.length;a<i;a++)if(l=s[a],e.points)r=new G.Marker(augmentObject_(t.markerOptions||t,{position:new G.LatLng(l[1],l[0])})),h.push(r);else{for(c=[],o=0,n=l.length;o<n;o++)p=l[o],c.push(new G.LatLng(p[1],p[0]));e.paths?(r=new G.Polyline(augmentObject_(t.polylineOptions||t,{path:c})),h.push(r)):e.rings&&_.push(c)}e.rings&&(r=new G.Polygon(augmentObject_(t.polygonOptions||t,{paths:_})),h.push(r))}return h}function parseFeatures_(e,t){var r,a,i;if(e)for(r=0,a=e.length;r<a;r++)(i=e[r]).geometry&&(i.geometry=fromJSONToOverlays_(i.geometry,t))}function formatRequestString_(e){var t;if("object"===_typeof(e)){if(isArray_(e)){t=[];for(var r=0,a=e.length;r<a;r++)t.push(formatRequestString_(e[r]));return"["+t.join(",")+"]"}if(isOverlay_(e))return fromOverlaysToJSON_(e);if(e.toJSON)return e.toJSON();for(var i in t="",e)e.hasOwnProperty(i)&&(t.length>0&&(t+=", "),t+=i+":"+formatRequestString_(e[i]));return"{"+t+"}"}return e.toString()}function fromLatLngsToFeatureSet_(e){var t,r,a,i=[];for(t=0,r=e.length;t<r;t++)(a=e[t])instanceof G.Marker&&(a=a.getPosition()),i.push({geometry:{x:a.lng(),y:a.lat(),spatialReference:{wkid:4326}}});return{type:'"features"',features:i,doNotLocateOnRestrictedElements:!1}}function prepareGeometryParams_(e){var t={};if(!e)return null;var r,a,i=[];if(e.geometries&&e.geometries.length>0){a=isOverlay_(r=e.geometries[0]);for(var o=0,n=e.geometries.length;o<n;o++)a?i.push(fromOverlaysToJSON_(e.geometries[o])):i.push(fromGeometryToJSON_(e.geometries[o]))}return e.geometryType||(e.geometryType=getGeometryType_(r)),a?t.inSR=WGS84.wkid:e.inSpatialReference&&(t.inSR=formatSRParam_(e.inSpatialReference)),e.outSpatialReference&&(t.outSR=formatSRParam_(e.outSpatialReference)),t.geometries='{geometryType:"'+e.geometryType+'", geometries:['+i.join(",")+"]}",t}function log_(e){if(window.console)window.console.log(e);else{var t=document.getElementById("_ags_log");t&&(t.innerHTML=t.innerHTML+e+"<br/>")}}function formatParams_(e){var t="";if(e)for(var r in e.f=e.f||"json",e)if(e.hasOwnProperty(r)&&null!==e[r]&&void 0!==e[r]){var a=formatRequestString_(e[r]);t+=(t.length>0?"&":"")+r+"="+(escape?escape(a):encodeURIComponent(a))}return t}function callback_(e,t){for(var r=[],a=2,i=arguments.length;a<i;a++)r.push(arguments[a]);return function(){e.apply(t,r)}}function addCopyrightInfo_(e,t,r){t.hasLoaded()?e.push(t.copyrightText):G.event.addListenerOnce(t,"load",function(){setCopyrightInfo_(r)})}function setCopyrightInfo_(e){var t=null;if(e){var r=e.controls[G.ControlPosition.BOTTOM_RIGHT];if(r)for(var a=0,i=r.getLength();a<i;a++)if("agsCopyrights"===r.getAt(a).id){t=r.getAt(a);break}t||((t=document.createElement("div")).style.fontFamily="Arial,sans-serif",t.style.fontSize="10px",t.style.textAlign="right",t.id="agsCopyrights",e.controls[G.ControlPosition.BOTTOM_RIGHT].push(t),G.event.addListener(e,"maptypeid_changed",function(){setCopyrightInfo_(e)}));var o,n=e.agsOverlays,s=[];if(n)for(a=0,i=n.getLength();a<i;a++)addCopyrightInfo_(s,n.getAt(a).mapService_,e);var l=e.overlayMapTypes;if(l)for(a=0,i=l.getLength();a<i;a++)if((o=l.getAt(a))instanceof MapType)for(var p=0,c=o.tileLayers_.length;p<c;p++)addCopyrightInfo_(s,o.tileLayers_[p].mapService_,e);if((o=e.mapTypes.get(e.getMapTypeId()))instanceof MapType){for(a=0,i=o.tileLayers_.length;a<i;a++)addCopyrightInfo_(s,o.tileLayers_[a].mapService_,e);o.negative?t.style.color="#fffff":t.style.color="#000000"}t.innerHTML=s.join("<br/>")}}function getJSON_(url,params,callbackName,callbackFn){var sid="ags_jsonp_"+jsonpID_+++"_"+Math.floor(1e6*Math.random()),script=null;params=params||{},params[callbackName||"callback"]="ags_jsonp."+sid;var query=formatParams_(params),head=document.getElementsByTagName("head")[0];if(!head)throw new Error("document must have header tag");var jsonpcallback=function(){window.ags_jsonp[sid]&&delete window.ags_jsonp[sid],script&&head.removeChild(script),script=null,callbackFn.apply(null,arguments),triggerEvent_(Util,"jsonpend",sid)};if(window.ags_jsonp[sid]=jsonpcallback,(query+url).length<2e3&&!Config.alwaysUseProxy)script=document.createElement("script"),script.src=url+(-1===url.indexOf("?")?"?":"&")+query,script.id=sid,head.appendChild(script);else{var loc=window.location,dom=loc.protocol+"//"+loc.hostname+(loc.port&&80!==loc.port?":"+loc.port+"/":""),useProxy=!0;if(-1!==url.toLowerCase().indexOf(dom.toLowerCase())&&(useProxy=!1),Config.alwaysUseProxy&&(useProxy=!0),useProxy&&!Config.proxyUrl)throw new Error("No proxyUrl property in Config is defined");var xmlhttp=getXmlHttp_();xmlhttp.onreadystatechange=function(){if(4===xmlhttp.readyState){if(200!==xmlhttp.status)throw new Error("Error code "+xmlhttp.status);eval(xmlhttp.responseText)}},xmlhttp.open("POST",useProxy?Config.proxyUrl+"?"+url:url,!0),xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xmlhttp.send(query)}return triggerEvent_(Util,"jsonpstart",sid),sid}function SpatialReference(e){e=e||{},this.wkid=e.wkid,this.wkt=e.wkt}function Geographic(e){e=e||{},SpatialReference.call(this,e)}function LambertConformalConic(e){e=e||{},SpatialReference.call(this,e);var t=e.inverse_flattening,r=e.standard_parallel_1*RAD_DEG,a=e.standard_parallel_2*RAD_DEG,i=e.latitude_of_origin*RAD_DEG;this.a_=e.semi_major/e.unit,this.lamda0_=e.central_meridian*RAD_DEG,this.FE_=e.false_easting,this.FN_=e.false_northing;var o=1/t,n=2*o-o*o;this.e_=Math.sqrt(n);var s=this.calc_m_(r,n),l=this.calc_m_(a,n),p=this.calc_t_(i,this.e_),c=this.calc_t_(r,this.e_),h=this.calc_t_(a,this.e_);this.n_=Math.log(s/l)/Math.log(c/h),this.F_=s/(this.n_*Math.pow(c,this.n_)),this.rho0_=this.calc_rho_(this.a_,this.F_,p,this.n_)}function TransverseMercator(e){e=e||{},SpatialReference.call(this,e),this.a_=e.semi_major/e.unit;var t=e.inverse_flattening;this.k0_=e.scale_factor;var r=e.latitude_of_origin*RAD_DEG;this.lamda0_=e.central_meridian*RAD_DEG,this.FE_=e.false_easting,this.FN_=e.false_northing;var a=1/t;this.es_=2*a-a*a,this.ep4_=this.es_*this.es_,this.ep6_=this.ep4_*this.es_,this.eas_=this.es_/(1-this.es_),this.M0_=this.calc_m_(r,this.a_,this.es_,this.ep4_,this.ep6_)}function SphereMercator(e){e=e||{},SpatialReference.call(this,e),this.a_=(e.semi_major||6378137)/(e.unit||1),this.lamda0_=(e.central_meridian||0)*RAD_DEG}function Albers(e){e=e||{},SpatialReference.call(this,e);var t=e.inverse_flattening,r=e.standard_parallel_1*RAD_DEG,a=e.standard_parallel_2*RAD_DEG,i=e.latitude_of_origin*RAD_DEG;this.a_=e.semi_major/e.unit,this.lamda0_=e.central_meridian*RAD_DEG,this.FE_=e.false_easting,this.FN_=e.false_northing;var o=1/t,n=2*o-o*o;this.e_=Math.sqrt(n);var s=this.calc_m_(r,n),l=this.calc_m_(a,n),p=this.calc_q_(r,this.e_),c=this.calc_q_(a,this.e_),h=this.calc_q_(i,this.e_);this.n_=(s*s-l*l)/(c-p),this.C_=s*s+this.n_*p,this.rho0_=this.calc_rho_(this.a_,this.C_,this.n_,h)}function Catalog(e){this.url=e;var t=this;getJSON_(e,{},"",function(e){augmentObject_(e,t),triggerEvent_(t,"load")})}function Layer(e){this.url=e,this.definition=null}Util.getJSON=function(e,t,r,a){getJSON_(e,t,r,a)},Util.addToMap=function(e,t){if(isArray_(t))for(var r,a=0,i=t.length;a<i;a++)isArray_(r=t[a])?Util.addToMap(e,r):isOverlay_(r)&&r.setMap(e)},Util.removeFromMap=function(e,t){Util.addToMap(null,e),t&&(e.length=0)},SpatialReference.prototype.forward=function(e){return e},SpatialReference.prototype.inverse=function(e){return e},SpatialReference.prototype.getCircum=function(){return 360},SpatialReference.prototype.toJSON=function(){return"{"+(this.wkid?" wkid:"+this.wkid:"wkt: '"+this.wkt+"'")+"}"},Geographic.prototype=new SpatialReference,LambertConformalConic.prototype=new SpatialReference,LambertConformalConic.prototype.calc_m_=function(e,t){var r=Math.sin(e);return Math.cos(e)/Math.sqrt(1-t*r*r)},LambertConformalConic.prototype.calc_t_=function(e,t){var r=t*Math.sin(e);return Math.tan(Math.PI/4-e/2)/Math.pow((1-r)/(1+r),t/2)},LambertConformalConic.prototype.calc_rho_=function(e,t,r,a){return e*t*Math.pow(r,a)},LambertConformalConic.prototype.calc_phi_=function(e,t,r){var a=t*Math.sin(r);return Math.PI/2-2*Math.atan(e*Math.pow((1-a)/(1+a),t/2))},LambertConformalConic.prototype.solve_phi_=function(e,t,r){for(var a=0,i=r,o=this.calc_phi_(e,t,i);Math.abs(o-i)>1e-9&&a<10;)a++,i=o,o=this.calc_phi_(e,t,i);return o},LambertConformalConic.prototype.forward=function(e){var t=e[1]*RAD_DEG,r=e[0]*RAD_DEG,a=this.calc_t_(t,this.e_),i=this.calc_rho_(this.a_,this.F_,a,this.n_),o=this.n_*(r-this.lamda0_);return[this.FE_+i*Math.sin(o),this.FN_+this.rho0_-i*Math.cos(o)]},LambertConformalConic.prototype.inverse=function(e){var t=e[0]-this.FE_,r=e[1]-this.FN_,a=Math.atan(t/(this.rho0_-r)),i=(this.n_>0?1:-1)*Math.sqrt(t*t+(this.rho0_-r)*(this.rho0_-r)),o=Math.pow(i/(this.a_*this.F_),1/this.n_),n=Math.PI/2-2*Math.atan(o),s=this.solve_phi_(o,this.e_,n);return[(a/this.n_+this.lamda0_)/RAD_DEG,s/RAD_DEG]},LambertConformalConic.prototype.getCircum=function(){return 2*Math.PI*this.a_},TransverseMercator.prototype=new SpatialReference,TransverseMercator.prototype.calc_m_=function(e,t,r,a,i){return t*((1-r/4-3*a/64-5*i/256)*e-(3*r/8+3*a/32+45*i/1024)*Math.sin(2*e)+(15*a/256+45*i/1024)*Math.sin(4*e)-35*i/3072*Math.sin(6*e))},TransverseMercator.prototype.forward=function(e){var t=e[1]*RAD_DEG,r=e[0]*RAD_DEG,a=this.a_/Math.sqrt(1-this.es_*Math.pow(Math.sin(t),2)),i=Math.pow(Math.tan(t),2),o=this.eas_*Math.pow(Math.cos(t),2),n=(r-this.lamda0_)*Math.cos(t),s=this.calc_m_(t,this.a_,this.es_,this.ep4_,this.ep6_);return[this.FE_+this.k0_*a*(n+(1-i+o)*Math.pow(n,3)/6+(5-18*i+i*i+72*o-58*this.eas_)*Math.pow(n,5)/120),this.FN_+this.k0_*(s-this.M0_)+a*Math.tan(t)*(n*n/2+(5-i+9*o+4*o*o)*Math.pow(n,4)/120+(61-58*i+i*i+600*o-330*this.eas_)*Math.pow(n,6)/720)]},TransverseMercator.prototype.inverse=function(e){var t=e[0],r=e[1],a=(1-Math.sqrt(1-this.es_))/(1+Math.sqrt(1-this.es_)),i=(this.M0_+(r-this.FN_)/this.k0_)/(this.a_*(1-this.es_/4-3*this.ep4_/64-5*this.ep6_/256)),o=i+(3*a/2-27*Math.pow(a,3)/32)*Math.sin(2*i)+(21*a*a/16-55*Math.pow(a,4)/32)*Math.sin(4*i)+151*Math.pow(a,3)/6*Math.sin(6*i)+1097*Math.pow(a,4)/512*Math.sin(8*i),n=this.eas_*Math.pow(Math.cos(o),2),s=Math.pow(Math.tan(o),2),l=this.a_/Math.sqrt(1-this.es_*Math.pow(Math.sin(o),2)),p=this.a_*(1-this.es_)/Math.pow(1-this.es_*Math.pow(Math.sin(o),2),1.5),c=(t-this.FE_)/(l*this.k0_),h=o-l*Math.tan(o)/p*(c*c/2-(5+3*s+10*n-4*n*n-9*this.eas_)*Math.pow(c,4)/24+(61+90*s+28*n+45*s*s-252*this.eas_-3*n*n)*Math.pow(c,6)/720);return[(this.lamda0_+(c-(1+2*s+n)*Math.pow(c,3)/6+(5-2*n+28*s-3*n*n+8*this.eas_+24*s*s)*Math.pow(c,5)/120)/Math.cos(o))/RAD_DEG,h/RAD_DEG]},TransverseMercator.prototype.getCircum=function(){return 2*Math.PI*this.a_},SphereMercator.prototype=new SpatialReference,SphereMercator.prototype.forward=function(e){var t=e[1]*RAD_DEG,r=e[0]*RAD_DEG;return[this.a_*(r-this.lamda0_),this.a_/2*Math.log((1+Math.sin(t))/(1-Math.sin(t)))]},SphereMercator.prototype.inverse=function(e){var t=e[0],r=e[1],a=Math.PI/2-2*Math.atan(Math.exp(-r/this.a_));return[(t/this.a_+this.lamda0_)/RAD_DEG,a/RAD_DEG]},SphereMercator.prototype.getCircum=function(){return 2*Math.PI*this.a_},Albers.prototype=new SpatialReference,Albers.prototype.calc_m_=function(e,t){var r=Math.sin(e);return Math.cos(e)/Math.sqrt(1-t*r*r)},Albers.prototype.calc_q_=function(e,t){var r=t*Math.sin(e);return(1-t*t)*(Math.sin(e)/(1-r*r)-1/(2*t)*Math.log((1-r)/(1+r)))},Albers.prototype.calc_rho_=function(e,t,r,a){return e*Math.sqrt(t-r*a)/r},Albers.prototype.calc_phi_=function(e,t,r){var a=t*Math.sin(r);return r+(1-a*a)*(1-a*a)/(2*Math.cos(r))*(e/(1-t*t)-Math.sin(r)/(1-a*a)+Math.log((1-a)/(1+a))/(2*t))},Albers.prototype.solve_phi_=function(e,t,r){for(var a=0,i=r,o=this.calc_phi_(e,t,i);Math.abs(o-i)>1e-8&&a<10;)a++,i=o,o=this.calc_phi_(e,t,i);return o},Albers.prototype.forward=function(e){var t=e[1]*RAD_DEG,r=e[0]*RAD_DEG,a=this.calc_q_(t,this.e_),i=this.calc_rho_(this.a_,this.C_,this.n_,a),o=this.n_*(r-this.lamda0_);return[this.FE_+i*Math.sin(o),this.FN_+this.rho0_-i*Math.cos(o)]},Albers.prototype.inverse=function(e){var t=e[0]-this.FE_,r=e[1]-this.FN_,a=Math.sqrt(t*t+(this.rho0_-r)*(this.rho0_-r)),i=this.n_>0?1:-1,o=Math.atan(i*t/(i*this.rho0_-i*r)),n=(this.C_-a*a*this.n_*this.n_/(this.a_*this.a_))/this.n_,s=Math.asin(n/2),l=this.solve_phi_(n,this.e_,s);return[(o/this.n_+this.lamda0_)/RAD_DEG,l/RAD_DEG]},Albers.prototype.getCircum=function(){return 2*Math.PI*this.a_},Albers.prototype.getCircum=function(){return 2*Math.PI*this.a_},WGS84=new Geographic({wkid:4326}),NAD83=new Geographic({wkid:4269}),WEB_MERCATOR=new SphereMercator({wkid:3857,semi_major:6378137,central_meridian:0,unit:1}),WEB_MERCATOR_AUX=new SphereMercator({wkid:102100,semi_major:6378137,central_meridian:0,unit:1}),spatialReferences_={4326:WGS84,4269:NAD83,3857:WEB_MERCATOR,102100:WEB_MERCATOR_AUX},SpatialReference.WGS84=WGS84,SpatialReference.NAD83=NAD83,SpatialReference.WEB_MERCATOR=WEB_MERCATOR,SpatialReference.WEB_MERCATOR_AUX=WEB_MERCATOR_AUX,Util.registerSR=function(e,t){var r=spatialReferences_[""+e];if(r)return r;if(t instanceof SpatialReference)spatialReferences_[""+e]=t,r=t;else{var a=t||e,i={wkt:e};e===parseInt(e,10)&&(i={wkid:e});var o=extractString_(a,'PROJECTION["','"]'),n=extractString_(a,"SPHEROID[","]").split(",");switch(""!==o&&(i.unit=parseFloat(extractString_(extractString_(a,"PROJECTION",""),"UNIT[","]").split(",")[1]),i.semi_major=parseFloat(n[1]),i.inverse_flattening=parseFloat(n[2]),i.latitude_of_origin=parseFloat(extractString_(a,'"Latitude_Of_Origin",',"]")),i.central_meridian=parseFloat(extractString_(a,'"Central_Meridian",',"]")),i.false_easting=parseFloat(extractString_(a,'"False_Easting",',"]")),i.false_northing=parseFloat(extractString_(a,'"False_Northing",',"]"))),o){case"":r=new SpatialReference(i);break;case"Lambert_Conformal_Conic":i.standard_parallel_1=parseFloat(extractString_(a,'"Standard_Parallel_1",',"]")),i.standard_parallel_2=parseFloat(extractString_(a,'"Standard_Parallel_2",',"]")),r=new LambertConformalConic(i);break;case"Transverse_Mercator":i.scale_factor=parseFloat(extractString_(a,'"Scale_Factor",',"]")),r=new TransverseMercator(i);break;case"Albers":i.standard_parallel_1=parseFloat(extractString_(a,'"Standard_Parallel_1",',"]")),i.standard_parallel_2=parseFloat(extractString_(a,'"Standard_Parallel_2",',"]")),r=new Albers(i);break;default:throw new Error(o+"  not supported")}r&&(spatialReferences_[""+e]=r)}return r},Layer.prototype.load=function(){var e=this;this.loaded_||getJSON_(this.url,{},"",function(t){augmentObject_(t,e),e.loaded_=!0,triggerEvent_(e,"load")})},Layer.prototype.isInScale=function(e){return!(this.maxScale&&this.maxScale>e||this.minScale&&this.minScale<e)};var SpatialRelationship={INTERSECTS:"esriSpatialRelIntersects",CONTAINS:"esriSpatialRelContains",CROSSES:"esriSpatialRelCrosses",ENVELOPE_INTERSECTS:"esriSpatialRelEnvelopeIntersects",INDEX_INTERSECTS:"esriSpatialRelIndexIntersects",OVERLAPS:"esriSpatialRelOverlaps",TOUCHES:"esriSpatialRelTouches",WITHIN:"esriSpatialRelWithin"};function MapService(e,t){this.url=e,this.loaded_=!1;var r=e.split("/");if(this.name=r[r.length-2].replace(/_/g," "),(t=t||{}).delayLoad){var a=this;window.setTimeout(function(){a.loadServiceInfo()},1e3*t.delayLoad)}else this.loadServiceInfo()}function GeocodeService(e){this.url=e,this.loaded_=!1;var t=this;getJSON_(e,{},"",function(e){t.init_(e)})}function GeometryService(e){this.url=e,this.t="geocodeservice"}Layer.prototype.query=function(e,t,r){if(e){var a=augmentObject_(e,{});e.geometry&&!isString_(e.geometry)&&(a.geometry=fromOverlaysToJSON_(e.geometry),a.geometryType=getGeometryType_(e.geometry),a.inSR=4326),e.spatialRelationship&&(a.spatialRel=e.spatialRelationship,delete a.spatialRelationship),e.outFields&&isArray_(e.outFields)&&(a.outFields=e.outFields.join(",")),e.objectIds&&(a.objectIds=e.objectIds.join(",")),e.time&&(a.time=formatTimeString_(e.time,e.endTime)),a.outSR=4326,a.returnGeometry=!1!==e.returnGeometry,a.returnIdsOnly=!0===e.returnIdsOnly,delete a.overlayOptions,getJSON_(this.url+"/query",a,"",function(a){parseFeatures_(a.features,e.overlayOptions),t(a,a.error),handleErr_(r,a)})}},Layer.prototype.queryRelatedRecords=function(e,t,r){if(e){var a=augmentObject_(e,{});a.f=a.f||"json",a.outFields&&!isString_(a.outFields)&&(a.outFields=a.outFields.join(",")),a.returnGeometry=!1!==a.returnGeometry,getJSON_(this.url+"/query",a,"",function(e){handleErr_(r,e),t(e)})}},MapService.prototype.loadServiceInfo=function(){var e=this;getJSON_(this.url,{},"",function(t){e.init_(t)})},MapService.prototype.init_=function(e){var t=this;if(e.error)throw new Error(e.error.message);augmentObject_(e,this),e.spatialReference.wkt?this.spatialReference=Util.registerSR(e.spatialReference.wkt):this.spatialReference=spatialReferences_[e.spatialReference.wkid],void 0!==e.tables?getJSON_(this.url+"/layers",{},"",function(e){t.initLayers_(e),getJSON_(t.url+"/legend",{},"",function(e){t.initLegend_(e),t.setLoaded_()})}):(t.initLayers_(e),t.setLoaded_())},MapService.prototype.setLoaded_=function(){this.loaded_=!0,triggerEvent_(this,"load")},MapService.prototype.initLayers_=function(e){var t,r,a,i,o=[],n=[];for(this.layers=o,e.tables&&(this.tables=n),r=0,a=e.layers.length;r<a;r++)augmentObject_(i=e.layers[r],t=new Layer(this.url+"/"+i.id)),t.visible=t.defaultVisibility,o.push(t);if(e.tables)for(r=0,a=e.tables.length;r<a;r++)augmentObject_(i=e.tables[r],t=new Layer(this.url+"/"+i.id)),n.push(t);for(r=0,a=o.length;r<a;r++)if((t=o[r]).subLayerIds){t.subLayers=[];for(var s=0,l=t.subLayerIds.length;s<l;s++){var p=this.getLayer(t.subLayerIds[s]);t.subLayers.push(p),p.parentLayer=t}}},MapService.prototype.initLegend_=function(e){var t,r,a,i=this.layers;if(e.layers)for(t=0,r=e.layers.length;t<r;t++)augmentObject_(a=e.layers[t],i[a.layerId])},MapService.prototype.getLayer=function(e){var t=this.layers;if(t)for(var r=0,a=t.length;r<a;r++){if(e===t[r].id)return t[r];if(isString_(e)&&t[r].name.toLowerCase()===e.toLowerCase())return t[r]}return null},MapService.prototype.getLayerDefs_=function(){var e={};if(this.layers)for(var t=0,r=this.layers.length;t<r;t++){var a=this.layers[t];a.definition&&(e[String(a.id)]=a.definition)}return e},MapService.prototype.hasLoaded=function(){return this.loaded_},MapService.prototype.getVisibleLayerIds_=function(){var e=[];if(this.layers){var t,r,a;for(r=0,a=this.layers.length;r<a;r++)if((t=this.layers[r]).subLayers)for(var i=0,o=t.subLayers.length;i<o;i++)if(!1===t.subLayers[i].visible){t.visible=!1;break}for(r=0,a=this.layers.length;r<a;r++)(t=this.layers[r]).subLayers&&t.subLayers.length>0||!0===t.visible&&e.push(t.id)}return e},MapService.prototype.getInitialBounds=function(){return this.initialExtent?(this.initBounds_=this.initBounds_||fromEnvelopeToLatLngBounds_(this.initialExtent),this.initBounds_):null},MapService.prototype.getFullBounds=function(){return this.fullExtent?(this.fullBounds_=this.fullBounds_||fromEnvelopeToLatLngBounds_(this.fullExtent),this.fullBounds_):null},MapService.prototype.exportMap=function(e,t,r){if(e&&e.bounds){var a={};a.f=e.f;var i=e.bounds,o=i.getSouthWest().lng(),n=i.getNorthEast().lng();o>n&&(o-=180),a.bbox=o+","+i.getSouthWest().lat()+","+n+","+i.getNorthEast().lat(),a.size=e.width+","+e.height,a.dpi=e.dpi,e.imageSR&&(e.imageSR.wkid?a.imageSR=e.imageSR.wkid:a.imageSR="{wkt:"+e.imageSR.wkt+"}"),a.bboxSR="4326",a.format=e.format||"png32";var s=e.layerDefinitions;void 0===s&&(s=this.getLayerDefs_()),a.layerDefs=getLayerDefsString_(s);var l=e.layerIds,p=e.layerOption||"show";if(void 0===l&&(l=this.getVisibleLayerIds_()),l.length>0)a.layers=p+":"+l.join(",");else if(this.loaded_&&t)return void t({href:null});if(a.transparent=!1!==e.transparent,e.time&&(a.time=formatTimeString_(e.time,e.endTime)),a.layerTimeOptions=e.layerTimeOptions,"image"===a.f)return this.url+"/export?"+formatParams_(a);getJSON_(this.url+"/export",a,"",function(e){e.extent?(e.bounds=fromEnvelopeToLatLngBounds_(e.extent),delete e.extent,t(e)):handleErr_(r,e.error)})}},MapService.prototype.identify=function(e,t,r){if(e){var a={};a.geometry=fromOverlaysToJSON_(e.geometry),a.geometryType=getGeometryType_(e.geometry),a.mapExtent=fromOverlaysToJSON_(e.bounds),a.tolerance=e.tolerance||2,a.sr=4326,a.imageDisplay=e.width+","+e.height+","+(e.dpi||96),a.layers=e.layerOption||"all",e.layerIds&&(a.layers+=":"+e.layerIds.join(",")),e.layerDefs&&(a.layerDefs=getLayerDefsString_(e.layerDefs)),a.maxAllowableOffset=e.maxAllowableOffset,a.returnGeometry=!1!==e.returnGeometry,getJSON_(this.url+"/identify",a,"",function(a){var i,o,n;if(a.results)for(i=0;i<a.results.length;i++)n=fromJSONToOverlays_((o=a.results[i]).geometry,e.overlayOptions),o.feature={geometry:n,attributes:o.attributes},delete o.attributes;t(a),handleErr_(r,a)})}},MapService.prototype.find=function(e,t,r){if(e){var a=augmentObject_(e,{});e.layerIds&&(a.layers=e.layerIds.join(","),delete a.layerIds),e.searchFields&&(a.searchFields=e.searchFields.join(",")),a.contains=!1!==e.contains,e.layerDefinitions&&(a.layerDefs=getLayerDefsString_(e.layerDefinitions),delete a.layerDefinitions),a.sr=4326,a.returnGeometry=!1!==e.returnGeometry,getJSON_(this.url+"/find",a,"",function(a){var i,o,n;if(a.results)for(i=0;i<a.results.length;i++)n=fromJSONToOverlays_((o=a.results[i]).geometry,e.overlayOptions),o.feature={geometry:n,attributes:o.attributes},delete o.attributes;t(a),handleErr_(r,a)})}},MapService.prototype.queryLayer=function(e,t,r,a){var i=this.getLayer(e);i&&i.query(t,r,a)},GeocodeService.prototype.init_=function(e){augmentObject_(e,this),e.spatialReference&&(this.spatialReference=spatialReferences_[e.spatialReference.wkid||e.spatialReference.wkt]||WGS84),this.loaded_=!0,triggerEvent_(this,"load")},GeocodeService.prototype.findAddressCandidates=function(e,t,r){var a=augmentObject_(e,{});a.inputs&&(augmentObject_(a.inputs,a),delete a.inputs),isArray_(a.outFields)&&(a.outFields=a.outFields.join(","));var i=this;getJSON_(this.url+"/findAddressCandidates",a,"",function(a){if(a.candidates)for(var o,n,s=[],l=0;l<a.candidates.length;l++)if(n=(o=a.candidates[l]).location,!isNaN(n.x)&&!isNaN(n.y)){var p=[n.x,n.y],c=i.spatialReference;e.outSR&&(c=spatialReferences_[e.outSR]),c&&(p=c.inverse(p)),o.location=new G.LatLng(p[1],p[0]),s[s.length]=o}t({candidates:s}),handleErr_(r,a)})},GeocodeService.prototype.geocode=function(e,t){this.findAddressCandidates(e,t)},GeocodeService.prototype.reverseGeocode=function(e,t,r){isString_(e.location)||(e.location=fromOverlaysToJSON_(e.location)),e.outSR=4326;var a=this;getJSON_(this.url+"/reverseGeocode",e,"",function(e){if(e.location){var i=e.location;if(!isNaN(i.x)&&!isNaN(i.y)){var o=[i.x,i.y];a.spatialReference&&(o=a.spatialReference.inverse(o)),e.location=new G.LatLng(o[1],o[0])}}t(e),handleErr_(r,e)})},GeometryService.prototype.project=function(e,t,r){var a=prepareGeometryParams_(e);getJSON_(this.url+"/project",a,"callback",function(a){var i=[];if(4326===e.outSpatialReference||4326===e.outSpatialReference.wkid){for(var o=0,n=a.geometries.length;o<n;o++)i.push(fromJSONToOverlays_(a.geometries[o]));a.geometries=i}t(a),handleErr_(r,a)})};var SRUnit={METER:9001,FOOT:9002,SURVEY_FOOT:9003,SURVEY_MILE:9035,KILLOMETER:9036,RADIAN:9101,DEGREE:9102};function GPService(e){this.url=e,this.loaded_=!1;var t=this;getJSON_(e,{},"",function(e){augmentObject_(e,t),t.loaded_=!0,triggerEvent_(t,"load")})}function GPTask(e){this.url=e,this.loaded_=!1;var t=this;getJSON_(e,{},"",function(e){augmentObject_(e,t),t.loaded_=!0,triggerEvent_(t,"load")})}function NetworkService(e){this.url=e,this.loaded_=!1;var t=this;getJSON_(e,{},"",function(e){augmentObject_(e,t),t.loaded_=!0,triggerEvent_(t,"load")})}function RouteTask(e){this.url=e}function Projection(e){if(this.lods_=e?e.lods:null,this.spatialReference_=e?spatialReferences_[e.spatialReference.wkid||e.spatialReference.wkt]:WEB_MERCATOR,!this.spatialReference_)throw new Error("unsupported Spatial Reference");if(this.resolution0_=e?e.lods[0].resolution:156543.033928,this.minZoom=Math.floor(Math.log(this.spatialReference_.getCircum()/this.resolution0_/256)/Math.LN2+.5),this.maxZoom=e?this.minZoom+this.lods_.length-1:20,G.Size&&(this.tileSize_=e?new G.Size(e.cols,e.rows):new G.Size(256,256)),this.scale_=Math.pow(2,this.minZoom)*this.resolution0_,this.originX_=e?e.origin.x:-20037508.342787,this.originY_=e?e.origin.y:20037508.342787,e)for(var t,r=0;r<e.lods.length-1;r++)if((t=e.lods[r].resolution/e.lods[r+1].resolution)>2.001||t<1.999)throw new Error("This type of map cache is not supported in V3. \nScale ratio between zoom levels must be 2")}function TileLayer(e,t){if((t=t||{}).opacity&&(this.opacity_=t.opacity,delete t.opacity),augmentObject_(t,this),this.mapService_=e instanceof MapService?e:new MapService(e),t.hosts){var r=extractString_(this.mapService_.url,"","://"),a=extractString_(this.mapService_.url,"://","/"),i=extractString_(this.mapService_.url,r+"://"+a,"");this.urlTemplate_=r+"://"+t.hosts+i,this.numOfHosts_=parseInt(extractString_(t.hosts,"[","]"),10)}if(this.name=t.name||this.mapService_.name,this.maxZoom=t.maxZoom||19,this.minZoom=t.minZoom||0,this.dynaZoom=t.dynaZoom||this.maxZoom,this.mapService_.loaded_)this.init_(t);else{var o=this;G.event.addListenerOnce(this.mapService_,"load",function(){o.init_(t)})}this.tiles_={},this.map_=t.map}function MapType(e,t){var r;(t=t||{}).opacity&&(this.opacity_=t.opacity,delete t.opacity),augmentObject_(t,this);var a=e;if(isString_(e))a=[new TileLayer(e,t)];else if(e instanceof MapService)a=[new TileLayer(e,t)];else if(e instanceof TileLayer)a=[e];else if(e.length>0&&isString_(e[0]))for(a=[],r=0;r<e.length;r++)a[r]=new TileLayer(e[r],t);if(this.tileLayers_=a,this.tiles_={},void 0!==t.maxZoom)this.maxZoom=t.maxZoom;else{var i=0;for(r=0;r<a.length;r++)i=Math.max(i,a[r].maxZoom);this.maxZoom=i}a[0].projection_?(this.tileSize=a[0].projection_.tileSize_,this.projection=a[0].projection_):this.tileSize=new G.Size(256,256),this.name||(this.name=a[0].name)}function MapOverlay(e,t){t=t||{},this.mapService_=e instanceof MapService?e:new MapService(e),this.minZoom=t.minZoom,this.maxZoom=t.maxZoom,this.opacity_=t.opacity||1,this.exportOptions_=t.exportOptions||{},this.drawing_=!1,this.needsNewRefresh_=t.needsNewRefresh_,this.overlay_=null,this.div_=null,t.map&&this.setMap(t.map),this.map_=null,this.listeners_=[]}function ImageOverlay(e,t,r,a){this.bounds_=e,this.url_=t,this.map_=r,this.div_=null,this.op_=a,this.setMap(r)}function CopyrightControl(e){this.map_=e,setCopyrightInfo_(e)}GeometryService.prototype.buffer=function(e,t,r){var a=prepareGeometryParams_(e);e.bufferSpatialReference&&(a.bufferSR=formatSRParam_(e.bufferSpatialReference)),a.outSR=4326,a.distances=e.distances.join(","),e.unit&&(a.unit=e.unit),getJSON_(this.url+"/buffer",a,"callback",function(a){var i=[];if(a.geometries)for(var o=0,n=a.geometries.length;o<n;o++)i.push(fromJSONToOverlays_(a.geometries[o],e.overlayOptions));a.geometries=i,t(a),handleErr_(r,a)})},GPTask.prototype.execute=function(e,t,r){var a={};e.parameters&&augmentObject_(e.parameters,a),e.outSpatialReference?a["env:outSR"]=formatSRParam_(e.outSpatialReference):a["env:outSR"]=4326,e.processSpatialReference&&(a["env:processSR"]=formatSRParam_(e.processSpatialReference)),getJSON_(this.url+"/execute",a,"",function(a){if(a.results)for(var i,o,n=0;n<a.results.length;n++)if("GPFeatureRecordSetLayer"===(i=a.results[n]).dataType)for(var s=0,l=i.value.features.length;s<l;s++)(o=i.value.features[s]).geometry&&(o.geometry=fromJSONToOverlays_(o.geometry,e.overlayOptions));t(a),handleErr_(r,a)})},RouteTask.prototype.solve=function(e,t,r){if(e){var a=augmentObject_(e,{});isArray_(e.stops)&&(a.stops=fromLatLngsToFeatureSet_(e.stops)),isArray_(e.barriers)&&(e.barriers.length>0?a.barriers=fromLatLngsToFeatureSet_(e.barriers):delete a.barriers),a.returnRoutes=!1!==e.returnRoutes,a.returnDirections=!0===e.returnDirections,a.returnBarriers=!0===e.returnBarriers,a.returnStops=!0===e.returnStops,getJSON_(this.url+"/solve",a,"",function(a){a.routes&&parseFeatures_(a.routes.features,e.overlayOptions),t(a),handleErr_(r,a)})}},Projection.prototype.fromLatLngToPoint=function(e,t){if(!e||isNaN(e.lat())||isNaN(e.lng()))return null;var r=this.spatialReference_.forward([e.lng(),e.lat()]),a=t||new G.Point(0,0);return a.x=(r[0]-this.originX_)/this.scale_,a.y=(this.originY_-r[1])/this.scale_,a},Projection.prototype.fromLatLngToPoint=Projection.prototype.fromLatLngToPoint,Projection.prototype.fromPointToLatLng=function(e,t){if(null===e)return null;var r=e.x*this.scale_+this.originX_,a=this.originY_-e.y*this.scale_,i=this.spatialReference_.inverse([r,a]);return new G.LatLng(i[1],i[0])},Projection.prototype.getScale=function(e){var t=e-this.minZoom,r=0;return this.lods_[t]&&(r=this.lods_[t].scale),r},Projection.WEB_MECATOR=new Projection,TileLayer.prototype.init_=function(e){this.mapService_.tileInfo&&(this.projection_=new Projection(this.mapService_.tileInfo),this.minZoom=e.minZoom||this.projection_.minZoom,this.maxZoom=e.maxZoom||this.projection_.maxZoom)},TileLayer.prototype.getTileUrl=function(e,t){var r=t-(this.projection_?this.projection_.minZoom:this.minZoom),a="";if(!isNaN(e.x)&&!isNaN(e.y)&&r>=0&&e.x>=0&&e.y>=0){var i=this.mapService_.url;this.urlTemplate_&&(i=this.urlTemplate_.replace("["+this.numOfHosts_+"]",""+(e.y+e.x)%this.numOfHosts_));var o=this.projection_||(this.map_?this.map_.getProjection():Projection.WEB_MECATOR);!o instanceof Projection&&(o=Projection.WEB_MECATOR);var n=o.tileSize_,s=1<<t,l=new G.Point(e.x*n.width/s,(e.y+1)*n.height/s),p=new G.Point((e.x+1)*n.width/s,e.y*n.height/s),c=new G.LatLngBounds(o.fromPointToLatLng(l),o.fromPointToLatLng(p)),h=this.mapService_.getFullBounds();if(!1===this.mapService_.singleFusedMapCache||t>this.dynaZoom){var _={f:"image"};_.bounds=c,_.format="png32",_.width=n.width,_.height=n.height,_.imageSR=o.spatialReference_,a=this.mapService_.exportMap(_)}else a=h&&!h.intersects(c)?"":i+"/tile/"+r+"/"+e.y+"/"+e.x}if(""!==a){var f=!1;if(Config.alwaysUseProxy&&(f=!0),f&&!Config.proxyUrl)throw new Error("No proxyUrl property in Config is defined");a=f?Config.proxyUrl+"?"+a:a}return a},TileLayer.prototype.setOpacity=function(e){this.opacity_=e;var t=this.tiles_;for(var r in t)t.hasOwnProperty(r)&&setNodeOpacity_(t[r],e)},TileLayer.prototype.getOpacity=function(){return this.opacity_},TileLayer.prototype.getMapService=function(){return this.mapService_},MapType.prototype.getTile=function(e,t,r){for(var a=r.createElement("div"),i="_"+e.x+"_"+e.y+"_"+t,o=0;o<this.tileLayers_.length;o++){var n=this.tileLayers_[o];if(t<=n.maxZoom&&t>=n.minZoom){var s=n.getTileUrl(e,t);if(s){var l=r.createElement(document.all?"img":"div");l.style.border="0px none",l.style.margin="0px",l.style.padding="0px",l.style.overflow="hidden",l.style.position="absolute",l.style.top="0px",l.style.left="0px",l.style.width=this.tileSize.width+"px",l.style.height=this.tileSize.height+"px",document.all?l.src=s:l.style.backgroundImage="url("+s+")",a.appendChild(l),n.tiles_[i]=l,void 0!==n.opacity_?setNodeOpacity_(l,n.opacity_):void 0!==this.opacity_&&setNodeOpacity_(l,this.opacity_)}}}return this.tiles_[i]=a,a.setAttribute("tid",i),a},MapType.prototype.getTile=MapType.prototype.getTile,MapType.prototype.releaseTile=function(e){if(e.getAttribute("tid")){var t=e.getAttribute("tid");this.tiles_[t]&&delete this.tiles_[t];for(var r=0;r<this.tileLayers_.length;r++){var a=this.tileLayers_[r];a.tiles_[t]&&delete a.tiles_[t]}}},MapType.prototype.releaseTile=MapType.prototype.releaseTile,MapType.prototype.setOpacity=function(e){this.opacity_=e;var t=this.tiles_;for(var r in t)if(t.hasOwnProperty(r))for(var a=t[r].childNodes,i=0;i<a.length;i++)setNodeOpacity_(a[i],e)},MapType.prototype.getOpacity=function(){return this.opacity_},MapType.prototype.getTileLayers=function(){return this.tileLayers_},MapOverlay.prototype=new G.OverlayView,MapOverlay.prototype.onAdd=function(){var e=this;this.listeners_.push(G.event.addListener(this.getMap(),"bounds_changed",callback_(this.refresh,this))),this.listeners_.push(G.event.addListener(this.getMap(),"dragstart",function(){e.dragging=!0})),this.listeners_.push(G.event.addListener(this.getMap(),"dragend",function(){e.dragging=!1}));var t=this.getMap();t.agsOverlays=t.agsOverlays||new G.MVCArray,t.agsOverlays.push(this),setCopyrightInfo_(t),this.map_=t},MapOverlay.prototype.onAdd=MapOverlay.prototype.onAdd,MapOverlay.prototype.onRemove=function(){for(var e=0,t=this.listeners_.length;e<t;e++)G.event.removeListener(this.listeners_[e]);this.overlay_&&this.overlay_.setMap(null);var r=this.map_,a=r.agsOverlays;if(a){e=0;for(var i=a.getLength();e<i;e++)if(a.getAt(e)==this){a.removeAt(e);break}}setCopyrightInfo_(r),this.map_=null},MapOverlay.prototype.onRemove=MapOverlay.prototype.onRemove,MapOverlay.prototype.draw=function(){!0===this.needsNewRefresh_&&this.refresh()},MapOverlay.prototype.draw=MapOverlay.prototype.draw,MapOverlay.prototype.getOpacity=function(){return this.opacity_},MapOverlay.prototype.setOpacity=function(e){var t=Math.min(Math.max(e,0),1);this.opacity_=t,this.overlay_&&setNodeOpacity_(this.overlay_.div_,t)},MapOverlay.prototype.getMapService=function(){return this.mapService_},MapOverlay.prototype.refresh=function(){if(!0!==this.drawing_){var e=this.getMap(),t=e?e.getBounds():null;if(t){var r=this.exportOptions_;r.bounds=t;var a=WEB_MERCATOR,i=e.getDiv();if(r.width=i.offsetWidth,r.height=i.offsetHeight,0!=i.offsetWidth&&0!=i.offsetHeight){var o=e.getProjection();o&&o instanceof Projection&&(a=o.spatialReference_),r.imageSR=a,triggerEvent_(this,"drawstart");var n=this;this.drawing_=!0,!this.dragging&&this.overlay_&&(this.overlay_.setMap(null),this.overlay_=null),this.mapService_.exportMap(r,function(e){if(n.drawing_=!1,!0===n.needsNewRefresh_)return n.needsNewRefresh_=!1,void n.refresh();e.href&&(n.overlay_&&(n.overlay_.setMap(null),n.overlay_=null),n.overlay_=new ImageOverlay(e.bounds,e.href,n.map_,n.opacity_)),triggerEvent_(n,"drawend")})}}}else this.needsNewRefresh_=!0},MapOverlay.prototype.isHidden=function(){return!(this.visible_&&this.isInZoomRange_())},MapOverlay.prototype.isInZoomRange_=function(){var e=this.getMap().getZoom();return!(void 0!==this.minZoom&&e<this.minZoom||void 0!==this.maxZoom&&e>this.maxZoom)},MapOverlay.prototype.show=function(){this.visible_=!0,this.div_.style.visibility="visible",this.refresh()},MapOverlay.prototype.hide=function(){this.visible_=!1,this.div_.style.visibility="hidden"},ImageOverlay.prototype=new G.OverlayView,ImageOverlay.prototype.onAdd=function(){var e=document.createElement("DIV");e.style.border="none",e.style.borderWidth="0px",e.style.position="absolute";var t=this.map_.getDiv();e.style.width=t.offsetWidth+"px",e.style.height=t.offsetHeight+"px",e.style.backgroundImage="url("+this.url_+")",this.div_=e;var r=this.getPanes();setNodeOpacity_(e,this.op_),r.overlayLayer.appendChild(e)},ImageOverlay.prototype.draw=function(){var e=this.getProjection(),t=e.fromLatLngToDivPixel(this.bounds_.getSouthWest()),r=e.fromLatLngToDivPixel(this.bounds_.getNorthEast()),a=this.div_;a.style.left=t.x+"px",a.style.top=r.y+"px"},ImageOverlay.prototype.onRemove=function(){this.div_&&this.div_.parentNode.removeChild(this.div_),this.div_=null},CopyrightControl.prototype.refresh=function(){setCopyrightInfo_(this.map_)},gmaps.ags={SpatialReference:SpatialReference,Geographic:Geographic,LambertConformalConic:LambertConformalConic,SphereMercator:SphereMercator,TransverseMercator:TransverseMercator,SpatialRelationship:SpatialRelationship,GeometryType:GeometryType,SRUnit:SRUnit,Catalog:Catalog,MapService:MapService,Layer:Layer,GeocodeService:GeocodeService,GeometryService:GeometryService,GPService:GPService,GPTask:GPTask,RouteTask:RouteTask,Util:Util,Config:Config,Projection:Projection,TileLayer:TileLayer,MapOverlay:MapOverlay,MapType:MapType,CopyrightControl:CopyrightControl},window.gmaps=gmaps};__webpack_exports__.a=ArgcisLink}});