require({cache:{"geocortex/config":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.config={baseUrl:"http://localhost/",io:{errorHandler:function(e,t){dojo.publish("geocortex.Error",[e])},postLength:2e3,timeout:6e4},REST_version:"3.0",authenticationDialogId:null}})}}}),function(){require({cache:{"geocortex/essentials":function(){},"geocortex/essentials/ArcGisPortalSecurityContext":function(){define(["require","exports","./OAuth2Client","./utilities/DecomposedUri","./utilities/StringUtilities"],function(e,t,i,r,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t,i){this.baseUrl=e,this.domains=t,this.clientId=i}return e.prototype.initiate=function(){return this.tokenResult||(this.tokenResult=i.OAuth2Client.getTokenFromImplicitGrant()),this.tokenResult?(i.OAuth2Client.removeImplicitGrantParamsAndUpdateUrlHash(),!0):(this.error=i.OAuth2Client.getErrorFromImplicitGrant(),this.error||i.OAuth2Client.redirectToLogOnPage(this.getLogOnUrl(),this.clientId),i.OAuth2Client.removeImplicitGrantParamsAndUpdateUrlHash(),!1)},e.prototype.getLogOnUrl=function(){return this.baseUrl+"oauth2/authorize"},e.prototype.getToken=function(e){return this.tokenResult&&e&&this.appliesTo(e)?this.tokenResult.token:null},e.prototype.appliesTo=function(e){for(var t=r.DecomposedUri.getHost(e),i=0;i0&&s("No FeatureSetParameters provided");for(var a=this.url+"/link",o=null,l=0;l0&&((o=null===o?{}:o)[u.id]=c)}if(o){var g=n.encodeJson(dojo.mixin({f:"json"},o));this._numDataLinkingRequests++,n.request({url:a,content:g,load:function(e){r._numDataLinkingRequests--,!e&&i&&i(new Error("No results")),e.error&&i&&i(e.error),t&&t(r._parseConvertDates(e.results))},error:function(e){r._numDataLinkingRequests--,i&&i(e)},callbackParamName:"CallBack"})}else s("Missing Feature Fields.")},i.prototype._configureObject=function(e,t){if(void 0===e||void 0===e.displayName||void 0===e.parameters)throw new Error("Incorrect data link object returned from initialization");if(this.displayName=e.displayName,this.id=e.id,this.visible=void 0===e.visible||e.visible,this.isOneToOne=!!e.isOneToOne,this.parameters=e.parameters,this.searches=e.searches,this.searches)for(var i=0,r=this.searches.length;i6&&"/Date("===i.substring(0,6)){i=parseInt(i.substring(6));var r=new Date(i);e[t]=r}}else"object"==typeof i&&(e[t]=this._parseConvertDates(i))}return e},i.prototype._prepParamValue=function(e){var t="";return"number"==typeof e?t=e.toString():"string"==typeof e&&(t=e.replace(/,/g,"\\,")),t},i}(r.AsyncInitializable);i.DataLink=s})},"geocortex/essentials/DataLinkParameter":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){this.featureField=null,this.id=null,this.name=null,this.type=null};t.DataLinkParameter=i})},"geocortex/essentials/DataLinkSearch":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/DistanceUnit":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,r,n=function(){function e(e,t){this.name=e,this.type=t}return e.prototype.isLinear=function(){return!(this.type===i.DEGREES||this.type===i.RADIANS||this.type===i.GRADS||this.type===i.OTHER)},e}();t.DistanceUnit=n,(r=i=t.DistanceUnitType||(t.DistanceUnitType={})).OTHER="Other",r.INCHES="Inches",r.FEET="Feet",r.US_SURVEY_FEET="USSurveyFeet",r.YARDS="Yards",r.MILES="Miles",r.NAUTICAL_MILES="NauticalMiles",r.MILLIMETERS="Millimeters",r.CENTIMETERS="Centimeters",r.DECIMETERS="Decimeters",r.METERS="Meters",r.KILOMETERS="Kilometers",r.DEGREES="Degrees",r.RADIANS="Radians",r.GRADS="Grads"})},"geocortex/essentials/EssentialsFeatureSet":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.prototype.toJson=function(){return JSON.stringify(this)},e}();t.EssentialsFeatureSet=i})},"geocortex/essentials/EssentialsLayerInfo":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){};t.EssentialsLayerInfo=i})},"geocortex/essentials/ExportMapImageOptions":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e,t){void 0===t&&(t="Png"),this.defaultOutputFormat=t,this.allowIncludeGeoreferenceData=e};t.ExportMapImageOptions=i})},"geocortex/essentials/Extension":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e,t){this.className=e,this.instance=t};t.Extension=i})},"geocortex/essentials/ExtentManager":function(){define(["require","exports"],function(e,t){"use strict";var i,r;Object.defineProperty(t,"__esModule",{value:!0}),(r=i||(i={}))[r.NONE=-1]="NONE",r[r.RESIZE=0]="RESIZE",r[r.REPOSITION=1]="REPOSITION",r[r.EXTENT_CHANGE=2]="EXTENT_CHANGE";var n=function(){function e(e,t){this._map=null,this._currentExtentChangePriority=-1,this._queuedExtentChangePriority=-1,this._queuedExtentChange=[],this._extentChangeInProgress=!1,this._fitTiledMapsToExtent=!1,this._newLayers=[],this._initialExtent=null,this.currentExtentChangeHandle=null,this._firstMapResizeExecuted=!1,this._map=e,this._fitTiledMapsToExtent=!!t,this._fitTiledMapsToExtent&&console.log("The fitTiledMapsToExtent parameter is active. When true, for maps that contain tiled map service layers, you are guaranteed to have the input extent shown completely on the map."),this._map.on("resize",dojo.hitch(this,this._onResize)),this._map.on("reposition",dojo.hitch(this,this._onReposition))}return e.prototype.setInitialExtent=function(e){var t=this;this._map&&this._map.loaded?this._setInitialExtentImpl(e):this._map.on("load",function(){return t._setInitialExtentImpl(e)})},e.prototype._setInitialExtentImpl=function(e){this._initialExtent=e;var t=esri.config.defaults.map.panDuration;esri.config.defaults.map.panDuration=0,this._map.reposition(),this._map.setExtent(e,this._fitTiledMapsToExtent),esri.config.defaults.map.panDuration=t,this._firstMapResizeExecuted=!0},e.prototype._setInitialExtentImplWithPromise=function(e){var t=this;return new Promise(function(i,r){t._map.setExtent(e).then(function(){i()},function(){i()})})},e.prototype._onResize=function(e,t,i){if(!this._firstMapResizeExecuted)return this._firstMapResizeExecuted=!0,void this.firstResize();this._handleNextExtentChange()},e.prototype._onReposition=function(e,t){this._handleNextExtentChange()},e.prototype._onExtentChange=function(){this._extentChangeInProgress&&(this._currentExtentChangePriority=-1,this._extentChangeInProgress=!1,this._handleNextExtentChange())},e.prototype.registerLayer=function(e){this._hasLoaded()||this._newLayers.push(e)},e.prototype.firstResize=function(){this._initialExtent&&this._map.extent&&!this._fitTiledMapsToExtent&&!this._map.extent.expand(1.75).contains(this._initialExtent)&&console.log("The 'fitTiledMapsToExtent' parameter may need to be set to true in configuration for the initial extent to be shown completely on the map."),this._handleNextExtentChange()},e.prototype._handleNextExtentChange=function(){if(this._hasLoaded())if(null!==this._queuedExtentChange[i.RESIZE]&&void 0!==this._queuedExtentChange[i.RESIZE]){var e=this._queuedExtentChange[i.RESIZE];this._queuedExtentChange[i.RESIZE]=null,e(this._map)}else if(null!==this._queuedExtentChange[i.REPOSITION]&&void 0!==this._queuedExtentChange[i.REPOSITION]){var t=this._queuedExtentChange[i.REPOSITION];this._queuedExtentChange[i.REPOSITION]=null,t(this._map)}else if(null!==this._queuedExtentChange[i.EXTENT_CHANGE]&&void 0!==this._queuedExtentChange[i.EXTENT_CHANGE]){this._extentChangeInProgress=!0,this._currentExtentChangePriority=this._queuedExtentChangePriority,this._queuedExtentChangePriority=-1;var r=this._queuedExtentChange[i.EXTENT_CHANGE];this._queuedExtentChange[i.EXTENT_CHANGE]=null,r(this._map)}},e.prototype.changeExtentWithPriority=function(e,t){var r=this,n=void 0!==t?t:5,s=function(t){null!==r.currentExtentChangeHandle&&r.currentExtentChangeHandle.cancel(),r.currentExtentChangeHandle=e(t),r.currentExtentChangeHandle.then(dojo.hitch(r,r._onExtentChange),dojo.hitch(r,r._onExtentChange))};if(this._isExtentChangeBlocked()){if(n=r||Math.abs(i.y-e.y)>=n)?new Promise(function(i,r){t.centerAt(e).finally(i())}):Promise.resolve()},t)},e.prototype.setScaleWithPriority=function(e,t){this.changeExtentWithPriority(function(t){return e!==t.getScale()?new Promise(function(i,r){t.setScale(e).finally(i())}):Promise.resolve()},t)},e.prototype.blockForResize=function(e,t,r){e===this._map.width&&t===this._map.height||(this._isResizeBlocked()?this._queuedExtentChange[i.RESIZE]=function(e){e.position.update(0,0),e.resize(r)}:(this._map.position.update(0,0),this._map.resize(r)))},e.prototype.blockForReposition=function(){this._isRepositionBlocked()?this._queuedExtentChange[i.REPOSITION]=function(e){e.position.update(0,0),e.resize()}:(this._map.position.update(0,0),this._map.resize())},e.prototype._isExtentChangeBlocked=function(){return null!=this._queuedExtentChange[i.REPOSITION]||null!=this._queuedExtentChange[i.RESIZE]||!this._hasLoaded()},e.prototype._isRepositionBlocked=function(){return this._extentChangeInProgress||!this._hasLoaded()},e.prototype._isResizeBlocked=function(){return this._isRepositionBlocked()},e.prototype._hasLoaded=function(){return this._map&&this._map.loaded&&this._firstMapResizeExecuted},e}();t.ExtentManager=n})},"geocortex/essentials/FeatureCluster":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/FeatureHeatMap":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/FeatureHyperlink":function(){define(["require","exports","./RestHelper"],function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){this.encodeUriReplacementValues=e.encodeUriReplacementValues,this.target=e.target,this.text=e.text,this.toolTip=e.toolTip;var r=null;t&&t.mapService&&t.mapService.essentialsMap&&(r=t.mapService.essentialsMap.site),this.uri=i.RestHelper.processClientSideTokens(r,e.uri),this.iconUri=i.RestHelper.processClientSideTokens(r,e.iconUri),this.layer=t};t.FeatureHyperlink=r})},"geocortex/essentials/FeatureLayerService":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./MapService","./../geocortex","./RestHelperHTTPService"],function(e,i,r,n,s){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var a=function(e){function i(t){var i=e.call(this,t)||this;return i.color=[255,0,0],i.selectionColor=[0,255,255],i.disableClientCaching=!1,i.onDemandCacheSize=1e3,i.outFields="",i.queryMode=esri.layers.FeatureLayer.MODE_ONDEMAND,i.tileHeight=null,i.tileWidth=null,i.where=null,i.canUpdate=null,i.canAdd=null,i.canDelete=null,i.canEdit=null,i.canAddAttachments=null,i.moveEnabled=null,i.rotateEnabled=null,i.editVerticesEnabled=null,i.scaleEnabled=null,i.renderer=null,i._colorSet=!1,i._initialFeatureCollection=null,i._serviceLayer=null,i.serviceUrl=t,i}return t(i,e),i.prototype.getEmptyFeatureCollection=function(){return JSON.parse(this._initialFeatureCollection)},i.prototype.restoreFeatureLayer=function(){if(!this._serviceLayer._mode)switch(this._serviceLayer.mode){case esri.layers.FeatureLayer.MODE_SNAPSHOT:this._serviceLayer._mode=new esri.layers._SnapshotMode(this._serviceLayer);break;case esri.layers.FeatureLayer.MODE_ONDEMAND:this._serviceLayer._mode=new esri.layers._OnDemandMode(this._serviceLayer);break;case esri.layers.FeatureLayer.MODE_SELECTION:this._serviceLayer._mode=new esri.layers._SelectionMode(this._serviceLayer)}this.replaceFeatureLayer(this._serviceLayer,!0,!0,!0),this.serviceLayer.resume(),this.serviceLayer.mode===esri.layers.FeatureLayer.MODE_SNAPSHOT&&0===this.serviceLayer.graphics.length&&this.serviceLayer.refresh()},i.prototype.replaceFeatureLayer=function(e,t,i,r){var n=this.serviceLayer;if(!e)throw new Error("featureLayer cannot be null in order to replace the feature layer.");var s=this._getEsriMap();if(!s)throw new Error("Unable to get access to the Esri map object to perform the Feature Layer replace.");if(!this.serviceLayer)throw new Error("ServiceLayer not present. Can't replace the the FeatureLayer");t&&(e.visible=n.visible,e.setMaxScale(n.maxScale),e.setMinScale(n.minScale)),i&&(e.opacity=n.opacity),r&&e.setRenderer(n.renderer);var a=dojo.indexOf(s.graphicsLayerIds,n.id);this.serviceLayer=e,n.suspend(),s.removeLayer(n),s.addLayer(e,a),n.url||this._cleanUpLayer(n)},i.prototype._cleanUpLayer=function(e){if(e.clear(),e._essentialsMetadata){var t=e._essentialsMetadata.eventHandlers,i=0;for(i=0;i3&&(this.color[3]=this.color[3]/255)),this.editVerticesEnabled=!e.hasOwnProperty("editVerticesEnabled")||e.editVerticesEnabled,this.moveEnabled=!e.hasOwnProperty("moveEnabled")||e.moveEnabled,this.scaleEnabled=!e.hasOwnProperty("scaleEnabled")||e.scaleEnabled,this.rotateEnabled=!e.hasOwnProperty("rotateEnabled")||e.rotateEnabled,e.renderer)try{this.renderer=esri.renderer.fromJson(e.renderer)}catch(e){}},i.prototype._updateServiceToken=function(t){if(e.prototype._updateServiceToken.call(this,t),this.serviceLayer){var i=this.serviceLayer._task;i&&i._url&&i._url.query&&(i._url.query.token=t)}},i.prototype._createServiceLayer=function(){e.prototype._createServiceLayer.call(this);var t=this.serviceUrl;this.serviceToken&&(t=s.RestHelperHTTPService.appendTokenToUrl(t,this.serviceToken));var i={};i.id=this.id,i.opacity=this.configuredOpacity,i.visible=this._computeInitServiceLayerVisibility(),this.outFields&&this.outFields.length>0&&(i.outFields=this.outFields.split(",")),null!==this.queryMode&&(i.mode=this.queryMode),null!==this.tileHeight&&null!==this.tileWidth&&this.queryMode==esri.layers.FeatureLayer.MODE_ONDEMAND&&(i.tileHeight=this.tileHeight,i.tileWidth=this.tileWidth),this.serviceLayer=new esri.layers.FeatureLayer(t,i),this.serviceLayer.setRenderer(this.renderer),this.attributionDataUrl&&""!==this.attributionDataUrl?(this.serviceLayer.attributionDataUrl=this.attributionDataUrl,this.serviceLayer.hasAttributionData=!0):this.hasAttributionData&&(this.serviceLayer.attributionDataUrl=this.url+"/Attribution",this.serviceLayer.hasAttributionData=!0),this._serviceLayer=this.serviceLayer,this.where&&this.serviceLayer.setDefinitionExpression(this.where),dojo.connect(this.serviceLayer,"onError",this,this._layerLoadErrorHandler),this.serviceLayer.loaded?this._handleLayerLoadEvent(this.serviceLayer):dojo.connect(this.serviceLayer,"onLoad",dojo.hitch(this,this._handleLayerLoadEvent)),e.prototype.initiateServiceFailureTimer.call(this)},i.prototype._computeInitServiceLayerVisibility=function(){var e=this._initiallyVisible;return e&&this.layers&&1===this.layers.length&&(e=this.layers[0].isVisible()),e},i.prototype._handleLayerLoadEvent=function(e){if(this.serviceLayer.version<10||this._colorSet){var t=null;if("esriGeometryPoint"==this.serviceLayer.geometryType){t=new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE,15,null,new esri.Color(this.selectionColor));var i=new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE,15,null,new esri.Color(this.color)),r=new esri.renderer.SimpleRenderer(i);this.serviceLayer.setRenderer(r)}else if("esriGeometryPolyline"==this.serviceLayer.geometryType){t=new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new esri.Color(this.selectionColor),1);var n=new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new esri.Color(this.color),1),s=new esri.renderer.SimpleRenderer(n);this.serviceLayer.setRenderer(s)}else if("esriGeometryPolygon"==this.serviceLayer.geometryType){t=new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new esri.Color([0,0,0]),1),new esri.Color(this.selectionColor));var a=new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new esri.Color([0,0,0]),1),new esri.Color(this.color)),o=new esri.renderer.SimpleRenderer(a);this.serviceLayer.setRenderer(o)}this.serviceLayer.setSelectionSymbol(t)}var l=this.serviceLayer.getEditCapabilities();this.canUpdate=l.canUpdate,this.canAdd=l.canCreate,this.canDelete=l.canDelete,this.canEdit=this.serviceLayer.isEditable(),this.canAddAttachments=!1,this.serviceLayer.capabilities&&(this.canAddAttachments=this.serviceLayer.version&&this.serviceLayer.version>=10.1&&this.serviceLayer.hasAttachments&&this.canEdit),this._initialFeatureCollection=JSON.stringify(this.serviceLayer.toJson()),this._handleServiceLayerLoaded(e)},i.prototype.hasOriginRelationships=function(){if(this.serviceLayer&&this.serviceLayer.version>=10.1&&this.serviceLayer.relationships&&this.serviceLayer.relationships.length>0){for(var e=0;e0?this.layers[0]._getRelation(e):null},i}(r.MapService);i.FeatureLayerService=a})},"geocortex/essentials/Field":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){};i.esriFieldTypeSmallInteger="esriFieldTypeSmallInteger",i.esriFieldTypeInteger="esriFieldTypeInteger",i.esriFieldTypeSingle="esriFieldTypeSingle",i.esriFieldTypeDouble="esriFieldTypeDouble",i.esriFieldTypeString="esriFieldTypeString",i.esriFieldTypeDate="esriFieldTypeDate",i.esriFieldTypeOID="esriFieldTypeOID",i.esriFieldTypeGeometry="esriFieldTypeGeometry",i.esriFieldTypeBlob="esriFieldTypeBlob",i.esriFieldTypeRaster="esriFieldTypeRaster",i.esriFieldTypeGUID="esriFieldTypeGUID",i.esriFieldTypeGlobalID="esriFieldTypeGlobalID",i.esriFieldTypeXML="esriFieldTypeXML",t.EsriFieldTypes=i;var r=function(){};r.essentialsFieldTypeSmallInteger="Int16",r.essentialsFieldTypeInteger="Int32",r.essentialsFieldTypeSingle="Single",r.essentialsFieldTypeDouble="Double",r.essentialsFieldTypeString="String",r.essentialsFieldTypeDate="DateTime",r.essentialsFieldTypeGUID="Guid",r.essentialsFieldTypeObject="Object",t.EssentialsFieldTypes=r;var n=function(){function e(e){if(this.layer=null,!e||!e.layer)throw new Error("Layer is required.");this.layer=e.layer,this.alias=e.alias,this.dataType=e.dataType,this.displayName=e.displayName,this.focusField=!!e.focusField,this.hyperlinkLabel=e.hyperlinkLabel,this.name=e.name,this.searchable=!!e.searchable,this.visible=!!e.visible,this.editable=null===e.editable||void 0===e.editable||e.editable,this.format=e.format}return e.prototype.toJson=function(){return{alias:this.alias,dataType:this.dataType,displayName:this.displayName,focusField:this.focusField,hyperlinkLabel:this.hyperlinkLabel,name:this.name,searchable:this.searchable,visible:this.visible,editable:this.editable,format:this.format}},e.convertFromEsriType=function(e){if(!e||0!==e.indexOf("esriFieldType"))return e;switch(e){case i.esriFieldTypeGeometry:case i.esriFieldTypeBlob:case i.esriFieldTypeRaster:return r.essentialsFieldTypeObject;case i.esriFieldTypeDate:return r.essentialsFieldTypeDate;case i.esriFieldTypeDouble:return r.essentialsFieldTypeDouble;case i.esriFieldTypeGlobalID:return r.essentialsFieldTypeGUID;case i.esriFieldTypeInteger:case i.esriFieldTypeOID:return r.essentialsFieldTypeInteger;case i.esriFieldTypeSingle:return r.essentialsFieldTypeSingle;case i.esriFieldTypeSmallInteger:return r.essentialsFieldTypeSmallInteger;case i.esriFieldTypeGUID:case i.esriFieldTypeString:case i.esriFieldTypeXML:default:return r.essentialsFieldTypeString}},e.convertToEsriFieldType=function(e){switch(e){case r.essentialsFieldTypeObject:return i.esriFieldTypeBlob;case r.essentialsFieldTypeDate:return i.esriFieldTypeDate;case r.essentialsFieldTypeDouble:return i.esriFieldTypeDouble;case r.essentialsFieldTypeGUID:return i.esriFieldTypeGlobalID;case r.essentialsFieldTypeInteger:return i.esriFieldTypeInteger;case r.essentialsFieldTypeSingle:return i.esriFieldTypeSingle;case r.essentialsFieldTypeSmallInteger:return i.esriFieldTypeSmallInteger;case r.essentialsFieldTypeString:default:return i.esriFieldTypeString}},e}();t.Field=n})},"geocortex/essentials/GeocodingEndpoint":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./../geocortex","./AsyncInitializable","./ServiceHelper"],function(e,i,r,n,s){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var a,o,l=function(e){function i(t){var i=e.call(this,t)||this;return i.bingProperties=null,i.displayName=null,i.extensions=[],i.id=null,i.properties={},i.geocoderType=null,i.geocoderUrl=null,i.geocoderToken=null,i.includeInGlobalSearch=!1,i.iconUri=null,i.featureZoomScale=null,i.isDefaultReverseGeocoder=!1,i.site=null,i.parameters=[],i.globalSearchKey=null,i.isDefaultBatchGeocoder=!1,i}return t(i,e),i.prototype._configureObject=function(e){if(!(e.hasOwnProperty("id")&&e.hasOwnProperty("displayName")&&e.hasOwnProperty("serviceType")&&e.hasOwnProperty("connectionString")&&e.hasOwnProperty("globalSearchKey")&&e.hasOwnProperty("parameters")))throw new Error("Incorrect geocoding endpoint object returned from initialization");this.id=e.id,this.displayName=e.displayName,this.iconUri=e.iconUri,this.featureZoomScale=e.featureZoomScale,this.geocoderType=e.serviceType,this.includeInGlobalSearch=e.includeInGlobalSearch,this.isDefaultReverseGeocoder=e.isDefaultReverseGeocoder,this.globalSearchKey=e.globalSearchKey,this.isDefaultBatchGeocoder=e.isDefaultBatchGeocoder,this._processConnectionString(e.connectionString),this.properties=r._getProperties(e.properties),this.extensions=r._getExtensions(e.extensions),this.parameters=e.parameters},i.prototype._processConnectionString=function(e){var t=s.ServiceHelper.extractConnectionStringValue;if(this.geocoderType===a.BING_GEOCODER){this.bingProperties={};var i=t(e,"key");i&&i.length>0&&(this.bingProperties.bingMapsKey=i),(i=t(e,"culture"))&&i.length>0&&(this.bingProperties.culture=i)}else if(this.geocoderType===a.ARCGIS_GEOCODER){var r=t(e,"url");r&&r.length>0&&(this.geocoderUrl=r),this.geocoderToken=t(e,"token")}else console.error("Unknown geocoder type '"+this.geocoderType+"'")},i}(n.AsyncInitializable);i.GeocodingEndpoint=l,(o=a=i.GeocodingEndpointType||(i.GeocodingEndpointType={})).ARCGIS_GEOCODER="ArcGisGeocoder",o.BING_GEOCODER="BingGeocoder"})},"geocortex/essentials/GeometryEndpoint":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./AsyncInitializable","./../geocortex","./ServiceHelper"],function(e,i,r,n,s){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var a,o=function(e){function i(t){var i=e.call(this,t)||this;return i.displayName=null,i.extensions=[],i.id=null,i.properties={},i.geometryServiceType=null,i.geometryServiceUrl=null,i.geometryServiceToken=null,i.site=null,i}return t(i,e),i.prototype._configureObject=function(e){if(void 0===e.id||void 0===e.displayName||void 0===e.connectionString)throw new Error("Incorrect geometry endpoint object returned from initialization");this.id=e.id,this.displayName=e.displayName,this.geometryServiceType=e.serviceType,this._processConnectionString(e.connectionString),this.properties=n._getProperties(e.properties),this.extensions=n._getExtensions(e.extensions)},i.prototype._processConnectionString=function(e){var t=s.ServiceHelper.extractConnectionStringValue;if(this.geometryServiceType===a.ARCGIS_GEOMETRY){var i=t(e,"url");i&&i.length>0&&(this.geometryServiceUrl=i),this.geometryServiceToken=t(e,"token")}else console.error("Unknown geometry service type '"+this.geometryServiceType+"'")},i}(r.AsyncInitializable);i.GeometryEndpoint=o,(a=i.GeometryEndpointType||(i.GeometryEndpointType={})).ARCGIS_GEOMETRY="ArcGisGeometry"})},"geocortex/essentials/GeometryUtilities":function(){define(["require","exports"],function(e,t){"use strict";function i(e,t,i){return null==e||null==t?i:!!(e.isWebMercator&&t.isWebMercator&&e.isWebMercator()&&t.isWebMercator())||e.wkid===t.wkid&&(e.wkid>0||e.wkt.toLowerCase()==t.wkt.toLowerCase())}function r(e){var t=e.rings[0][0],i=e.rings[0][1],r=null,n=e.rings[0].slice(2,e.rings[0].length);n.push(t);for(var s=0;s0&&!0===r||o<0&&!1===r)return!1;r=o>0,t=i,i=a}return!0}function n(e,t,i){return i||(i=[0,0]),(e[0]-i[0])*(t[1]-i[1])-(e[1]-i[1])*(t[0]-i[0])}Object.defineProperty(t,"__esModule",{value:!0}),t.spatialRefsAreEqual=i,t.envelopesAreEqual=function(e,t){return null==e||null==t?null==e&&null==t:i(e.spatialReference,t.spatialReference)&&e.xmin==t.xmin&&e.ymin==t.ymin&&e.xmax==t.xmax&&e.ymax==t.ymax},t.getExtent=function(e){if(e.length)var t=new esri.geometry.Extent(Number.MAX_VALUE,Number.MAX_VALUE,Number.MIN_VALUE,Number.MIN_VALUE,e[0].spatialReference);for(var i=0;i0)return!0;i=s,s=o}return!1}for(var l=0,u=0;u0},t.isSelfIntersectingPolygon=function(e){if(esri.geometry.polygonSelfIntersecting)return esri.geometry.polygonSelfIntersecting(e);if(e.isSelfIntersecting)return e.isSelfIntersecting(e);throw new Error("No self intersection method found")},t.isConvex=r,t.pointInEnvelope=function(e,t){if(!this.spatialRefsAreEqual(e.spatialReference,t.spatialReference,!0))throw new Error("Mismatched spatial references.");return!(e.xt.xmax||e.yt.ymax)},t.clipEnvelope=function(e,t){if(!this.spatialRefsAreEqual(e.spatialReference,t.spatialReference,!0))throw new Error("Mismatched spatial references.");var i=new esri.geometry.Extent(e.xmin,e.ymin,e.xmax,e.ymax,e.spatialReference),r=function(e,t,i){return ei?i:e};return i.xmin=r(e.xmin,t.xmin,t.xmax),i.xmin=r(e.ymin,t.ymin,t.ymax),i.xmin=r(e.xmax,t.xmin,t.xmax),i.xmin=r(e.ymax,t.ymin,t.ymax),i},t.scaleEnvelope=function(e,t,i){return new esri.geometry.Extent(e.xmin*t,e.ymin*i,e.xmax*t,e.ymax*i,e.spatialReference)},t.scaleEnvelopeWithoutTranslation=function(e,t){if(null==e)return null;var i=e.getCenter();return new esri.geometry.Extent(i.x-e.getWidth()*(t/2),i.y-e.getHeight()*(t/2),i.x+e.getWidth()*(t/2),i.y+e.getHeight()*(t/2),e.spatialReference)},t.computeDistance=function(e,t){var i=t.x-e.x,r=t.y-e.y;return Math.sqrt(i*i+r*r)},t.translateEnvelope=function(e,t,i){return new esri.geometry.Extent(e.xmin+t,e.ymin+i,e.xmax+t,e.ymax+i,e.spatialReference)},t.length=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},t.normalize=function(e){var t=this.length(e);return new esri.geometry.Point(e.x/t,e.y/t)},t.angle=function(e,t){if(!this.spatialRefsAreEqual(e.spatialReference,t.spatialReference,!0))throw new Error("Mismatched spatial references");return Math.acos(this.dotProduct(e,t)/Math.sqrt(this.dotProduct(e,e)*this.dotProduct(t,t)))},t.crossProduct=function(e,t,i){if(!this.spatialRefsAreEqual(e.spatialReference,t.spatialReference,!0))throw new Error("Mismatched spatial references");return i||(i=new esri.geometry.Point(0,0)),(e.x-i.x)*(t.y-i.y)-(e.y-i.y)*(t.x-i.x)},t.crossProductArray=n,t.dotProduct=function(e,t){if(!this.spatialRefsAreEqual(e.spatialReference,t.spatialReference,!0))throw new Error("Mismatched spatial references");return e.x*t.x+e.y*t.y},t.polygonMidpoint=function(e){if(0==e.length)throw new Error("Expected at least one point in polygonMidPoint.");for(var t=0,i=0,r=0;r0&&(this.geoprocessorUrl=i)},i}(r.AsyncInitializable);i.GeoprocessingEndpoint=o,(a=i.GeoprocessingEndpointType||(i.GeoprocessingEndpointType={})).ARCGIS_GEOPROCESSOR="ArcGisGeoprocessor"})},"geocortex/essentials/GeoRssLayerService":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./MapService","./RestHelper","./XmlUtils","./RestHelperHTTPService"],function(e,i,r,n,s,a){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=function(e){function i(t){var i=e.call(this,t)||this;return i._colorSet=!1,i._layerLoadCompleted=null,i.color=null,i.feedUrl=null,i.feedImageUri=null,i.updateInterval=null,i.pictureSymbol=null,i.markerSymbol=null,i.geoRssLayer=null,i.mapSpatialReference=null,i.geometryService=null,i}return t(i,e),i.prototype._configureObject=function(t,r){if(void 0===t)throw new Error("Incorrect map service object returned from initialization");i.webMercatorSref=new esri.SpatialReference({wkid:102100}),i.wgs84Sref=new esri.SpatialReference({wkid:4326}),this.feedImageUri=t.feedImageUri,this.updateInterval=t.updateInterval,this.geoRssLayer=new esri.layers.GraphicsLayer({opacity:t.opacity,id:t.id,visible:t.visible}),dojo.connect(this.geoRssLayer,"onError",this,this._layerLoadErrorHandler),t.color&&(this.color=t.color,this._colorSet=!0,this.color.length>3&&(this.color[3]=this.color[3]/255)),e.prototype._configureObject.call(this,t,r),this.attributionDataUrl&&""!==this.attributionDataUrl?(this.geoRssLayer.attributionDataUrl=this.attributionDataUrl,this.geoRssLayer.hasAttributionData=!0):this.hasAttributionData&&(this.geoRssLayer.attributionDataUrl=this.url+"/Attribution",this.geoRssLayer.hasAttributionData=!0)},i.prototype._createServiceLayer=function(){var e=this,t=null;if(this.essentialsMap&&(t=this.essentialsMap.site,this.mapSpatialReference=this.essentialsMap.initialExtent.spatialReference),this.feedImageUri?(this.feedImageUri=n.RestHelper.processClientSideTokens(t,this.feedImageUri),this.pictureSymbol=new esri.symbol.PictureMarkerSymbol(this.feedImageUri,25,25)):this.markerSymbol=new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE,15,new esri.symbol.SimpleLineSymbol,new esri.Color(this.color)),this.feedUrl=this.serviceUrl,this._loadFeed(),this.updateInterval&&!isNaN(this.updateInterval)){this._layerLoadCompleted=!1;var i=setInterval(function(){e._layerLoadCompleted&&e._loadFeed(),e._layerLoadCompleted=!1},1e3*this.updateInterval);dojo.connect(window,"onunload",function(){clearInterval(i)})}this.serviceLayer=this.geoRssLayer},i.prototype._loadFeed=function(){esri.config.defaults.io.proxyUrl&&esri.request({url:this.serviceUrl,content:{},handleAs:"xml",load:dojo.hitch(this,this._handleFeed),error:function(e){e&&e.message&&"string"==typeof e.message&&alert(e.message)}})},i.prototype._handleFeed=function(e){var t="http://www.georss.org/georss",i=this._getFeedRoot(e);if(i){var r=i.nodeName,n=s.getAttribute(i,"xml:base"),a=[],o=null;if("feed"===r?o=s.getNodes("feed","entry",e):"rdf"===r?o=s.getNodes("rdf","item",e):"rss"===r&&(o=s.getNodes("channel","item",e)),o){var l=this.pictureSymbol||this.markerSymbol;o.forEach(dojo.hitch(this,function(e,i,o){var u,c,p,h=null;if(s.getAllNodes(e).forEach(dojo.hitch(this,function(e,i,a){e.nodeName&&("title"===e.nodeName&&(u=e.firstChild.nodeValue),"feed"===r?"summary"===e.nodeName&&(p=e.firstChild.nodeValue):"description"===e.nodeName&&(p=e.firstChild.nodeValue),"link"===e.nodeName&&(c="feed"===r?(n||"")+s.getAttribute(e,"href"):(n||"")+e.firstChild.nodeValue),("georss:where"===e.nodeName||"where"===e.nodeName&&e.namespaceURI===t)&&(h=this._getGMLGRSSPoint(e)),("georss:point"===e.nodeName||"point"===e.nodeName&&e.namespaceURI===t)&&(h=this._getSimpleGRSSPoint(e)),("geo:lat"===e.nodeName||"lat"===e.nodeName&&"http://www.w3.org/2003/01/geo/wgs84_pos#"===e.namespaceURI)&&(h=this._getW3CGRSSPoint(e)))})),h){var d={title:u,content:p,link:c};a.push(new esri.Graphic(h,l,d,null))}})),this.mapSpatialReference&&this._projectShapes(a,this.mapSpatialReference)}}},i.prototype._projectShapes=function(e,t){if(e&&t){for(var r=!1,n=i.webMercatorSref.wkid,s=i.wgs84Sref.wkid,o=0;o=0;a--){var o=t.fields[a];"gml:id"===o.name&&t.fields.splice(a,1),o.type=Field_1.Field.convertToEsriFieldType(r[a].dataType)}i(t)}),s=t.on("error",function(e){n.remove(),s.remove(),r(e)})})}return this._featureLayerPromise},Layer.prototype.getRelatedFeatureLayer=function(e,t,i){var r=new dojo.Deferred,n=function(e){geocortex_1.deferredResolve(r,e),"function"==typeof t&&t(e)},s=this._getRelation(e),a=this.getLayerUrl();if(!s||!a){var o=new Error("getRelatedFeatureLayer - Relation not found for: "+e+" or layerUrl is null");return r&&-1==r.fired&&r.resolve(o),"function"==typeof i&&i(o),r}var l=a.substring(0,a.lastIndexOf("/")+1)+s.relatedTableId;this.mapService&&this.mapService.serviceToken&&(l=RestHelperHTTPService_1.RestHelperHTTPService.appendTokenToUrl(l,this.mapService.serviceToken)),void 0===esri.getProxyRule(l)&&null!==this.mapService.proxyUrl&&esri.addProxyRule({urlPrefix:l,proxyUrl:this.mapService.proxyUrl});var u=new esri.layers.FeatureLayer(l,{mode:esri.layers.FeatureLayer.MODE_SELECTION,outFields:["*"]});return u.loaded?n(u):dojo.connect(u,"onLoad",dojo.hitch(this,n)),dojo.connect(u,"onError",dojo.hitch(this,function(e){r&&-1==r.fired&&r.resolve(e),"function"==typeof i&&i(e)})),r},Layer.prototype.areAllAncestorsVisible=function(){for(var e=this.mapService.findLayerById(this.parentLayerId);null!==e&&void 0!==e;){if(!e.isVisible())return!1;e=this.mapService.findLayerById(e.parentLayerId)}return!0},Layer.prototype.getLayerUrl=function(){if(this.mapService&&this.mapService.serviceUrl){if("FeatureLayer"===this.mapService.drawingBehavior)return this.mapService.serviceUrl;if(this.mapService.mapServiceType===MapServiceConstants_1.MapServiceType.WMS||this.mapService.mapServiceType===MapServiceConstants_1.MapServiceType.WFS){if(this.mapService.userLayerType===MapServiceConstants_1.UserLayerType.LAYER_ADDITION)return null;var e=this.mapService.url+"/layers/"+this.id,t=RestHelperHTTPService_1.RestHelperHTTPService.getTokenForScope(this.mapService.url);return t&&(e=RestHelperHTTPService_1.RestHelperHTTPService.appendTokenToUrl(e,t)),e}return this.mapService.serviceUrl+"/"+this.id}return null},Layer.prototype.getFieldByName=function(e){if(this.fields&&this.fields.length>0){if(!this._fieldLookup){this._fieldLookup={};for(var t=0;t0){var t=Math.max.apply(null,e);return(++t).toString()}}return"0"},Layer.prototype.createFromDefinition=function(e){this._createFrom(e)},Layer.prototype._createFrom=function(e){if(this.defaultVisibility=e.defaultVisibility,this.configuredVisible=e.visible,this.displayName=e.displayName||e.name,this.description=e.description,this.featureDescription=e.featureDescription,e.hasOwnProperty("featureLongDescription")?this.featureLongDescription=e.featureLongDescription:this.featureLongDescription=e.featureDescription,this.featureLabel=e.featureLabel,this.featureType=e.featureType,this.featureZoomScale=e.featureZoomScale,this.featureZoomFactor=e.featureZoomFactor,this.hasDataLinks=e.hasDataLinks,this.hasReports=e.hasReports,this.hasAttachments=e.hasAttachments,e.hasOwnProperty("id")?this.id=e.id:this.id=this._getUniqueId(),this.name=e.name,e.nativeID&&(this.mapService&&this.mapService.mapServiceType===MapServiceConstants_1.MapServiceType.WFS?this.wfsLayerName=e.nativeID:this.wmsLayerName=e.nativeID),this.parentLayerId=e.parentLayerId,this.subLayerIds=e.subLayerIds,this._visible=e.visible,this.styleName=e.styleName,this.legendUrl=e.legendUrl,this.isUserCreated=void 0==e.isUserCreated?this.isUserCreated:e.isUserCreated,this.userLayerType=void 0==e.userLayerType?this.userLayerType:e.userLayerType,this.isDynamic=e.isDynamic,this.dynamicDefinition=e.dynamicDefinition,this.dataProvider=e.dataProvider,this.defaultDateFormat=e.defaultDateFormat,this.defaultNumberFormat=e.defaultNumberFormat,this.timeZoneId=e.timeZoneId,e.fullExtent&&(this.fullExtent=new esri.geometry.Extent(e.fullExtent)),e.hasOwnProperty("drawIndex")&&(this.drawIndex=e.drawIndex),e.hasOwnProperty("identifiable")&&(this.identifiable=e.identifiable),e.hasOwnProperty("includeInLayerList")&&(this.includeInLayerList=e.includeInLayerList),e.hasOwnProperty("includeInLegend")&&(this.includeInLegend=e.includeInLegend),e.hasOwnProperty("featureBorderColor")&&(this.featureBorderColor=e.featureBorderColor,this.featureBorderColor&&this.featureBorderColor.length>=4&&this.featureBorderColor[3]>=1&&(this.featureBorderColor[3]/=255)),e.hasOwnProperty("featureBorderWidth")&&(this.featureBorderWidth=e.featureBorderWidth),e.hasOwnProperty("featureFillColor")&&(this.featureFillColor=e.featureFillColor,this.featureFillColor&&this.featureFillColor.length>=4&&this.featureFillColor[3]>=1&&(this.featureFillColor[3]/=255)),e.hasOwnProperty("minScale")&&!isNaN(e.minScale)&&0!=e.minScale?this.minScale=e.minScale:this.minScale=1/0,e.hasOwnProperty("maxScale")&&!isNaN(e.maxScale)?this.maxScale=e.maxScale:this.maxScale=0,this.mapService&&null!=this.mapService.minScale&&!isNaN(this.mapService.minScale)&&(this.minScale=Math.min(this.minScale,this.mapService.minScale)),this.mapService&&null!=this.mapService.maxScale&&!isNaN(this.mapService.maxScale)&&(this.maxScale=Math.max(this.maxScale,this.mapService.maxScale)),e.hasOwnProperty("queryable")&&(this.queryable=e.queryable),e.hasOwnProperty("searchable")&&(this.searchable=e.searchable),e.hasOwnProperty("snappable")&&(this.snappable=e.snappable),e.hasOwnProperty("snappingEnabled")&&(this.snappingEnabled=e.snappingEnabled),e.hasOwnProperty("showFeatureHyperlinks")&&(this.showFeatureHyperlinks=e.showFeatureHyperlinks),e.hasOwnProperty("canToggleLabels")&&(this.canToggleLabels=e.canToggleLabels),e.hasOwnProperty("showLabels")&&(this.showLabels=e.showLabels),e.hasOwnProperty("showMapTips")&&(this.showMapTips=e.showMapTips),e.hasOwnProperty("supportsIdentify")&&(this.supportsIdentify=e.supportsIdentify),e.hasOwnProperty("supportsQuery")&&(this.supportsQuery=e.supportsQuery),e.hasOwnProperty("layerHyperlinks"))for(t=0;t=4&&this.featureBorderColor[3]>=1&&(this.featureBorderColor[3]/=255)),results.hasOwnProperty("featureBorderWidth")&&(this.featureBorderWidth=results.featureBorderWidth),results.hasOwnProperty("featureFillColor")&&(this.featureFillColor=results.featureFillColor,this.featureFillColor&&this.featureFillColor.length>=4&&this.featureFillColor[3]>=1&&(this.featureFillColor[3]/=255)),results.hasOwnProperty("identifiable")&&(this.identifiable=results.identifiable),results.hasOwnProperty("includeInLegend")&&(this.includeInLegend=results.includeInLegend),results.hasOwnProperty("minScale")&&!isNaN(results.minScale)&&0!=results.minScale?this.minScale=results.minScale:this.minScale=1/0,results.hasOwnProperty("maxScale")&&!isNaN(results.maxScale)?this.maxScale=results.maxScale:this.maxScale=0,this.mapService&&null!=this.mapService.minScale&&!isNaN(this.mapService.minScale)&&(this.minScale=Math.min(this.minScale,this.mapService.minScale)),this.mapService&&null!=this.mapService.maxScale&&!isNaN(this.mapService.maxScale)&&(this.maxScale=Math.max(this.maxScale,this.mapService.maxScale)),results.hasOwnProperty("queryable")&&(this.queryable=results.queryable),results.hasOwnProperty("searchable")&&(this.searchable=results.searchable),results.hasOwnProperty("showFeatureHyperlinks")&&(this.showFeatureHyperlinks=results.showFeatureHyperlinks),results.hasOwnProperty("canToggleLabels")&&(this.canToggleLabels=results.canToggleLabels),results.hasOwnProperty("showLabels")&&(this.showLabels=results.showLabels),results.hasOwnProperty("showMapTips")&&(this.showMapTips=results.showMapTips),results.hasOwnProperty("snappable")&&(this.snappable=results.snappable),results.hasOwnProperty("snappingEnabled")&&(this.snappingEnabled=results.snappingEnabled),results.hasOwnProperty("supportsIdentify")&&(this.supportsIdentify=results.supportsIdentify),results.hasOwnProperty("supportsQuery")&&(this.supportsQuery=results.supportsQuery),void 0!==results.type&&(this.type=this._layerTypeStringToEssentialsLayerType(results.type)),this.type==LayerType_1.LayerType.GROUP_LAYER&&results.hasOwnProperty("isExpanded")&&(this.isExpanded=results.isExpanded),results.featureHyperlinks)for(i=0;i0&&(e.maxScale=this.maxScale)),e},Layer.prototype.getLayerDrawingOptions=function(){var e=null;return this.isDynamic&&(e=RestHelper_1.RestHelper.getLayerDrawingOptionsFromJson(this.dynamicDefinition)),e},Layer.prototype.getLayerThemeSettings=function(e){for(var t=0;t=4.02&&s.type===n.LayerType.GROUP_LAYER&&(t=!0);else if(1!==s.mapService.layers.length||!s.inActiveTheme||s.mapService.includeInLayerList)return}e.isUserCreated||e.setVisibility(t,i)},l=0;l0)for(var f=0;f0&&(this._deleteItemWithId(n[f],r),this._recursivelyUpdateSublayerVisibility(y,!0,r)),r.push({mapServiceId:this._mapService.id,layerId:n[f].toString(),visibility:!0}),y._syncProgramaticallyChangedLayerVisibility(!0),y.parentLayerId&&null!==y.parentLayerId&&void 0!==y.parentLayerId&&this._recursivelyUpdateAncestorVisibility(y,n,r))}return[e,t,r]},e.prototype.afterESRIsetVisibleLayers=function(e,t,i){i&&i.length>0&&dojo.publish("LayerVisibilityChange",new Array(i))},e.prototype._recursivelyUpdateAncestorVisibility=function(e,t,i){if(e&&e.parentLayerId&&null!==e.parentLayerId&&void 0!==e.parentLayerId){var r=this._mapService.findLayerById(e.parentLayerId);r.isVisible()||(this._deleteItemWithId(e.parentLayerId,i),r._syncProgramaticallyChangedLayerVisibility(!0),i.push({mapServiceId:this._mapService.id,layerId:e.parentLayerId.toString(),visibility:!0})),this._recursivelyUpdateAncestorVisibility(r,t,i)}},e.prototype._recursivelyUpdateSublayerVisibility=function(e,t,i){if(e.subLayerIds&&e.subLayerIds.length>0)for(var r=0;r0&&this._recursivelyUpdateSublayerVisibility(n,t,i)}},e.prototype._getAllCurrentlyVisibleLayers=function(){for(var e=[],t=0;t=0;i--){var r=this.mapServices[i].serviceLayer;t&&(r.suspend(),this._suspendedLayers.push(r));try{e.addLayer(r)}catch(e){this.site.onLayerLoadError(e),this.mapServices[i].initializationFailure=e}}this.setExtentOnLoad&&this.initialExtent&&this.extentManager.setInitialExtent(this.initialExtent),this.site&&dojo.isObject(this.site)&&(this.site.serviceLayersLoaded=!0,dojo.isFunction(this.site.onServiceLayersLoaded)&&this.site.onServiceLayersLoaded(this.site))},i.prototype.addServiceLayers=function(e,t){var i=this,r=this;if(e||e.length){for(var n=[],a=function(e){var i=null,a=!1,o=p.MapServiceType.FEATURE;switch(e.opacity=e.opacity||1,e.type){case"Feature Layer":i=new h.FeatureLayerService(e.url);break;default:switch(e.declaredClass){case"esri.layers.WebTiledLayer":i=new s.MapService(e.tileServers[0]),o=p.MapServiceType.WEBTILED,a=!0}}if(i){i.serviceLayer=e,i.essentialsMap=r;var l=e.layerId||d.alphaNumericToken(),u={id:l,isExpanded:!0,includeInLayerList:a,serviceFunction:t,serviceType:o,layerOptions:null};u.layerOptions={id:l,name:e.name,description:e.description,displayField:e.displayField,includeInLayerList:!0,identifiable:!0,fullExtent:e.fullExtent,primaryKeyField:e.objectIdField,visible:e.visible},i._createFrom(u),n.push(i),dojo.connect(e,"onClick",function(e){dojo.publish("FeatureClickedEvent",dojo.mixin(e,{layer:i.layers[0],useFeaturePresenter:!0}))})}},o=0;o0){dojo.forEach(c,function(e){e.name=e.name||u.name,a(e)});continue}}a(l)}this.mapServices=this.mapServices.concat(n),dojo.forEach(n,function(e){return i._addToFilteredView(e)}),this._addServiceLayers(this.getMap()),dojo.forEach(n,function(e){dojo.publish("MapServiceAddedEvent",e)})}},i.prototype.removeServiceLayer=function(e){if(e&&this.mapServices.length)for(var t=0;t=0&&(this.mapServices.splice(t,1),dojo.publish("MapServiceRemovedEvent",e)),this._esriMap&&e.serviceLayer&&this._esriMap.removeLayer(e.serviceLayer)}},i.prototype._configureMapServices=function(e,t){for(var i=0;e&&i0)return u.layers[0]}for(var i=function(e,t){var i=e.serviceUrl;return e.serviceToken&&t.search(/token=.[^&]*/g)>0&&(i=E.RestHelperHTTPService.appendTokenToUrl(i,e.serviceToken)),i},r=e.url.match(/.[^?]*/g)[0],n=0;n0)return u.layers[0];var s=new RegExp("[^/]*.$"),a=Number(r.match(s)),o=new RegExp("/[^/]*.$"),l=r.replace(o,"");for(n=0;n=a)return u.layers[a]}}return null}},i.prototype._exportRestComplete=function(e){var t=null;e?e.error&&(t=e.error):t=new Error("No results"),t&&this._onExportComplete&&this._onExportError(t),e&&this._onExportComplete&&this._onExportComplete(e)},i.prototype._exportRestError=function(e){this._onExportError&&this._onExportError(e)},i.prototype._layerLoadedUpdate=function(e){if(!this.serviceLayersAdded){for(var t=0;t0?this.layers[0].name:null,tileMatrixSet:this.tileMatrixSet,format:this._getEsriOgcImageFormat(),style:this.layers[0].styleName?this.layers[0].styleName:""}),x={serviceMode:"KVP",resourceInfo:s={version:this.serverVersion,layerInfos:[w],getTileUrl:this._prefixProxy(this.mapUrl)},layerInfo:w};if((T=new esri.layers.WMTSLayer(i,x)).id=this.id,this._applyAttributionUrl(T),T._url){var E=0,L=d.hasProxy()?2:1;T._url=T._url.replace(/\?/g,function(e){return++E<=L?"?":""})}dojo.connect(T,"onError",this,this._layerLoadErrorHandler),dojo.connect(T,"onLoad",dojo.hitch(this,this._handleServiceLayerLoaded)),this._initiallyVisible?T.show():T.hide(),this.serviceLayer=T;break;case n.MapServiceType.WEBTILED:var T=i.replace(/([^$])({[^}]*})/g,function(e,t,i){return t+"$"+i});E={copyright:this.copyright,id:this.id,subDomains:null,tileInfo:this._tileScheme?this.tileInfo:null};T.indexOf("${subDomain}")>=0&&(E.subDomains=this.subDomains),(L=new esri.layers.WebTiledLayer(T,E)).id=this.id,this._applyAttributionUrl(L),this._initiallyVisible?L.show():L.hide(),dojo.connect(L,"onError",this,this._layerLoadErrorHandler),dojo.connect(L,"onLoad",dojo.hitch(this,this._handleServiceLayerLoaded)),this.serviceLayer=L;break;case n.MapServiceType.VECTORTILE:var M=i;if(this._styleUrl&&(M=this._styleUrl,this.essentialsMap&&this.essentialsMap.site)){var D=this.essentialsMap.site.getTokenFromPrincipal(this._styleUrl,this.mapServiceType);D&&(M=f.RestHelperHTTPService.appendTokenToUrl(this._styleUrl,D))}e(["esri/layers/VectorTileLayer"],function(e){t._layerSecurityProxy&&t._addCredentialForLayer();var i=new e(M);i.id=t.id,i.loadError&&t._layerLoadErrorHandler(i.loadError),dojo.aspect.before(i,"_frame",dojo.hitch(i,function(){this._frameRequested&&this.spatialReference&&this._viewState&&!this._viewState.spatialReference&&(this._viewState.spatialReference=this.spatialReference)})),t._initiallyVisible?i.show():i.hide(),dojo.connect(i,"onError",t,t._layerLoadErrorHandler),dojo.connect(i,"onLoad",dojo.hitch(t,t._handleServiceLayerLoaded)),t._applyAttributionUrl(i),t.serviceLayer=i})}this.initiateServiceFailureTimer()}}},r.prototype.initiateServiceFailureTimer=function(){var e=this;this.failureTimeout&&!isNaN(this.failureTimeout)&&setTimeout(function(){e.serviceLayer&&(!e.serviceLayer||e.serviceLayer.loaded)||e.initializationFailure||(e.failureTimeoutThresholdExceeded=!0,e.onFailureTimeoutThresholdExceeded())},1e3*this.failureTimeout)},r.prototype._addCredentialForLayer=function(){var e=esri.id,t=this.findServiceToken(),i=e.credentials;if(t&&e&&i instanceof Array){for(var r=0;r0){var n=this._findWMSLayerName(r.subLayers,t);if(null!==n)return n}}return null},r.prototype._finishWmsLayerConfiguration=function(e){for(var t,i=[],r=0,n=0;n-1&&(r.setInActiveTheme(!1),this.layers.splice(u,1),dojo.publish("CatalogLayerRemovedEvent",r));var n=this.getVisibleLayers();if(null==i)throw"Could not convert Layer ID '"+e.id+"' into an integer!";var s=[];t.dynamicLayerInfos&&(s=dojo.clone(this.serviceLayer.dynamicLayerInfos));var a=[];if(t.layerDrawingOptions&&(a=this.serviceLayer.layerDrawingOptions),e.isDynamic){for(var o=null,l=0;l-1&&(s.splice(u,1),t.setDynamicLayerInfos(s,!0))}var c=[];for(var p in a)a.hasOwnProperty(p)&&p!==e.id&&(c[p]=dojo.clone(a[p]));this._removeDefinitionExpression(e,t),t.setLayerDrawingOptions(c)}n.indexOf(e.id)>-1&&n.splice(n.indexOf(e.id),1),this._syncLayerVisibilities(n)},r.prototype.add=function(e){if(!e)throw new Error("Expecting a layer");var t=this.serviceLayer;if(!(e.isDynamic&&t instanceof esri.layers.ArcGISDynamicMapServiceLayer))throw"MapService - add() - Unsupported layer type..";this.convertToDynamicLayers();var i=this.getVisibleLayers();e.mapService=this;var r=[];t.dynamicLayerInfos&&(r=t.dynamicLayerInfos);var n=[];t.layerDrawingOptions&&(n=t.layerDrawingOptions);var s,a,o=parseInt(e.id,10);if(null==o)throw"Could not convert Layer ID '"+e.id+"' into an integer!";(s=e._createDynamicLayerInfo()).name||(s.name=e.displayName),null!=s&&r.push(s),null!=(a=e.getLayerDrawingOptions())&&(n[o]=a),n.length>0&&t.setLayerDrawingOptions(n,!0),this._addDefinitionExpression(e,t),t.setDynamicLayerInfos(r),i.push(e.id),this._syncLayerVisibilities(i),this.layers.push(e),dojo.publish("CatalogLayerAddedEvent",e)},r.prototype.getDynamicLayerInfoById=function(e){var t=null;if(this.serviceLayer instanceof esri.layers.ArcGISDynamicMapServiceLayer){var i=parseInt(e,10);if(!isNaN(i)){var r=this.serviceLayer.dynamicLayerInfos;if(r)for(var n=0;n-1?this.layers[t].visibleStateForRefresh=y.RefreshVisibility.SHOW:this.layers[t].visibleStateForRefresh=y.RefreshVisibility.HIDE;0==e.length&&e.push("-1"),this.serviceLayer.setVisibleLayers(e)},r.prototype._handleDynamicLayers=function(e){var t=this;if(this.supportsDynamicLayers){var i=dojo.some(this.layers,function(e){return e.isDynamic}),r=dojo.some(this.layers,function(e){return null!=e.drawIndex}),n=dojo.some(this.layers,function(e){return e.canToggleLabels&&!e.showLabels});if(i||r||n||this.hasLayerCatalog){var s=this.essentialsMap.getMap();if(s&&(s.spatialReference&&(s.spatialReference.wkid&&!(s.spatialReference.wkid<=0)||s.spatialReference.wkt&&s.spatialReference.wkt.trim())||null!=e.spatialReference&&e.spatialReference.wkt&&e.spatialReference.wkt.trim()&&(s.spatialReference=e.spatialReference),s.extent&&(!s.extent.spatialReference||(!s.extent.spatialReference.wkid||s.extent.spatialReference.wkid<=0)&&(!s.extent.spatialReference.wkt||!s.extent.spatialReference.wkt.trim()))&&null!=e.spatialReference&&e.spatialReference.wkt&&e.spatialReference.wkt.trim())){var a=new esri.geometry.Extent(s.extent);a.spatialReference=e.spatialReference,this.essentialsMap.extentManager.setExtentWithPriority(a,2)}var o=this._createDynamicLayerInfos(e),l=[];if(e.layerDrawingOptions&&(l=dojo.mixin([],e.layerDrawingOptions)),n&&dojo.forEach(this.layers,function(e,t){if(e.canToggleLabels){var i=e.getLayerDrawingOptions();if(null==i){i=new esri.layers.LayerDrawingOptions;var r=parseInt(e.id,10);l[r]=i}i.showLabels=e.showLabels}}),dojo.forEach(this.layers,function(e,t){if(e.isDynamic){var i,r,n=parseInt(e.id,10);if(!n)throw"Could not convert Layer ID '"+e.id+"' into an integer!";(i=e._createDynamicLayerInfo()).name||(i.name=e.name),i&&o.splice(t,0,i),(r=e.getLayerDrawingOptions())&&(l[n]=r,null!=e.showLabels&&(r.showLabels=e.showLabels))}}),r){var u=dojo.clone(o),c=[];dojo.forEach(this.layers,function(e,t){null!=e&&null!=e.drawIndex&&c.push(e)}),c.sort(function(e,t){return e.drawIndex-t.drawIndex}),dojo.forEach(c,function(e,t){for(var i=null,r=null,n=0;n0&&e.setLayerDrawingOptions(l,!0),o.length>0&&e.setDynamicLayerInfos(o,!0);var i=t.getVisibleLayers();i.InternallyChangedLayer={},i.length>0?e.setVisibleLayers(i):(i.push("-1"),e.setVisibleLayers(i))},0)}}},r.prototype._createDynamicLayerInfos=function(e,t){void 0==t&&(t=!0);var i=null;if(null!=e&&(i=e.createDynamicLayerInfosFromLayerInfos(),t))for(var r=i.length-1;r>=0;r--){var n=this.findLayerById(i[r].id.toString());(null==n||n.isDynamic)&&i.splice(r,1)}return i},r.prototype._getAgsDynamicImageFormat=function(e){if(void 0===e||null===e||e.length<1)return"png8";var t=e.toLowerCase();switch(t){case"png":case"png8":case"png24":case"png32":case"jpeg":case"jpg":case"gif":case"bmp":case"svg":case"svgz":case"emf":case"ps":case"pdf":return t;default:return"png8"}},r.prototype._getAgsImageServiceImageFormat=function(e){if(void 0===e||null===e||e.length<1)return null;var t=e.toLowerCase();switch(t){case"jpgpng":case"png":case"png8":case"png24":case"png32":case"jpeg":case"jpg":case"gif":case"bmp":case"tiff":return t;default:return null}},r.prototype._getVisibleGroupLayersOfType=function(e,t,i,r){if(t[e])for(var n=0;n0?r=this._getVisibleGroupLayersOfType(e,s,i,r):dojo.indexOf(i,s.id)<0&&(i[r]=s.id,r++))}return r},r.prototype._getWMSLayerNameFromTitle=function(e){return this.serviceLayer instanceof esri.layers.WMSLayer?this._findWMSLayerName(this.serviceLayer.layerInfos,e):null},r.prototype._getPrincipalResult=function(e){if(this.essentialsMap&&this.essentialsMap.site&&this.essentialsMap.site.principal)return e(this.essentialsMap.site.principal)},r.prototype._processConnectionString=function(e,t){var i=m.ServiceHelper.extractConnectionStringValue;if(this.mapServiceType==n.MapServiceType.BING){var r;this.bingProperties={},(r=i(e,"mapStyle"))&&r.length>0&&(this.bingProperties.mapStyle=r),(r=i(e,"culture"))&&r.length>0&&(this.bingProperties.culture=r),(r=i(e,"key"))&&r.length>0&&(this.bingProperties.bingMapsKey=r)}else{var s=i(e,"url");if(s.length>0)this.serviceUrl=s.replace(/%3d/g,"=").replace(/%3D/g,"=").replace(/%3a/g,":").replace(/%3A/g,":");else if((this.mapServiceType===n.MapServiceType.DYNAMIC||this.mapServiceType===n.MapServiceType.TILED)&&this.essentialsMap.site.getEssentialsVersion()>=3.912||(this.mapServiceType===n.MapServiceType.FEATURE||this.mapServiceType===n.MapServiceType.IMAGE||this.mapServiceType===n.MapServiceType.STREAM||this.mapServiceType===n.MapServiceType.VECTORTILE)&&this.essentialsMap.site.getEssentialsVersion()>=4.01){if(this._layerSecurityProxy=!0,this.essentialsMap.site.getEssentialsVersion()<4.03)this.serviceUrl=this.url+"/MapServer";else{var a=this.essentialsMap.site.getEssentialsVersion()<4.05?"/GeoREST":"/rest/services/x";if(this.mapServiceType===n.MapServiceType.FEATURE){if(!(t&&t.layers&&t.layers.length>0&&t.layers[0]))throw new Error("Unable to configure FeatureLayer connection string. No child layer is specified.");this.serviceUrl=this.url+a+"/FeatureServer/"+t.layers[0].id}else this.mapServiceType===n.MapServiceType.IMAGE?this.serviceUrl=this.url+a+"/ImageServer":this.mapServiceType===n.MapServiceType.STREAM?this.serviceUrl=this.url+a+"/StreamServer":this.mapServiceType===n.MapServiceType.VECTORTILE?this.serviceUrl=this.url+a+"/VectorTileServer":this.serviceUrl=this.url+a+"/MapServer"}this._getPrincipalResult(function(e){return e.isAuthenticated})&&(this.serviceToken=this._getPrincipalResult(function(e){return e.tokens.site})),"3.912"===this.essentialsMap.site.currentVersion&&(this._needsProxy=!0)}var o=i(e,"geometryServiceUrl");o.length>0&&(this.geometryServiceUrl=o),this.mapServiceType===n.MapServiceType.VECTORTILE&&(this._styleUrl=i(e,"styleUrl")),this.mapServiceType===n.MapServiceType.WEBTILED&&(this._tileScheme=i(e,"tileScheme")),this.essentialsMap&&this.essentialsMap.site&&!this.serviceToken&&(this.serviceToken=this.essentialsMap.site.getTokenFromPrincipal(this.serviceUrl,this.mapServiceType));var l=i(e,"token"),u=this.essentialsMap&&this.essentialsMap.site?this.essentialsMap.site.arcGisPortalSecurityContext:null;l.length>0?this.serviceToken=l:u&&u.appliesTo(this.serviceUrl)&&u.tokenResult&&(this.serviceToken=u.tokenResult.token);var c=i(e,"proxy");c.length>0&&(this.proxyUrl=c,esri.addProxyRule({urlPrefix:this.serviceUrl,proxyUrl:c}),this.serviceUrl.indexOf("services.arcgis")>-1&&esri.addProxyRule({urlPrefix:this.serviceUrl.replace("services.arcgis","server.arcgis"),proxyUrl:c}));var p=i(e,"mapUrl");p.length>0&&(this.mapUrl=p.replace(/%3d/g,"=").replace(/%3D/g,"="));var h=i(e,"tileRestUrl");h.length>0&&(this.tileRestUrl=h.replace(/%3d/g,"=").replace(/%3D/g,"="));var d=i(e,"subDomains");d&&(this.subDomains=d.split(","))}},r.prototype._isLocalProxyInfo=function(e){return!!e&&"local-reverse-proxy"==e.type&&!!e.address},r.prototype._processProxyInfo=function(e){if(this._isLocalProxyInfo(e)){for(var t=(this.url+"/../../../../../"+e.address).split("/"),i=t.indexOf("..");i>0;i=t.indexOf(".."))t.splice(i-1,2);this.serviceUrl=t.join("/")}},r.prototype.supportsLayerVisibility=function(){switch(this.mapServiceType){case n.MapServiceType.WMS:return!0;case n.MapServiceType.DYNAMIC:return null!==this.serviceLayer&&!!this.serviceLayer.visibleLayers;case n.MapServiceType.GRAPHICS:case n.MapServiceType.FEATURE:case n.MapServiceType.CSV:case n.MapServiceType.LABEL:case n.MapServiceType.STREAM:case n.MapServiceType.GEORSS:case n.MapServiceType.KML:case n.MapServiceType.BING:case n.MapServiceType.TILED:case n.MapServiceType.WMTS:case n.MapServiceType.IMAGE:case n.MapServiceType.WEBTILED:case n.MapServiceType.VECTORTILE:case n.MapServiceType.MAPIMAGE:case n.MapServiceType.UNKNOWN:default:return!1}},r.prototype._setVisibility=function(e,t,i){var r,s,a,o={mapServiceId:this.id,layerId:e,visibility:t};switch(void 0===i&&(i=!1),this.mapServiceType){case n.MapServiceType.DYNAMIC:if(null!==this.serviceLayer){if(!this.serviceLayer.visibleLayers){t?this.serviceLayer.show():this.serviceLayer.hide(),dojo.publish("LayerVisibilityChange",[new Array(o)]);break}var l=this.getVisibleLayers();l.InternallyChangedLayer=o,0===l.length&&l.push("-1"),this.serviceLayer.setVisibleLayers&&this.serviceLayer.setVisibleLayers(l,i)}break;case n.MapServiceType.WMS:if(null!==this.serviceLayer){var u=[];for(u.InternallyChangedLayer=o,r=0,s=0;s0},r.prototype.applyCatalogLayersChange=function(e){var t=this,i=!1,r=[];if(this.id==e.mapServiceId){for(var n=0;n0?e.geometryEndpoints[0].geometryServiceUrl:null},r.prototype._getDefaultGeometryServiceToken=function(){var e=this.essentialsMap?this.essentialsMap.site:null;return e&&e.geometryEndpoints&&e.geometryEndpoints.length>0?e.geometryEndpoints[0].geometryServiceToken:null},r.prototype._corsRequest=function(t,i,r){var n=this;return new v.SimplePromise(function(s,a){try{e(["dojo/request"],function(e){return r=!!r,e(t,{headers:{"X-Requested-With":null},withCredentials:i=!!i}).response.then(function(e){return s()},function(e){return r?a(e):s(n._corsRequest(t,!i,!0))})})}catch(e){return console.log("Error in initializing WMS layer: "+e),a(e)}})},r}(r.AsyncInitializable);g._wmsExtended=!1,i.MapService=g})},"geocortex/essentials/MapServiceConstants":function(){define(["require","exports"],function(e,t){"use strict";var i,r,n,s,a;Object.defineProperty(t,"__esModule",{value:!0}),(i=t.MapServiceType||(t.MapServiceType={})).DYNAMIC="Dynamic",i.TILED="Tiled",i.IMAGE="Image",i.BING="Bing",i.FEATURE="Feature",i.WMS="WMS",i.WFS="WFS",i.WMTS="WMTS",i.GEORSS="GeoRss",i.WEBTILED="WebTiled",i.VECTORTILE="VectorTile",i.KML="Kml",i.GRAPHICS="Graphics",i.LABEL="Label",i.STREAM="Stream",i.CSV="Csv",i.MAPIMAGE="MapImage",i.UNKNOWN="Unknown",(r=t.MapServiceFunction||(t.MapServiceFunction={})).OPERATIONAL="Operational",r.BASE="Base",(n=t.DrawingBehavior||(t.DrawingBehavior={})).MAP_SERVICE="MapService",n.FEATURE_LAYER="FeatureLayer",n.WFS_LAYER="WfsService",n.GEORSS_LAYER="GeoRssLayer",n.KML_SERVICE="KmlService",n.STREAM_LAYER="StreamLayer",n.GeoRSS_LAYER=n.GEORSS_LAYER,(s=t.FailureAction||(t.FailureAction={})).IGNORE="Ignore",s.WARN="Warn",s.ERROR="Error",(a=t.UserLayerType||(t.UserLayerType={})).LAYER_ADDITION="LayerAddition",a.LAYER_CATALOG="LayerCatalog",a.UPLOAD="Upload"})},"geocortex/essentials/NamedExtent":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./AsyncInitializable","./../geocortex"],function(e,i,r,n){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var s=function(e){function i(t){var i=e.call(this,t)||this;return i.displayName=null,i.extensions=[],i.extent=null,i.id=null,i.properties={},i.site=null,i}return t(i,e),i.prototype.navigateTo=function(){if(this.site){var e=this.site.essentialsMap;e&&e.extentManager.setExtentWithPriority(this.extent,10)}},i.prototype._configureObject=function(e,t){if(void 0===e||void 0===e.id||void 0==e.displayName||void 0===e.extent)throw new Error("Incorrect named extent object returned from initialization");this.id=e.id,this.displayName=e.displayName,this.extent=new esri.geometry.Extent(e.extent),this.properties=n._getProperties(e.properties),this.extensions=n._getExtensions(e.extensions)},i}(r.AsyncInitializable);i.NamedExtent=s})},"geocortex/essentials/OAuth2Client":function(){define(["require","exports","./TokenResult","./utilities/DecomposedUri"],function(e,t,i,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e.getTokenFromImplicitGrant=function(){var e=window.location.href;if(e.indexOf("#")>0){var t=e.substring(e.indexOf("#")+1,e.length),r=dojo.queryToObject(t);if(!r.access_token)return null;var n=new i.TokenResult;n.token=r.access_token,n.userName=r.username;var s=parseInt(r.expires_in);return s&&(n.expiresOn=new Date((new Date).getTime()+1e3*s)),n}return null},e.getErrorFromImplicitGrant=function(){var e=window.location.href;if(e.indexOf("#")>0){var t=e.substring(e.indexOf("#")+1,e.length),i=dojo.queryToObject(t);if(i.error){var r=new s;return r.code=i.error,r.description=i.error_description,r}}return null},e.applicationHasImplicitGrant=function(){return e.hasFragmentParameter("access_token")},e.applicationHasImplicitGrantError=function(){return e.hasFragmentParameter("error")},e.hasFragmentParameter=function(e){var t=window.location.href;if(t.indexOf("#")<0)return!1;var i=(t=window.location.href).substring(t.indexOf("#")+1,t.length);return!!dojo.queryToObject(i)[e]},e.redirectToLogOnPage=function(t,i){var n=new r.DecomposedUri(window.location.href);e.removeImplicitGrantParams(n);var s=t+"?client_id="+encodeURIComponent(i)+"&response_type=token&redirect_uri="+encodeURIComponent(n.recompose())+"&expiration=20160";window.location.href=s},e.removeImplicitGrantParamsAndUpdateUrlHash=function(){var t=new r.DecomposedUri(window.location.href);e.removeImplicitGrantParams(t),window.location.hash=dojo.objectToQuery(t.fragment)},e.removeImplicitGrantParams=function(e){return delete e.fragment.access_token,delete e.fragment.username,delete e.fragment.expires_in,delete e.fragment.error,delete e.fragment.error_description,e},e}();t.OAuth2Client=n;var s=function(){};s.ACCESS_DENIED_ERROR_CODE="access_denied",t.OAuth2Error=s})},"geocortex/essentials/OfflineBasemap":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/Principal":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/PrintTemplate":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./AsyncInitializable","./Report","./exportMap/ExportMapParameters","./exportMap/ExportMapTask","./../geocortex"],function(e,i,r,n,s,a,o){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var l=function(e){function i(t){var i=e.call(this,t)||this;return i.description=null,i.displayName=null,i.extensions=[],i.id=null,i.visible=null,i.maximumResolution=300,i.properties=null,i.site=null,i.supportedMapScales=[],i.supportedOutputFormats=[],i.supportedResolutions=[],i.supportsEmailNotification=!1,i.textFields=[],i.grids=[],i.type=n.ReportType.MAP_TEMPLATE_REPORT,i.isDefault=!1,i.defaultMapScale=null,i.defaultMapScaleName=null,i.defaultResolution=null,i.defaultGrid=null,i.defaultOutputFormat=null,i._printing=!1,i._onPrintComplete=null,i._onPrintError=null,i.extensions=[],i.properties=[],i.supportedMapScales=[],i.supportedOutputFormats=[],i.supportedResolutions=[],i.textFields=[],i}return t(i,e),i.prototype.isPrinting=function(){return this._printing},i.prototype.print=function(e,t,i){var r=this;if(this.isPrinting())i&&i(new Error("Template already printing"));else{this._onPrintComplete=t,this._onPrintError=i,this._printing=!0;var n=new s.ExportMapParameters;n.reportParameters=e,new a.ExportMapTask(this).generateMapImageUrl(n).then(function(e){return r._printRestComplete(e)},function(e){return r._printRestError(e)})}},i.prototype._configureObject=function(e,t){if(void 0===e||void 0===e.id||void 0===e.displayName)throw new Error("Incorrect print template object returned from initialization");if(this.description=void 0===e.description?this.description:e.description,this.displayName=e.displayName,this.id=e.id,this.visible=void 0===e.visible||e.visible,this.mainMapWidth=e.mainMapWidth,this.mainMapHeight=e.mainMapHeight,this.maximumResolution=void 0===e.maximumResolution?this.maximumResolution:e.maximumResolution,this.supportedMapScales=void 0===e.supportedScales?this.supportedMapScales:e.supportedScales,this.supportedOutputFormats=void 0===e.supportedOutputFormats?this.supportedOutputFormats:e.supportedOutputFormats,this.supportedResolutions=void 0===e.supportedResolutions?this.supportedResolutions:e.supportedResolutions,this.supportsEmailNotification=!!e.supportsEmailNotification,this.textFields=void 0===e.textFields?this.textFields:e.textFields,this.grids=void 0===e.grids?this.grids:e.grids,t&&(this.isInitialized=!0),this.properties=o._getProperties(e.properties),this.extensions=o._getExtensions(e.extensions),this.isDefault=void 0===e.isDefault?this.isDefault:e.isDefault,this.defaultMapScaleName=void 0===e.defaultMapScale?null:e.defaultMapScale,this.defaultMapScaleName)for(n=0;n0?o.bboxSR=s.wkid:s.wkt&&(o.bboxSR=s.wkt)),o.bbox=n.xmin+","+n.ymin+","+n.xmax+","+n.ymax),this.targetSpatialReference&&(s=this.targetSpatialReference.toJson())&&(s.wkid&&s.wkid>0?o.targetSR=s.wkid:s.wkt&&(o.targetSR=s.wkt)),this.notificationEmailAddress&&(o.emailAddress=this.notificationEmailAddress),this.imageHeight&&this.imageHeight>0&&(o.imageHeight=this.imageHeight),this.imageWidth&&this.imageWidth>0&&(o.imageWidth=this.imageWidth),t.timeExtent&&(o.time="",t.timeExtent.startTime?o.time+=t.timeExtent.startTime.getTime():o.time+="null",o.time+=",",t.timeExtent.endTime?o.time+=t.timeExtent.endTime.getTime():o.time+="null");var u=[];if(null!==r){var c="",p="",h="";for(a=0;a0&&(v+=","),v+='"'+_+'":"'+d[_].replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"',g++;if(g>0&&(h.length>1&&(h+=","),h+='"'+f.id+'":{',h+=v,h+="}"),!0===m.visible&&!0===m.isVisibleAtScale(l))if(m instanceof esri.layers.ArcGISDynamicMapServiceLayer){var S=m;S.visibleLayers&&"-1"!==S.visibleLayers.toString()&&(y=S.visibleLayers.toString())}else if(f.layers&&0!==f.layers.length){if(f.layers&&f.layers.length>0)for(b=0;b0)for(var b=0;b0){var D=m.objectIdField;if(D)for(var C=0;C0&&(h="{"+h+"}",o.layerDefinitions=h),c.length>0&&(o.layers=c),p.length>0&&(o.opacity=p)}u.length>0&&(o.featureLayerOptions=u),this.outputFormat&&(o.outputFormat=this.outputFormat),this.featureIds&&(o.featureIds=this.featureIds),this.resolution&&(o.dpi=this.resolution.dpi),this.mapGraphicsLayers&&(o.graphics=this.mapGraphicsLayers.layers,o.symbols=this.mapGraphicsLayers.symbols),this.includeData&&(o.of=o.of?o.of+",includeData":"includeData"),this.includeGeoreferenceData&&(o.georef=this.includeGeoreferenceData),this.useTransparentBackground&&(o.useTransparentBackground=this.useTransparentBackground);for(var F=0;F=0?r+="&":r+="?",r+=encodeURIComponent(t)+"="+encodeURIComponent(i)),r},e}();i.tokenScopes={},t.RestHelperHTTPService=i})},"geocortex/essentials/RestUtility":function(){define(["require","exports","./RestEndpointResult","./../geocortex"],function(e,t,i,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this._activeEndpointRequest=!1,this._onRequestComplete=null,this._onRequestError=null}return e.prototype.getCustomRestEndpoint=function(e,t,i,n,s){this._activeEndpointRequest?this._onEndpointRequestError(new Error("An operation is already in progress.")):(this._activeEndpointRequest=!0,this._onRequestComplete=i,this._onRequestError=n,r.request({url:e,content:t,load:dojo.hitch(this,this._onEndpointRequestComplete),error:dojo.hitch(this,this._onEndpointRequestError),callbackParamName:"CallBack"},s))},e.prototype._onEndpointRequestComplete=function(e){this._activeEndpointRequest=!1;try{e||(e={error:new Error("Expected results")}),e.error&&this._onRequestError&&this._onRequestError(e.error)}finally{this._onRequestComplete&&this._onRequestComplete(new i.RestEndpointResult(e,e.error))}},e.prototype._onEndpointRequestError=function(e){this._activeEndpointRequest=!1;try{this._onRequestError&&this._onRequestError(e)}finally{this._onRequestComplete&&this._onRequestComplete(new i.RestEndpointResult(null,e))}},e}();t.RestUtility=n})},"geocortex/essentials/Rx.light":function(){define(["require","exports"],function(e,t){"use strict";function i(){}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.prototype.select=function(t){var i=this,r=new e;return r._subscribe=function(e){var r=!0,n={onNext:function(i){if(r)try{e.onNext(t(i))}catch(t){r=!1,e.onError(t)}},onError:function(t){r&&(r=!1,e.onError(t))},onCompleted:function(){r&&(r=!1,e.onCompleted())}},s=i._subscribe(n);return r?s:(s.dispose(),{dispose:function(){}})},r},e.prototype._subscribe=function(e){return{dispose:i}},e.prototype.subscribe=function(e,t,r){if(arguments.length>1)return n={onNext:e||i,onError:t||i,onCompleted:r||i},this._subscribe(n);if(e instanceof Function){if(e.length>1)return n={onNext:function(t){return e(t)},onError:function(t){return e(void 0,t)},onCompleted:function(){return e()}},this._subscribe(n);var n={onNext:e,onError:t||i,onCompleted:r||i};return this._subscribe(n)}return e?this._subscribe(e):this._subscribe({onNext:i,onError:i,onCompleted:i})},e}();t.AnonymousObservable=r})},"geocortex/essentials/Scale":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e,t){this.displayName=e,this.scale=t};t.Scale=i})},"geocortex/essentials/SearchQuery":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){this.extent=null,this.maxResults=50,this.contains=!0,this.returnGeometry=!1,this.returnHighlights=!1,this.returnIdsOnly=!1,this.returnCountOnly=!1,this.searchText=null,this.outSpatialReference=null}return e.prototype.toJson=function(e,t){if(!e||!t)throw new Error("Search query parameter creation is missing a main map.");var i={searchText:this.searchText,contains:this.contains,returnGeometry:this.returnGeometry,returnHighlights:this.returnHighlights,returnIdsOnly:this.returnIdsOnly,returnCountOnly:this.returnCountOnly};this.extent&&(i.envelope="{0},{1},{2},{3}".format(this.extent.xmin,this.extent.ymin,this.extent.xmax,this.extent.ymax)),(this.returnGeometry||this.extent)&&this.outSpatialReference&&(i.outSR=this.outSpatialReference.toJson()),this.maxResults>0&&(i.maxResults=this.maxResults);var r=this.searchLayers;return r&&0!=r.length||(r=t.allLayers()),i.layers=this._getServiceStrings(r),i},e.prototype._getServiceStrings=function(e){for(var t="",i={},r=0;r0&&t.startsWith("#gcx-")){window.removeEventListener?window.removeEventListener("popstate",r,!1):window.detachEvent&&window.detachEvent("onpopstate",r);var i=t.substring(5);e.sendRequest(e.site.url+"?f=json&callback=security.updateSitePrincipal&token="+i)}};window.addEventListener?window.addEventListener("popstate",r,!1):window.attachEvent&&window.attachEvent("onpopstate",r),window.open(t,i)},e.prototype.openFrame=function(){var e=this;this.frame=document.createElement("iframe"),this.frame.name="SignInHelper",this.frame.style.display="none",document.body.appendChild(this.frame),i.isNative()?(this.frame.src="SignInHelper.html",window.setTimeout(function(){e.finished||e.openSystemBrowser()},1e4)):(window.open("SignInHelper.html","SignInHelper"),window.setTimeout(function(){return e.openPopup()},15e3))},e.prototype.openPopup=function(){this.finished||(this.sendRequest(this.getExpirationNoticeUrl()+"?f=json&part=_html&callback=security.showContent"),window.open("SignInHelper.html","_blank"))},e.prototype.getExpirationNoticeUrl=function(){return this.site.principal&&this.site.principal.urls?this.site.principal.urls.expirationNotice:null},e.prototype.getRefreshUrl=function(){return this.site.principal&&this.site.principal.urls?this.site.principal.urls.refresh:null},e.prototype.sendRequest=function(e){if(!this.finished){var t=document.createElement("script");t.style.display="none",document.body.appendChild(t),this.scripts.push(t),t.type="text/javascript",t.src=e+"&rid="+this.id}},e.prototype.showContent=function(e){return!this.finished&&e.rid==this.id&&(this.dialog&&this.dialog.parentNode&&this.dialog.parentNode.removeChild(this.dialog),this.dialog=document.createElement("div"),this.dialog.innerHTML=e.content,document.body.appendChild(this.dialog),!0)},e.prototype.handleSignIn=function(e,t){if(this.finished)return null;if(!(e.length>0&&e.startsWith("#gcx-"))){var i="";return null==this.site.principal.urls.referrer&&(i="&app="+encodeURIComponent(t)),this.getRefreshUrl()+i+"&token_type=fragment"}var r=e.substring(5);return this.sendRequest(this.site.url+"?f=json&callback=security.updateSitePrincipal&token="+r),null},e.prototype.finish=function(){if(this.finished)return!1;for(this.finished=!0;this.scripts.length>0;){var e=this.scripts.pop();e.parentNode.removeChild(e)}return this.dialog&&this.dialog.parentNode&&this.dialog.parentNode.removeChild(this.dialog),this.frame&&this.frame.parentNode&&this.frame.parentNode.removeChild(this.frame),!0},e.prototype.updateSitePrincipal=function(e){return this.finished?(this._refreshPromise.isResolved||this._refreshPromiseResolve(),!1):e.rid==this.id&&(this.finish(),this.site.updatePrincipal(e.principal),this._refreshPromiseResolve(),console.log("Updated Principal (Refresh Successful)"),!0)},e.prototype.useSystemBrowser=function(){return!1},e.prototype.waitForSignIn=function(){return this._refreshPromise},e}();t.SecurityHelper=r})},"geocortex/essentials/ServiceHelper":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.extractConnectionStringValue=function(e,t){if(e.length>0){var i=e.match("(^|;)[s]*"+t+"=([^;]*)");return null!==i?i[2]:""}return""},e}();t.ServiceHelper=i})},"geocortex/essentials/ServicePoint":function(){var t,i=this&&this.__extends||(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./Rx.light","./../geocortex"],function(t,r,n,s){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(){}return e.prototype.toString=function(){return this.message},e}();r.ServiceRequestError=a,a.prototype.message="An error occurred while performing the operation.",a.prototype.details=new Array,a.prototype.name="ServiceRequestError";var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(a);r.ServiceRequestAbortedError=o,o.prototype.message="The request was aborted.",o.prototype.name="ServiceRequestAbortedError";var l=function(){function t(){}return t.prototype.start=function(){try{this.promise=s.request(this),this.valid?this.registration=this.servicePoint.cancellationToken.register(this.error.bind(this)):this.promise.cancel()}catch(e){this.error(e)}},t.prototype.load=function(e){try{if(this.member){var t=e[this.member];if(t)for(var i=0;i=0&&s=2){var i=t[0]+"."+t[1];e=parseFloat(i)}}return e},i.prototype.getDefaultBatchGeocoder=function(){var e=_.firstOrDefault(this.geocodingEndpoints,function(e){return e.isDefaultBatchGeocoder});return!e&&this.geocodingEndpoints.length>0&&(e=this.geocodingEndpoints[0]),e},i.prototype.search=function(e,t,i,r){var n=this;t&&t(e);try{var s=this.url+"/search",a={};e&&e.toJson&&(a=e.toJson(this.getMap(),this.essentialsMap));var o=b.encodeJson(dojo.mixin({f:"json"},a))}catch(e){return void(r&&r(e))}o.hasOwnProperty("layers")&&o.layers&&b.request({url:s,content:o,load:function(t){var s=new S.SearchResults;s.queryParams=e,t?n._parseSearchResponse(s,t):s.error=new Error("Unexpected Error"),s.error&&r&&r(s.error),i&&i(s)},error:function(e){r&&r(e)},callbackParamName:"CallBack"})},i.prototype._parseSearchResponse=function(e,t){if(!t)throw new Error("_parseSearchResponse: required jsonObject argument was not supplied.");if(t.hasOwnProperty("error")&&t.error&&t.error.message)e.error=new Error(t.error.message);else if(t.hasOwnProperty("ResponseStatus")&&t.ResponseStatus&&t.ResponseStatus.ErrorCode)e.error=new Error(t.ResponseStatus.Message),e.error.name=t.ResponseStatus.ErrorCode;else if(t.hasOwnProperty("features")){var i=this._createFeatureSets(t.features,e.queryParams.returnHighlights);for(var r in i)i.hasOwnProperty(r)&&e.results.push(i[r])}},i.prototype._createFeatureSets=function(e,t){for(var i={},r=0;r=0){var i=e.substring(t+5);return window.location.replace("#"),i}return null},i._addQueryParameter=function(e,t){var i=e.split("#",2);e=i[0];var r=i.length>1?i[1]:"";return e+(e.indexOf("?")>-1?"&":"?")+t+r},i.prototype.canSignIn=function(){return this._signInEnabled&&!!this.principal&&!!this.principal.urls.signIn&&!this.principal.isAuthenticated&&!!this.principal.policy&&this.principal.policy.issuers.length>0},i.prototype._signIn=function(e,t){e||(e=this.principal),t||(t=e.urls.signIn),void 0===e.policy&&(e.policy={});var r=e.policy.hints;r&&(t=i._addQueryParameter(t,r)),t=i._addQueryParameter(t,"token_type=fragment"),this.signInRedirectUri&&t.indexOf("app=")<0?t=i._addQueryParameter(t,"app="+encodeURIComponent(this.signInRedirectUri)):!e.urls.referrer&&t.indexOf("app=")<0&&(t=i._addQueryParameter(t,"app="+encodeURIComponent(window.location.toString()))),this.onSignIn&&this.onSignIn({url:t}),window.addEventListener&&window.addEventListener("popstate",function(){location.hash.startsWith("#gcx-")&&location.reload()},!1),window.location.assign(t)},i.prototype.signIn=function(e){this._signIn(this.principal,e)},i.prototype.canSignOut=function(){return this._signOutEnabled&&!!this.principal&&this.principal.isAuthenticated&&!!this.principal.urls.signOut},i.prototype.signOut=function(){this.onSignOut&&this.onSignOut();var e=this.principal.urls.signOut;this.signOutRedirectUri?e=i._addQueryParameter(e,"app="+encodeURIComponent(this.signOutRedirectUri)):this._signOutRedirectUrl&&(e=i._addQueryParameter(e,"app="+encodeURIComponent(this._signOutRedirectUrl))),window.location.assign(e)},i.prototype.getTokenFromPrincipal=function(e,t){var r=this,n=null;if(t===E.MapServiceType.DYNAMIC?n=this.principal.tokens.arcgis:t===E.MapServiceType.FEATURE?n=this.principal.tokens.arcgis:t===E.MapServiceType.IMAGE?n=this.principal.tokens.arcgis:t===E.MapServiceType.TILED?n=this.principal.tokens.arcgis:t===E.MapServiceType.WEBTILED?n=this.principal.tokens.arcgis:t===E.MapServiceType.VECTORTILE?n=this.principal.tokens.arcgis:t===esri.IdentityManagerBase?n=this.principal.tokens.arcgis:t===i&&((a={})[this.url]=this.principal.tokens.site,n=a,this.layerCatalogs.forEach(function(e){var t=r.url.replace(r.id,e.siteId);n[t]=r.principal.tokens.site})),!n)return null;e=e.toLowerCase();var s=document.createElement("a");s.href=e.toLowerCase();var a,o=s.protocol,l=s.hostname,u=s.port;e=s.href;for(var c in n){var p=c.toLowerCase();if(l==p)return n[c];if(l.endsWith("."+p))return n[c];try{if(s.href=o+"://"+p,s.port=u,e.startsWith(s.href))return n[c]}catch(e){}try{if(s.href=p,e.startsWith(s.href))return n[c]}catch(e){}}return null},i.prototype._updateDefaultToken=function(e){if("string"==typeof e){var t=this.url,i=Math.max(t.indexOf("?"),t.indexOf("#"));i>=0&&(t=t.substr(0,i)),t=/^(.*?)\/*$/.exec(t)[1],L.RestHelperHTTPService.setDefaultToken(e,t+"/../../")}},i.prototype._detectAndConfigureCors=function(){var e=new dojo.Deferred;if(window.geocortexDisableEssentialsCorsDetection)return e.resolve(),e;var t=m.UrlUtilities.getUrlComponents(this.url),i=m.UrlUtilities.getUrlComponents(window.location.href);if(t.origin===i.origin)return e.resolve(),e;var r=(/(.*\/+)sites\/+[^\/]*\/?$/i.exec(this.url)||[])[1];if(r){var n=r+"info?f=json";dojo.xhrGet({url:n}).then(function(i){esri.config.defaults.io.corsEnabledServers.push(t.host),e.resolve()},function(t){e.resolve()})}else e.resolve();return e},i.prototype._initialize=function(){var e=this;if(!this.isInitialized&&!this._initializing){var t=i._getTokenFromFragment();if(this._updateDefaultToken(t),!t){var r=function(){if(window.removeEventListener?window.removeEventListener("popstate",r,!1):window.detachEvent&&window.detachEvent("onpopstate",r),!e.isInitialized&&e._initializing){var t=i._getTokenFromFragment();t&&(e._updateDefaultToken(t),b.request({url:e.url,content:{f:"json",deep:e.deepInitialize},load:dojo.hitch(e,e._verifySiteDependencies),error:dojo.hitch(e,e._initSiteErrorHandler),callbackParamName:"CallBack"}))}};window.addEventListener?window.addEventListener("popstate",r,!1):window.attachEvent&&window.attachEvent("onpopstate",r)}this._initializedHandlerCalled=!1,this._initializing=!0,b.request({url:this.url,content:{f:"json",deep:this.deepInitialize},load:dojo.hitch(this,this._verifySiteDependencies),error:dojo.hitch(this,this._initSiteErrorHandler),callbackParamName:"CallBack"})}},i.prototype._initMapHandler=function(e){this._mapInitialized=!0,null!==e&&null!==e.site&&e.loadServiceLayersInMap(e.site.getMap()),this._siteInitializeUpdate()},i.prototype._initMapErrorHandler=function(e){this._mapInitialized=!0,this._initializationFailedHandler(e),this._siteInitializeUpdate()},i.prototype._initNamedExtentsHandler=function(e){this._namedExtentsInitialized=!0,e&&this._initAsyncCollection(e.namedExtents,"namedextents",this.namedExtents,c.NamedExtent)},i.prototype._initTimeSlidersHandler=function(e){this._timeSlidersInitialized=!0,e&&this._initAsyncCollection(e.timeSliders,"timesliders",this.timeSliders,h.TimeSliderProfile)},i.prototype._initOverviewMapHandler=function(){this._overviewMapInitialized=!0,this._siteInitializeUpdate()},i.prototype._initOverviewMapErrorHandler=function(e){this._overviewMapInitialized=!0,this._initializationFailedHandler(e),this._siteInitializeUpdate()},i.prototype._initPrintTemplatesHandler=function(e){var t=this,i=0;this._printTemplatesInitialized=!0,e.printTemplates.length>0&&null!=e.printTemplates[0].visible?this._initAsyncCollection(e.printTemplates,"printtemplates",this.printTemplates,p.PrintTemplate):e.printTemplates.forEach(function(r){b.request({url:t.url+"/printtemplates/"+r.id,content:{f:"json"},load:function(r){i++,e.printTemplates.forEach(function(e){e.id===r.id&&(e.visible=r.visible)}),i===e.printTemplates.length&&t._initAsyncCollection(e.printTemplates,"printtemplates",t.printTemplates,p.PrintTemplate)},callbackParamName:"CallBack"})})},i.prototype.updateServiceTokensIfStale=function(){if(!this._serviceTokensStale){var e=new dojo.Deferred;return e.resolve(),e}return this._getUpdatedServiceTokens()},i.prototype._getUpdatedServiceTokens=function(){var e=this;if(0===this.updateInterval){var t=new dojo.Deferred;return t.resolve(),t}return this._serviceTokenRefresh?this._serviceTokenRefresh:(this._serviceTokenRefresh=new dojo.Deferred,this._updateServiceTokensOfAllSites(),new dojo.DeferredList(this._allDeferredDojosForUpdatingTokens).then(function(t){e._serviceTokensStale=!1;for(var i=0;i0)for(var i=0;i-1?e.substring(0,i):e},i.prototype._hookGetCredential=function(){var e=this;esri.IdentityManagerBase.prototype.getCredential=function(t,i){try{return e._getCredential(t,i)}catch(e){console.log("Error getting site credential: "+e);var r=new dojo.Deferred;return r.reject(e),r}}},i.prototype._initSiteHandler=function(e){var t=this;if(this._hookGetCredential(),!e)throw new Error("Incorrect site object returned from initialization");if(this.configPreprocessor&&(this.configPreprocessor(e),this.configPreprocessor=null),e.__loadedOffline&&(this._serviceTokensStale=!0),e.contentPolicy&&(M.isNullOrUndefined(e.contentPolicy.trustedUrls)?this.trustedUrls=[]:this.trustedUrls=e.contentPolicy.trustedUrls),e.layerCatalogs)if(0==e.layerCatalogs.length)this.layerCatalogs=[];else for(var i=0;i0&&(this._tokenIntervalHandle=setInterval(function(){t._getUpdatedServiceTokens()},Math.max(60,1e3*this.updateInterval))),this.properties=b._getProperties(e.properties),this.extensions=b._getExtensions(e.extensions),this.essentialsMap=new a.Map(this.originalUrl+"/map"),this.essentialsMap.site=this,dojo.connect(this.essentialsMap,"onInitialized",dojo.hitch(this,this._initMapHandler)),dojo.connect(this.essentialsMap,"onInitializationFailed",dojo.hitch(this,this._initMapErrorHandler)),this.hasOverviewMap&&(this.overviewMap=new a.Map(this.originalUrl+"/overviewmap"),this.overviewMap.site=this,dojo.connect(this.overviewMap,"onInitialized",dojo.hitch(this,this._initOverviewMapHandler)),dojo.connect(this.overviewMap,"onInitializationFailed",dojo.hitch(this,this._initOverviewMapErrorHandler))),e.map&&e.map.layerList&&(this.layerListRestEndpoint=e.map.layerList),!this.deepInitialize||this.getEssentialsVersion()<3.3||void 0===e.map?(this.essentialsMap.initialize(),this.hasOverviewMap?this.overviewMap.initialize():this._overviewMapInitialized=!0,e.hasKmlServiceEndpoint?b.request({url:this.url+"/kmlService",content:{f:"json"},load:dojo.hitch(this,this._initKmlEndpointHandler),error:dojo.hitch(this,this._initAsyncCollectionErrorHandler,dojo.hitch(this,function(){this._kmlServiceInitialized=!0})),callbackParamName:"CallBack"}):this._kmlServiceInitialized=!0,this.hasGeocodingEndpoints?b.request({url:this.url+"/geocoding",content:{f:"json"},load:dojo.hitch(this,this._initGeocodingEndpointsHandler),error:dojo.hitch(this,this._initAsyncCollectionErrorHandler,dojo.hitch(this,function(){this._geocodingEndpointsInitialized=!0})),callbackParamName:"CallBack"}):this._geocodingEndpointsInitialized=!0,this.hasGeometryEndpoints?b.request({url:this.url+"/geometry",content:{f:"json"},load:dojo.hitch(this,this._initGeometryEndpointsHandler),error:dojo.hitch(this,this._initAsyncCollectionErrorHandler,dojo.hitch(this,function(){this._geometryEndpointsInitialized=!0})),callbackParamName:"CallBack"}):this._geometryEndpointsInitialized=!0,this.hasGeoprocessingEndpoints?b.request({url:this.url+"/geoprocessing",content:{f:"json"},load:dojo.hitch(this,this._initGeoprocessingEndpointsHandler),error:dojo.hitch(this,this._initAsyncCollectionErrorHandler,dojo.hitch(this,function(){this._geoprocessingEndpointsInitialized=!0})),callbackParamName:"CallBack"}):this._geoprocessingEndpointsInitialized=!0,this.hasNamedExtents?b.request({url:this.url+"/namedextents",content:{f:"json"},load:dojo.hitch(this,this._initNamedExtentsHandler),error:dojo.hitch(this,this._initAsyncCollectionErrorHandler,dojo.hitch(this,function(){this._namedExtentsInitialized=!0})),callbackParamName:"CallBack"}):this._namedExtentsInitialized=!0,this.hasPrintTemplates?b.request({url:this.url+"/printtemplates",content:{f:"json"},load:dojo.hitch(this,this._initPrintTemplatesHandler),error:dojo.hitch(this,this._initAsyncCollectionErrorHandler,dojo.hitch(this,function(){this._printTemplatesInitialized=!0})),callbackParamName:"CallBack"}):this._printTemplatesInitialized=!0,this.hasSearchTables?b.request({url:this.url+"/searchtables",content:{f:"json"},load:dojo.hitch(this,this._initSearchTablesHandler),error:dojo.hitch(this,this._initAsyncCollectionErrorHandler,dojo.hitch(this,function(){this._searchTablesInitialized=!0})),callbackParamName:"CallBack"}):this._searchTablesInitialized=!0,this.hasTimeSliders?b.request({url:this.url+"/timesliders",content:{f:"json"},load:dojo.hitch(this,this._initTimeSlidersHandler),error:dojo.hitch(this,this._initAsyncCollectionErrorHandler,dojo.hitch(this,function(){this._timeSlidersInitialized=!0})),callbackParamName:"CallBack"}):this._timeSlidersInitialized=!0,this.hasWorkflows?b.request({url:this.url+"/workflows",content:{f:"json"},load:dojo.hitch(this,this._initWorkflowsHandler),error:dojo.hitch(this,this._initAsyncCollectionErrorHandler,dojo.hitch(this,function(){this._workflowsInitialized=!0})),callbackParamName:"CallBack"}):this._workflowsInitialized=!0,this.hasWebMaps?b.request({url:this.url+"/webmaps",content:{f:"json"},load:dojo.hitch(this,this._initWebMapHandler),error:dojo.hitch(this,this._initAsyncCollectionErrorHandler,dojo.hitch(this,function(){this._webMapsInitialized=!0})),callbackParamName:"CallBack"}):this._webMapsInitialized=!0):(this._initGeocodingEndpointsHandler(e),this._initGeometryEndpointsHandler(e),this._initGeoprocessingEndpointsHandler(e),this._initTimeSlidersHandler(e),this._initKmlEndpointHandler(e.kmlServiceEndpoint),this.essentialsMap.initialize(e.map),this._initNamedExtentsHandler(e),e.overviewMap?this.overviewMap.initialize(e.overviewMap):(this._overviewMapInitialized=!0,this._siteInitializeUpdate()),this._initPrintTemplatesHandler(e),this._initWorkflowsHandler(e),this._initSearchTablesHandler(e),this._initWebMapHandler(e)),this.documentStore.initialize(this),this._siteInitializeUpdate()},i.prototype._updateServiceTokensOfAllSites=function(){var e=this;this.layerCatalogs&&this.layerCatalogs.length>0&&this.layerCatalogs.forEach(function(t){var i=new dojo.Deferred;e._allDeferredDojosForUpdatingTokens.push(i),e._updateServiceTokensBySendingRestRequest(t.siteId,i)});var t=new dojo.Deferred;this._allDeferredDojosForUpdatingTokens.push(t),this._updateServiceTokensBySendingRestRequest(null,t)},i.prototype._initSiteErrorHandler=function(e){var t=this,i=e,r=i.principal;!r||r.isAuthenticated||403!=i.code?(r&&r.isAuthenticated&&403==i.code&&r.urls.signOut&&(this._signOutEnabled=!0,this.principal=r),this._geocodingEndpointsInitialized=!0,this._geometryEndpointsInitialized=!0,this._geoprocessingEndpointsInitialized=!0,this._kmlServiceInitialized=!0,this._namedExtentsInitialized=!0,this._printTemplatesInitialized=!0,this._workflowsInitialized=!0,this._searchTablesInitialized=!0,this._timeSlidersInitialized=!0,this._initializationFailedHandler(e),this._siteInitializeUpdate()):O.isNative()?dojo.publish("SiteSignInRequired",{error:i.code,callback:function(){return t._signIn(r)}}):this._signIn(r)},i.prototype._initWorkflowsHandler=function(e){this._workflowsInitialized=!0,e&&this._initAsyncCollection(e.workflows,"workflows",this.workflows,f.Workflow)},i.prototype._initSearchTablesHandler=function(e){this._searchTablesInitialized=!0,e&&this._initAsyncCollection(e.searchTables,"searchTables",this.searchTables,y.SearchTable)},i.prototype._initWebMapHandler=function(e){this._webMapsInitialized=!0,e&&e.webMapsInfo&&(this.webMapsInfo.layerTypes=e.webMapsInfo.layerTypes,this._initAsyncCollection(e.webMapsInfo.webMaps,"webmaps",this.webMapsInfo.webMaps,C.WebMapReference))},i.prototype._siteInitializeUpdate=function(){this._geocodingEndpointsInitialized&&this._geometryEndpointsInitialized&&this._geoprocessingEndpointsInitialized&&this._kmlServiceInitialized&&this._mapInitialized&&this._namedExtentsInitialized&&this._overviewMapInitialized&&this._printTemplatesInitialized&&this._workflowsInitialized&&this._searchTablesInitialized&&this._timeSlidersInitialized&&this._webMapsInitialized&&(this._initializedHandlerCalled||(this._initializedHandlerCalled=!0,this._initializedHandler(this)))},i.prototype._verifySiteDependencies=function(e){e&&e.hasFeatureLayers?dojo.addOnLoad(dojo.hitch(this,function(){this._initSiteHandler(e)})):this._initSiteHandler(e)},i}(r.AsyncInitializable);i.Site=R})},"geocortex/essentials/StreamLayerService":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./MapService","./RestHelperHTTPService"],function(e,i,r,n){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var s=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t._streamLayerOptions=null,t}return t(i,e),i.prototype._configureStreamSettings=function(e){if(e){var t={purgeOptions:{displayCount:1e4}};null!=e.maxDisplayCount&&(t.purgeOptions.displayCount=e.maxDisplayCount),null!=e.maxAge&&(t.purgeOptions.maxAge=e.maxAge),null!=e.maxTrackPoints&&(t.maximumTrackPoints=e.maxTrackPoints),e.definitionExpression&&(t.definitionExpression=e.definitionExpression),e.geometryDefinition&&(t.geometryDefinition=new esri.geometry.Extent(e.geometryDefinition)),this._streamLayerOptions=t}},i.prototype._configureObject=function(t,i){if(void 0===t)throw new Error("Incorrect map service object returned from initialization");this._configureStreamSettings(t.streamSettings),e.prototype._configureObject.call(this,t,i)},i.prototype._createServiceLayer=function(){var t=this.serviceUrl;this.serviceToken&&(t=n.RestHelperHTTPService.appendTokenToUrl(t,this.serviceToken));var i=new esri.layers.StreamLayer(t,this._streamLayerOptions);i.id=this.id,i.loadError&&this._layerLoadErrorHandler(i.loadError),this._initiallyVisible?i.show():i.hide(),dojo.connect(i,"onError",this,this._layerLoadErrorHandler),dojo.connect(i,"onLoad",dojo.hitch(this,this._handleServiceLayerLoaded)),this.attributionDataUrl&&""!==this.attributionDataUrl?(i.attributionDataUrl=this.attributionDataUrl,i.hasAttributionData=!0):this.hasAttributionData&&(i.attributionDataUrl=this.url+"/Attribution",i.hasAttributionData=!0),this.serviceLayer=i,e.prototype.initiateServiceFailureTimer.call(this)},i}(r.MapService);i.StreamLayerService=s})},"geocortex/essentials/TextField":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e,t,i,r){this.id=e,this.displayName=t,this.value=i,this.multiline=r};t.TextField=i})},"geocortex/essentials/TimeExtent":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/TimeInfo":function(){define(["require","exports","./utilities/StringUtilities"],function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getGcxTimeInfo=function(e,t,r){var n=null,s=null;if(e&&e.timeExtent&&(n=e.timeExtent&&e.timeExtent.startTime instanceof Date?e.timeExtent.startTime.valueOf():parseInt(e.timeExtent[0],10),s=e.timeExtent&&e.timeExtent.endTime instanceof Date?e.timeExtent.endTime.valueOf():parseInt(e.timeExtent[1],10)),(!n||isNaN(n))&&!t||(!s||isNaN(s))&&!r)return null;var a=t?i.StringUtilities.getDateFromRestDateString(t):new Date(n),o=r?i.StringUtilities.getDateFromRestDateString(r):new Date(s),l={};return l.timeExtent={startTime:a,endTime:o},e&&(e.startTimeField&&(l.startTimeField=e.startTimeField),e.endTimeField&&(l.endTimeField=e.endTimeField),e.trackIdField&&(l.trackIdField=e.trackIdField),e.timeReference&&(l.timeReference={},void 0!=e.timeReference.respectsDaylightSaving&&(l.timeReference.respectsDaylightSavings=e.timeReference.respectsDaylightSaving),void 0!=e.timeReference.timeZone&&(l.timeReference.timeZone=e.timeReference.timeZone)),e.exportOptions&&(l.exportOptions={},void 0!=e.exportOptions.timeDataCumulative&&(l.exportOptions.timeDataCumulative=e.exportOptions.timeDataCumulative),void 0!=e.exportOptions.timeOffset&&(l.exportOptions.timeOffset=e.exportOptions.timeOffset),void 0!=e.exportOptions.timeOffsetUnits&&(l.exportOptions.timeOffsetUnits=e.exportOptions.timeOffsetUnits),void 0!=e.exportOptions.useTime&&(l.exportOptions.useTime=e.exportOptions.useTime))),l}})},"geocortex/essentials/TimeReference":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/TimeSliderMode":function(){define(["require","exports"],function(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),(i=t.TimeSliderMode||(t.TimeSliderMode={}))[i.Extent=0]="Extent",i[i.Cumulative=1]="Cumulative",i[i.Instant=2]="Instant"})},"geocortex/essentials/TimeSliderProfile":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./AsyncInitializable","./TimeSliderMode","./TimeUnits","./utilities/StringUtilities","./../geocortex"],function(e,i,r,n,s,a,o){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var l=function(e){function i(t){return e.call(this,t)||this}return t(i,e),i.prototype._configureObject=function(e,t){this.id=e.id,this.displayName=e.displayName,this.description=e.description,this.mode=n.TimeSliderMode[e.mode],this.displayFormat=e.displayFormat,this.timeExtent={startTime:a.StringUtilities.getDateFromRestDateString(e.startTime),endTime:a.StringUtilities.getDateFromRestDateString(e.endTime)},this.initialTimeExtent={startTime:a.StringUtilities.getDateFromRestDateString(e.initialStartTime),endTime:a.StringUtilities.getDateFromRestDateString(e.initialEndTime)},this.timeInterval=e.timeInterval,this.timeIntervalUnit=s.EssentialsTimeUnits[e.timeIntervalUnit],this.snapToTimeIntervals=e.snapToTimeIntervals,this.properties=o._getProperties(e.properties),this.extensions=o._getExtensions(e.extensions)},i}(r.AsyncInitializable);i.TimeSliderProfile=l})},"geocortex/essentials/TimeUnits":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){};i.UNIT_CENTURIES="esriTimeUnitsCenturies",i.UNIT_DAYS="esriTimeUnitsDays",i.UNIT_DECADES="esriTimeUnitsDecades",i.UNIT_HOURS="esriTimeUnitsHours",i.UNIT_MILLISECONDS="esriTimeUnitsMilliseconds",i.UNIT_MINUTES="esriTimeUnitsMinutes",i.UNIT_MONTHS="esriTimeUnitsMonths",i.UNIT_SECONDS="esriTimeUnitsSeconds",i.UNIT_WEEKS="esriTimeUnitsWeeks",i.UNIT_YEARS="esriTimeUnitsYears",i.UNIT_UNKNOWN="esriTimeUnitsUnknown",t.TimeUnits=i;var r=function(){};r.Century=i.UNIT_CENTURIES,r.Day=i.UNIT_DAYS,r.Decade=i.UNIT_DECADES,r.Hour=i.UNIT_HOURS,r.MilliSecond=i.UNIT_MILLISECONDS,r.Minute=i.UNIT_MINUTES,r.Month=i.UNIT_MONTHS,r.Second=i.UNIT_SECONDS,r.Week=i.UNIT_WEEKS,r.Year=i.UNIT_YEARS,t.EssentialsTimeUnits=r})},"geocortex/essentials/TokenResult":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){};t.TokenResult=i})},"geocortex/essentials/WebMapReference":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./AsyncInitializable","./utilities/LayerUtilities","./GeoRssLayerService","./MapServiceConstants","geocortex/framework/utils/utils"],function(e,i,r,n,s,a,o){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var l=function(e){function i(t){var i=e.call(this,t)||this;return i.displayName=null,i.id=null,i._isLoading=!1,i._onLoadingComplete=null,i._onLoadingError=null,i._layerTypes=null,i._arcgisSharingRegularExpressions=[new RegExp("(https?://.*?/)home/item.html\\?id=(\\w*)"),new RegExp("(https?://.*?/)home/webmap/viewer.html\\?webmap=(\\w*)"),new RegExp("(https?://.*?/)explorer/\\?open=(\\w*)"),new RegExp("(https?://.*?/sharing)/content/items/(\\w*)/data"),new RegExp("(https?://.*?/sharing)/content/items/(\\w*)")],i.site=null,i}return t(i,e),i.prototype.isLoading=function(){return this._isLoading},i.prototype._getUrlPortions=function(e){for(var t={id:null,path:null},i=0;i0){t.id=n[2],t.path=n[1];break}}return t},i.prototype._loadWebMap=function(e,t,i){var r=this;if(e&&e.path){if(!esri.arcgis||!esri.arcgis.Portal)return;new esri.arcgis.Portal(e.path).on("ready",function(t){if(t){var n={q:"id:"+e.id};t.queryItems(n).then(function(e){if(e){var t=e.results[0];esri.request({url:t.itemDataUrl}).then(function(e){r._processItemData(e),i.resolve(!1)})}})}})}else{var n="Web map with address "+t+" cannot be loaded.",s=esri.urlToObject(t);if(s.query=s.query||{},s.query&&(s.query.webmap||s.query.id)){var a,o=s.query.webmap||s.query.id;esri.arcgis&&esri.arcgis.utils?a=esri.arcgis.utils.getItem:esri.arcgis.getItem&&(a=esri.arcgis.getItem),a&&a(o).then(function(e){e?this._processItemData(e.itemData):this._onLoadingError(new Error(n)),i.resolve(!1)})}else this._onLoadingError(new Error(n)),i.resolve(!1)}},i.prototype._initializeWebMap=function(e,t,i,r){var n=this;if(this.isLoading())r&&r(new Error("Currently loading web map."));else{this._isLoading=!0;var s=new dojo.Deferred;this._onLoadingComplete=dojo.hitch(this,i),this._onLoadingError=dojo.hitch(this,r),this._layerTypes=this.site.webMapsInfo.layerTypes;var a=this._getUrlPortions(e.url);this._loadWebMap(a,e.url,s),s.then(function(e){n._isLoading=e})}},i.prototype._processItemData=function(e){if(e){var t=e.operationalLayers;t&&this._processLayerCollection(t,"Operational");var i=e.baseMap.baseMapLayers;i&&this._processLayerCollection(i,"Base")}},i.prototype._processLayerCollection=function(e,t){var i=this;if(e){for(var r=[],n=0;n=0||s.type&&this._layerTypes.indexOf(s.type)>=0)){var a=this._addLayerToMap(s);r.push(a)}}new dojo.DeferredList(r).then(function(e){if(e){for(var r=[],n=0;n0?r=r.concat(s):r.push(s))}r.length>0&&i.site.essentialsMap.addServiceLayers(r,t)}},function(e){i._onLoadingError(new Error("There was an error loading a layer: "+e))})}},i.prototype._addLayerToMap=function(e){var t=new dojo.Deferred,i=null;switch(this.site.getMap(),e.type){case"CSV":var r=new dojo._Url(window.location.href),l=new dojo._Url(e.url);r.host===l.host&&r.port===l.port&&r.scheme===l.scheme||(e.url=esri.config.defaults.io.proxyUrl+e.url),n.LayerUtilities.createFeatureLayerFromCsv(e,null).then(function(i){i&&i.setVisibility&&i.setVisibility(e.visibility),t.resolve(i)},function(e){t.reject(e)});break;case"GeoRSS":var u=new s.GeoRssLayerService(e.url);u.essentialsMap=this.site.essentialsMap;var c={displayName:e.title,serviceType:a.MapServiceType.GEORSS,connectionString:"url="+e.url,feedImageUri:e.pointSymbol?e.pointSymbol.url:null,opacity:e.opacity,id:e.id||o.alphaNumericToken(),visible:e.visibility};u._configureObject(c),t.resolve(u);break;case"WebTiledLayer":if(!e.wmtsInfo&&esri.layers&&esri.layers.WebTiledLayer){var p={id:e.id,subDomains:e.subDomains,copyright:e.copyright};i=new esri.layers.WebTiledLayer(e.templateUrl,p),e.title&&(i.name=e.title)}t.resolve(i);break;case"WMS":t.resolve(null);break;default:var h=null;e.url||e.featureCollection&&(h=this._addFeatureCollectionToMap(e.featureCollection)),t.resolve(h)}return t.promise},i.prototype._addFeatureCollectionToMap=function(e){var t=this.site.getMap(),i=[];return dojo.forEach(e.layers,function(e){var r=new esri.layers.FeatureLayer(e,{outSR:t.spatialReference});r.layerId=o.alphaNumericToken(),i.push(r)}),i},i.prototype._loadingRestComplete=function(e){this._isLoading=!1,!e&&this._onLoadingError&&this._onLoadingError(new Error("No results")),e.error&&this._onLoadingError&&this._onLoadingError(e.error),this._onLoadingComplete&&this._onLoadingComplete(e.results)},i.prototype._loadingRestError=function(e){this._isLoading=!1,this._onLoadingError&&this._onLoadingError(e)},i.prototype._configureObject=function(e,t){if(void 0===e||void 0===e.id)throw new Error("Incorrect Web Map reference object returned from initialization");this.displayName=e.displayName,this.id=e.id,t&&(this.isInitialized=!0),this._initializeWebMap(e,this.site,function(e){},function(e){throw e})},i}(r.AsyncInitializable);i.WebMapReference=l})},"geocortex/essentials/WFSLayerService":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./MapService","./RestHelperHTTPService"],function(e,i,r,n){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var s=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t._WFSLayerOptions=null,t._defaultMaxFeaturesInOnDemandMode=500,t._defaultMaxFeaturesInSnapshotMode=1e3,t._defaultWFSLayerMode="snapshot",t}return t(i,e),i.prototype._configureWFSSettings=function(e){var t=this.serviceUrl.indexOf("?");if(this.baseUrl=t>-1?this.serviceUrl.substring(0,t):this.serviceUrl,this.layers.length<1||!this.layers[0].wfsLayerName)throw new Error("Failed to initialize WFS layer. Layer name or layer not defined.");var i=this.layers[0].wfsLayerName.split(":")[1],r={url:this.baseUrl,name:i,layerName:i,mode:this._defaultWFSLayerMode,swapXY:!1,swapXYFilter:!1,version:"1.0.0"};e&&(e.version&&(r.version=e.version),e.spatialReference?r.wkid=this.operationalSpatialReference=e.spatialReference.wkid:e.operationalSpatialReference&&(r.wkid=this.operationalSpatialReference=e.operationalSpatialReference),e.mode&&(r.mode=e.mode),e.customParameters&&(r.customParameters=e.customParameters),e.infoTemplate&&(r.infoTemplate=e.infoTemplate));var n=e.properties&&e.properties.filter(function(e){return"maxFeatures"===e.name})[0]||null,s=e.maxFeatures||n&&n.value||null;(s=parseInt(s,10))&&!isNaN(s)?r.maxFeatures=s:r.maxFeatures=r.mode===this._defaultWFSLayerMode?this._defaultMaxFeaturesInSnapshotMode:this._defaultMaxFeaturesInOnDemandMode,this._WFSLayerOptions=r},i.prototype._configureObject=function(t,i){if(void 0===t)throw new Error("Incorrect map service object returned from initialization");this._restWFSConfigObject=t,e.prototype._configureObject.call(this,t,i)},i.prototype._createServiceLayer=function(){var t=this;this._configureWFSSettings(this._restWFSConfigObject),this.serviceToken&&(this._WFSLayerOptions.url=n.RestHelperHTTPService.appendTokenToUrl(this.serviceUrl,this.serviceToken));var i=new esri.layers.WFSLayer(this._WFSLayerOptions);i.id=this.id,this.serviceLayer=i,dojo.connect(i,"onError",dojo.hitch(this,this._layerLoadErrorHandler)),dojo.connect(i,"onLoad",dojo.hitch(this,this._handleServiceLayerLoaded)),i.initialize(this._WFSLayerOptions,function(e){i.selectLayer(t._WFSLayerOptions,function(e){t._initiallyVisible&&t.layers[0].configuredVisible?i.show():i.hide(),t.attributionDataUrl&&""!==t.attributionDataUrl?(i.attributionDataUrl=t.attributionDataUrl,i.hasAttributionData=!0):t.hasAttributionData&&(i.attributionDataUrl=t.url+"/Attribution",i.hasAttributionData=!0),i.onLoad(i)})}),e.prototype.initiateServiceFailureTimer.call(this)},i}(r.MapService);i.WFSLayerService=s})},"geocortex/essentials/Workflow":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./AsyncInitializable","./../workflow/ArgumentInfo","./../workflow/ExternalActivityInfo","./../geocortex"],function(e,i,r,n,s,a){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=function(e){function i(t){var i=e.call(this,t)||this;return i.displayName=null,i.error=null,i.extensions=[],i.externalActivities={},i.id=null,i.properties={},i.site=null,i._inputs=[],i._outputs=[],i}return t(i,e),i.prototype.getInputs=function(){return this._cloneArgumentInfoCollection(this._inputs)},i.prototype.getOutputsMetadata=function(){return this._cloneArgumentInfoCollection(this._outputs)},i.prototype._cloneArgumentInfoCollection=function(e){var t=null;if(null!==e){t=[];for(var i=0;i "+t,i);return r},t.getValue=function(e,t){if(e){var i=e;if(dojo.isString(e)){var r=e.split(" > ");i=this.getNodes(r[0],r[1],t)[0]}return i.firstChild&&i.firstChild.nodeValue?i.firstChild.nodeValue:"Node not valid"}return"No Value"},t.getAttribute=function(e,t){if(e){if(dojo.isIE){for(var i=0;i=4.05,this.onInitializeAttempt()},e.prototype.onInitialized=function(){return this._initializeDeferred.promise},e.prototype.onInitializeAttempt=function(){var t=this;if(this._initializeAttemptThenable)return this._initializeAttemptThenable;if(!this.supported){var i=new Error("The Document Store is not supported in the current version of Essentials.");return this._initializeDeferred.reject(i),this._initializeAttemptThenable=(new dojo.Deferred).reject(i)}return this._initializeAttemptThenable=n.request({url:this._rootUrl+"/self",content:{f:"json"},handleAs:"json"},{usePost:!1}).then(e._processError).then(function(e){t._processSelf(e),t.isInitialized=!0,t._initializeDeferred.resolve()}).then(null,function(e){throw t._initializeAttemptThenable=null,e})},e.prototype.getRootUrl=function(){return this._verifySupported(),this._rootUrl+"/"},e.prototype.canCreate=function(){return this.userMonikers.length>0},e.prototype.hasPolicyGrant=function(e){return this.policyMonikers.some(function(t){return t.grants.some(e)})},e.prototype.add=function(e){var t=this,i={document:dojo.mixin({},e)};void 0!==e.content&&(i.json=e.content,delete i.document.content);var r=s.writeDocument(i);return this.perform(r,!0).then(function(e){return e.document}).then(function(e){return t._processDocument(e)})},e.prototype.addFromFormData=function(e){throw new Error("Not implemented.")},e.prototype.addFromForm=function(e){throw new Error("Not implemented.")},e.prototype.getById=function(t,r,n){var a=this;if(void 0===r&&(r=!1),void 0===n&&(n=i.DocumentFormat.JSON),this._verifyDocId(t),r){var o=s.readDocument(t,n);return this.perform(o).then(function(t){return e._processReadDocumentResponse(t,n)}).then(function(e){return a._processDocument(e)})}var l=s.peekDocument(t);return this.perform(l).then(function(e){return e.document}).then(function(e){return a._processDocument(e)})},e.prototype.getContentUrl=function(e){throw new Error("Not implemented.")},e.prototype.updateById=function(e,t){var i=this;this._verifyDocId(e),t.timeOfLastModification||(t.timeOfLastModification=null),t.editor||(t.editor=null);var r=[];for(var n in t)t.hasOwnProperty(n)&&r.push(n);if(void 0!==t.content){var a={json:t.content};delete t.content,a.document=dojo.mixin({id:e,updates:r},t);var o=s.writeDocument(a);return this.perform(o,!0).then(function(e){return e.document}).then(function(e){return i._processDocument(e)})}var l=dojo.mixin({id:e,updates:r},t),u=s.updateDocument(l);return this.perform(u,!0).then(function(e){return e.document}).then(function(e){return i._processDocument(e)})},e.prototype.deleteById=function(e){var t=this;this._verifyDocId(e);var i=s.deleteDocument(e);return this.perform(i,!0).then(function(e){return e.document}).then(function(e){return t._processDocument(e)})},e.prototype.query=function(t){var i=this,r=dojo.mixin({},t);r.sort&&r.sort.forEach(function(t,i,r){e.matchesFilterFields.some(function(e){return e===t})&&(r[i]="{0}_exact".format(t))}),r.sortDescending&&r.sortDescending.forEach(function(t,i,r){e.matchesFilterFields.some(function(e){return e===t})&&(r[i]="{0}_exact".format(t))});var n=s.searchDocuments(r);return this.perform(n).then(function(e){return Array.isArray(e.matchingDocuments.results)&&e.matchingDocuments.results.forEach(function(e){return i._processDocument(e.entity)}),e.matchingDocuments})},e.prototype.perform=function(t,i){var r=this;if(void 0===i&&(i=!1),!t.action)throw new Error("The Document Store batch request does not contain an action");var s=t.action;return"perform"!==s&&delete t.action,this._guestLink&&(t.link=this._guestLink),t.f="json",this.onInitializeAttempt().then(function(){return r._verifySupported()}).then(function(){return n.request({url:r._rootUrl+"/"+s,content:n.encodeJson(t),handleAs:"json"},{usePost:i})}).then(e._processError)},e.prototype.isOwner=function(e){return!e||!e.access||e.access.change},e.prototype.isReadOnly=function(e){return!(!e||!e.access||!e.access.view||e.access.edit||e.access.change)},e.prototype.isPublic=function(e){return!!(e&&e.id&&e.grants)&&e.grants.some(function(e){return e.globalId===i.GrantID.PUBLIC&&(!1===e.revoke||!0===e.assert)})},e.prototype.setGuestLink=function(e){this._guestLink=e},e._processError=function(e){if(e.error)throw e.error;return e},e.prototype._processDocument=function(e){return e.timeOfCreation&&(e.timeOfCreation=new Date(e.timeOfCreation)),e.timeOfLastAccess&&(e.timeOfLastAccess=new Date(e.timeOfLastAccess)),e.timeOfLastModification&&(e.timeOfLastModification=new Date(e.timeOfLastModification)),e.timeOfDeletion&&(e.timeOfDeletion=new Date(e.timeOfDeletion)),e.timeOfExpiration&&(e.timeOfExpiration=new Date(e.timeOfExpiration)),e.access&&!e.access.monikerIds&&(e.access.monikerIds=this.userMonikers.map(function(e){return e.id})),e},e._processReadDocumentResponse=function(e,t){var i=e.content.document;return i.content=e.content[t],i},e.prototype._processSelf=function(e){if(this.self=e.monikers,this.userMonikers=e.monikers.filter(function(e){return e.kind===i.MonikerKind.USER}),this.policyMonikers=e.monikers.filter(function(e){return e.kind===i.MonikerKind.POLICY}),this.userMonikers.length>0){var t=this.userMonikers.map(function(e){return{string:"{0}|{1}".format(i.GrantKind.OWNER,e.globalId)}});this.userFilter={field:i.DocumentField.GRANT_TOKEN,method:i.FilterMethod.VALUES,range:t}}},e.prototype._verifyDocId=function(e){if(!e)throw new Error("The Document ID must be set.");if(/[/?#\s]/.test(e))throw new Error("The Document ID '{0}' contains illegal characters.".format(e))},e.prototype._verifySupported=function(){if(!this.supported)throw new Error("The Document Store is not supported in the current version of Essentials.")},e}();a.matchesFilterFields=[i.DocumentField.TITLE,i.DocumentField.DESCRIPTION,i.DocumentField.ISSUER_TITLE,i.DocumentField.AUTHOR_TITLE,i.DocumentField.AUTHOR_DESCRIPTION,i.DocumentField.AUTHOR_ISSUER_TITLE,i.DocumentField.EDITOR_TITLE,i.DocumentField.EDITOR_DESCRIPTION,i.DocumentField.EDITOR_ISSUER_TITLE],t.DocumentStore=a})},"geocortex/essentials/documents/Parameters":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/exportMap/BingEnvironment":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PRODUCTION="Production"})},"geocortex/essentials/exportMap/ExportContext":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/exportMap/ExportDynamicMapLayerDefinition":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/exportMap/ExportFeature":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/exportMap/ExportFeatureCollection":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/exportMap/ExportLayer":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/exportMap/ExportLayerFeatureSet":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/exportMap/ExportLayoutOptions":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/exportMap/ExportMapLayerDefinition":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/exportMap/ExportMapOptions":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/exportMap/ExportMapParameters":function(){define(["require","exports","./../ReportParameters"],function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){this.operationParameters=null,this.reportParameters=null,this.queryParameters=null,this.operationParameters={},this.reportParameters=new i.ReportParameters};t.ExportMapParameters=r})},"geocortex/essentials/exportMap/ExportMapService":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})})},"geocortex/essentials/exportMap/ExportMapTask":function(){define(["require","exports","./../../geocortex","./../utilities/UrlUtilities","./../utilities/PrintUtilities","./../utilities/PromiseUtilities","./ExportMapTypes","./BingEnvironment","./../ReportParameters","./../utilities/GraphicsLayerUtilities"],function(e,t,i,r,n,s,a,o,l,u){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e){if(this.resource=null,this._esriMap=null,this._essentialsRestUrl=null,this._site=null,this._populateFromResource(e),!this._esriMap||!this._essentialsRestUrl)throw new Error("Unable to create ExportMapTask from the resource.")}return e.prototype._populateFromResource=function(e){e.hasOwnProperty("extentManager")?(this._esriMap=e.getMap(),this._essentialsRestUrl=e.url+"/export",this._site=e.site):e.hasOwnProperty("maximumResolution")?(this._esriMap=e.site.getMap(),this._essentialsRestUrl=e.url+"/print",this._site=e.site):e&&(this._esriMap=e.site.getMap(),this._essentialsRestUrl=e.url+"/run",this._site=e.site)},e.prototype.generateMapImageUrl=function(e){var t=this,r=new dojo.Deferred;return this._marshalContent(e).then(function(e){var n={url:t._essentialsRestUrl,content:e,load:r.resolve,error:r.reject,callbackParamName:"CallBack"};i.request(n)}),r},e.prototype._getWebMap=function(e,t,i){var r=new esri.tasks.PrintTemplate;r.outScale=i;for(var n=[],s=0,a=t.graphicsLayerIds;s=0;t--){var i=e.operationalLayers[t].id;i&&u.getGraphicsLayerIdsToExclude([u.excludeFromExportMapTaskName]).indexOf(i)>-1&&e.operationalLayers.splice(t,1)}},e.prototype._convertSymbolsToBase64=function(e){for(var t=new dojo.Deferred,i=[],a={},o=0;o0&&r.featureSet&&r.featureSet.features&&r.featureSet.features.length>0&&r.featureSet.features.length/i.featureSet.features.length==1.5){for(var a=[];i.featureSet.features.length>0;)a.push(r.featureSet.features.pop()),a.push(r.featureSet.features.pop()),a.push(r.featureSet.features.pop()),a.push(i.featureSet.features.pop()),a.push(i.featureSet.features.pop());i.featureSet.features=a.reverse()}break}}},e.prototype._getLayer=function(e,t){for(var i=0;i-1&&r.featureCollection&&r.featureCollection.layers)return r}},e.prototype._adjustSvgSymbols=function(e){for(var t=e.id,i=[],r=this._esriMap.getLayer(t).graphics.filter(function(e){return!("simplemarkersymbol"!=e.symbol.type||!e.visible)}),n=0;n1){var l=o[1];e.mapServiceId=l}}else!a.layerId||e.id.indexOf("-")>-1||(e.mapServiceId=a.layerId);break}}})},e.prototype._handleHeatmapRenderer=function(e,t){t.layerIds.concat(t.graphicsLayerIds).forEach(function(i){var r=t.getLayer(i);if(r.visible&&void 0!==r.renderer&&r.renderer instanceof esri.renderer.HeatmapRenderer)for(var n=r.minScale?r.minScale:0,s=r.maxScale?r.maxScale:0,a=r.getDefinitionExpression()?r.getDefinitionExpression():"",o=r.gdbVersion?r.gdbVersion:"",l=r.renderer.toJson(),u=r.url,c=r.renderer.field?r.renderer.field:"",p={renderer:l},h={type:"HeatMap",id:i,opacity:1,minScale:n,maxScale:s,where:a,gdbVersion:o,url:u,layerDefinition:{name:r.name,geometryType:"esriGeometryPoint",displayField:c},drawingInfo:p},d=0;d0)for(var c=0;c=0){var t=new r.FeatureLayerService(n);return t._configureObject(e,!0),t}var s=new i.MapService(n);return s._configureObject(e,!0),s})},e}();t.ServiceDiscoveryServicePoint=n})},"geocortex/essentials/serviceDiscovery/SiteServiceDiscoveryProvider":function(){define(["require","exports","./../utilities/UrlUtilities","geocortex/framework/SimplePromise","./../../geocortex","./../ServiceHelper","./../utilities/ServiceDiscoveryUtilities"],function(e,t,i,r,n,s,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(){this.initialized=!1,this.supported=!1}return e.prototype.initialize=function(e){this._site=e,this._rootUrl=i.UrlUtilities.resolveUrl(e.url,"/../../../connections",!0),this.supported=e.getEssentialsVersion()>=4.05,this.initialized=!0},e.prototype.getRootUrl=function(){return this._rootUrl},e.prototype.suggestHints=function(e){var t={f:"json",term:e};return this.sendRequest("suggest",t).then(function(e){return e.hints})},e.prototype.findServices=function(e,t){var i=this,r={f:"json",term:e,whitelistOnly:!0};return t&&(r=dojo.mixin(r,t)),this.sendRequest("find",r).then(function(e){return Array.isArray(e.results)&&e.results.forEach(function(e){return i._processItem(e)}),e.results})},e.prototype.expandService=function(e){var t=this,i=this._getConnectionId(e),r={f:"json",providerName:e.serviceProviderName,url:e.url};return this.sendRequest(i+"/expand",r).then(function(e){return t._processItem(e)})},e.prototype.realizeMapService=function(e,t){var i=this,r=this._getConnectionId(e),n={f:"json",providerName:e.serviceProviderName,url:e.url,sr:t,itemId:e.id||"null"};return this.sendRequest(r+"/realize",n).then(function(t){return i._createMapService(e,t)})},e.prototype.sendRequest=function(e,t){var s=this;return r.SimplePromise.resolve(null).then(function(){return s._verifyInitialized()}).then(function(){return s._verifySupported()}).then(function(){return t.f=t.f||"json",n.request({url:i.UrlUtilities.resolveUrl(s._rootUrl,e),content:n.encodeJson(t),handleAs:"json"})}).then(this._processError)},e.prototype._getConnectionId=function(e){return e.connection&&null!=e.connection.id?e.connection.id:"none"},e.prototype._processError=function(e){if(e&&e.error)throw e.error;return e},e.prototype._processItem=function(e){var t=e;if(t.connection&&null!=t.connection.id?t.isWhitelisted=!0:t.isWhitelisted=!1,!t.thumbnailUrl){var r=this._getConnectionId(t)+"/preview?f=json&providerName="+t.serviceProviderName+"&url="+t.url;t.thumbnailUrl=i.UrlUtilities.resolveUrl(this._rootUrl,r)}if(t.children)for(var n=0,s=t.children;n1&&(this.query=dojo.queryToObject(t[1])),this.fragment=dojo.queryToObject(e.indexOf("#")>=0?e.substring(e.indexOf("#")+1,e.length):"")}return e.prototype.recompose=function(){var e=this.schemeHostAndPath;return this.query&&this.anyProperties(this.query)&&(e+="?"+dojo.objectToQuery(this.query)),this.fragment&&this.anyProperties(this.fragment)&&(e+="#"+dojo.objectToQuery(this.fragment)),e},e.prototype.anyProperties=function(e){for(var t in e)return!0;return!1},e.getHost=function(e){if(!e)return null;var t=e.match(/^http[s]?:\/\/([^\/]*)/);return t.length>1?t[1]:null},e.appendToPath=function(t,i){var r=new e(t);return r.schemeHostAndPath+=i,r.recompose()},e.removeQueryParameters=function(t){for(var i=[],r=1;r2?e[0]+e[1]/60+e[2]/3600:e.length>1?e[0]+e[1]/60:e[0]},e.getExifTagsFromImageBytes=function(t){if(0==t.byteLength)return{};var i=t.byteLength,r=new DataView(t);if(i<2||65496!=r.getUint16(0))return{};for(var n=2;n+4i)throw new Error("Unexpected end of file.");if(225===s)return e.getExifTags(r,n+4,a-2)}return{}},e.base64ToArrayBuffer=function(e,t){t=t||e.match(/^data\:([^\;]+)\;base64,/im)[1]||"",e=e.replace(/^data\:([^\;]+)\;base64,/gim,"");for(var i=atob(e),r=i.length,n=new ArrayBuffer(r),s=new Uint8Array(n),a=0;a4?d:i+8,o=[],l=0;l4?d:i+8,e.getStringFromBytes(t,a,h-1);case 3:if(1==h)return t.getUint16(i+8,s);for(a=h>2?d:i+8,o=[],l=0;l0&&e.forEach(function(e){i[e]||(i[e]=[]),i[e].indexOf(t)<0&&i[e].push(t)})},t.removeFromGraphicsLayerIdsToExclude=function(e,t){t&&t.length>0&&e.forEach(function(e){if(i[e]){var r=i[e].indexOf(t);r>=0&&i[e].splice(r,1)}})}})},"geocortex/essentials/utilities/ImageUtilities":function(){define(["require","exports"],function(e,t){"use strict";function i(e,t,i,r){if(e0||a.indexOf("Trident/")>0)&&(n={features:["js"]}),e(n).resize(t,o,{alpha:!0}).then(function(e){return s(o.toDataURL("image/png"))})})})})}function n(e){return new Promise(function(t,i){if("string"==typeof e){var r=new Image;r.onload=function(){t(r)},r.src=e}else t(e)})}Object.defineProperty(t,"__esModule",{value:!0}),t.calculateAspectRatioFit=i,t.resizeImage=r,t.resizeImageToMaxDimensions=function(e,t,s){return n(e).then(function(e){var n=i(e.width,e.height,t,s);return r(e,n.width,n.height)}).then(function(e){return e})},t.getRawByteDataFromDataUri=function(e){return decodeURIComponent(e.substring(e.indexOf("base64,")+7))}})},"geocortex/essentials/utilities/LayerUtilities":function(){define(["require","exports","geocortex/framework/utils/utils"],function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.createFeatureLayerFromCsv=function(e,t){var r=new dojo.Deferred;if(!e)return r.resolve(null),r;var n=new dojox.data.CsvStore({url:e.url,separator:e.columnDelimiter||","});return n.fetch({onComplete:function(s,a){var o,l,u=0,c=e.layerDefinition,p={layerDefinition:c,featureSet:{features:[],geometryType:"esriGeometryPoint"}},h=null,d=null;t&&(h=t.lowerBound||0,d=t.upperBound||s.length),(h||d)&&(s=s.slice(h,d)),dojo.forEach(s,function(t,i){0===i&&e.locationInfo&&(o=e.locationInfo.latitudeFieldName,l=e.locationInfo.longitudeFieldName),n.getIdentity(t);var r=n.getAttributes(t),s={};dojo.forEach(r,function(e){var i=Number(n.getValue(t,e));isNaN(i)?s[e]=n.getValue(t,e):s[e]=i}),s.__OBJECTID=u,u++;var a=parseFloat(s[o]),c=parseFloat(s[l]);if(!isNaN(a)&&!isNaN(c)){var h={geometry:new esri.geometry.Point(c,a).toJson(),attributes:s};p.featureSet.features.push(h)}});var f=new esri.layers.FeatureLayer(p),y=null;c&&c.drawingInfo&&c.drawingInfo.renderer&&c.drawingInfo.renderer.symbol&&"esriPMS"===c.drawingInfo.renderer.symbol.type&&(y=c.drawingInfo.renderer.symbol),null!=y&&(f.renderer.symbol.imageData=y.imageData,f.renderer.symbol.url=y.url),e.title&&(f.name=e.title),f.layerId=e.id||i.alphaNumericToken(),r.resolve(f)}}),r},e.decomposeFeatureLayerUrl=function(e){var t=/(.+?)\/([0-9]*)(\?.*)?$/g.exec(e);return{serviceUrl:t[1],layerId:parseInt(t[2]),queryString:t[3]}},e}();t.LayerUtilities=r})},"geocortex/essentials/utilities/PrintUtilities":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.adjustTextSymbol=function(e,t){if(e&&e.symbol instanceof esri.symbol.TextSymbol){var i=function(e,t){t.font.size=void 0!=e.font.size&&"number"==typeof e.font.size?Math.round(e.font.size)+"px":e.font.size,t.x=e.x,t.y=e.y,t.xoffset=e.xoffset,t.yoffset=e.yoffset,t.align=e.align,t.angle=e.angle,t.color.hasOwnProperty("a")&&(t.color.a=e.color.a>=0&&e.color.a<=1?255*e.color.a:e.color.a)},r=new esri.symbol.TextSymbol(e.symbol.toJson());if(r.color=new esri.Color({r:e.symbol.color.r,g:e.symbol.color.g,b:e.symbol.color.b,a:e.symbol.color.a}),i(e.symbol,r),r.toJson&&"function"==typeof r.toJson){var n=r.toJson;r.toJson=function(){var e=n.call(r);return i(r,e),e}}var s=null,a=null;if(t){var o=document.getElementById(t+"_layer"),l=null;(l=document.createElementNS("http://www.w3.org/2000/svg","text")).setAttributeNS(null,"font-size",r.font.size.toString()),l.setAttributeNS(null,"font-family",r.font.family),l.setAttributeNS(null,"visibility","hidden"),l.textContent=r.text,o.appendChild(l);var u=l.getBBox();a=null===a?u.height:a,s=null===s?l.getComputedTextLength():s,o.removeChild(l)}else{var c=document.body,p=document.createElement("div"),h={fontFamily:r.font.family,fontSize:r.font.size,fontWeight:r.font.weight,padding:"0",position:"absolute",lineHeight:"1",visibility:"hidden"};for(var d in h)p.style[d]=h[d];p.appendChild(document.createTextNode(r.text)),c.appendChild(p),s=p.clientWidth,a=p.clientHeight,c.removeChild(p)}if(r.xoffset=0===r.angle?r.xoffset:0,r.yoffset=0===r.angle?r.yoffset:0,(e.measurementId||e.coordinateId)&&e.attributes&&e.attributes.numberOfLines){if(e.measurementId?r.xoffset=-(s/2+a/4):r.xoffset=-(s/4+a/2),r.yoffset=e.attributes.numberOfLines&&1==e.attributes.numberOfLines?a/2:r.yoffset,"start"==r.verticalAlignment&&e.attributes.numberOfLines&&e.attributes.numberOfLines>1){var f=e.attributes.numberOfLines;r.yoffset=r.yoffset-.5*a/2+a*f/2}}else{switch(r.verticalAlignment){case"top":break;case"middle":r.yoffset+=a/2;break;default:r.yoffset+=.75*a}e.attributes&&e.attributes.customVerticalAlignment&&"middle"===e.attributes.customVerticalAlignment&&(r.xoffset=0,r.yoffset=0,r.yoffset+=Math.ceil(a/2));var y=r.horizontalAlignment||r.align||null;if(y)switch(y){case esri.symbol.TextSymbol.ALIGN_MIDDLE:case"center":case"justify":r.xoffset-=Math.ceil(s/2),e.coordinateId||(r.xoffset-=Math.ceil(a/4));break;case esri.symbol.TextSymbol.ALIGN_END:case"right":r.xoffset-=s}}return r}return null},e.adjustPictureMarkerSymbol=function(e){if(e&&e.symbol instanceof esri.symbol.PictureMarkerSymbol){var t=new esri.symbol.PictureMarkerSymbol(e.symbol.toJson());if(t.toJson&&"function"==typeof t.toJson){var i=t.toJson;t.toJson=function(){var e,r,n=i.call(t);return n.color=[0,0,0,255],isNaN(e=parseInt(t.width,10))||isNaN(r=parseInt(t.height,10))||(n.width=e,n.height=r,n.xoffset=isNaN(parseInt(n.xoffset))?e/2:n.xoffset+e/2,n.yoffset=isNaN(parseInt(n.yoffset))?r/2:n.yoffset-r/2),n}}return t}return null},e.getImageAsBase64=function(e,t){void 0===t&&(t="image/png");var i=new dojo.Deferred,r=document.createElement("canvas"),n=r.getContext("2d"),s=new Image;return s.onload=function(){r.height=s.height,r.width=s.width,n.drawImage(s,0,0);try{var a=r.toDataURL(t);i.resolve({url:e,data:a.replace(/^data:image\/(png|jpg);base64,/,"")})}catch(t){i.reject({url:e,error:t})}},s.onerror=function(t){i.reject({url:e,error:new Error("Failed to download image.")})},s.src=e,i},e}();t.PrintUtilities=i})},"geocortex/essentials/utilities/PromiseUtilities":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){this.state={fulfilled:!1,rejected:!1}}return e.prototype.fulfill=function(e){this.state.fulfilled=!0,this.state.value=e},e.prototype.reject=function(e){this.state.rejected=!0,this.state.reason=e},e.prototype.isFulfilled=function(){return this.state.fulfilled},e.prototype.isRejected=function(){return this.state.rejected},e.prototype.isPending=function(){return!this.state.fulfilled&&!this.state.rejected},e.prototype.value=function(){return this.state.value},e.prototype.reason=function(){return this.state.reason},e}(),r=function(){function e(){}return e.settle=function(t){if(dojo.isArray(t))return e._settleImpl(t);if(t.then)return t.then(function(t){return e._settleImpl(t)});throw new Error("Unknown parameter type. Must be an array of promises or a promise of array of promises.")},e._settleImpl=function(e){var t,r=new dojo.Deferred,n=e.map(function(e){var r=new i;return e&&"function"==typeof e.then?e.then(function(e){r.fulfill(e),t&&t()},function(e){r.reject(e),t&&t()}):r.fulfill(e),r});return(t=function(){n.every(function(e){return!e.isPending()})&&r.resolve(n)})(),r.promise},e}();t.PromiseUtilities=r})},"geocortex/essentials/utilities/ServiceDiscoveryUtilities":function(){define(["require","exports","./../MapService","./../FeatureLayerService","./../WFSLayerService","./../StreamLayerService","./../MapServiceConstants","geocortex/framework/SimplePromise","geocortex/framework/utils/utils"],function(e,t,i,r,n,s,a,o,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(){}return e.buildMapService=function(e,t){return new o.SimplePromise(function(o,u){if(!e)throw new Error('ServiceDiscoveryUtilities.buildMapService: Parameter "essentialsMap" is required.');if(!t)throw new Error('ServiceDiscoveryUtilities.buildMapService: Parameter "serviceDefinition" is required.');var c,p,h,d={id:l.alphaNumericToken(),connectionString:t.serviceUrl?"url="+t.serviceUrl:void 0},f=dojo.mixin(d,t);if(f.drawingBehavior===a.DrawingBehavior.FEATURE_LAYER){if(!dojo.isObject(esri.layers.FeatureLayer))throw new Error("This Javascript application must require the esri.layers.FeatureLayer package in order to use a site with feature layers");c=new r.FeatureLayerService}else if(f.drawingBehavior===a.DrawingBehavior.GEORSS_LAYER){if(!dojo.isObject(esri.layers.GraphicsLayer))throw new Error("This Javascript application must require the esri.layers.GraphicsLayer package in order to use a site with GeoRSS layers");c=new geocortex.essentials.GeoRssLayerService}else if(f.drawingBehavior===a.DrawingBehavior.KML_SERVICE){if(!dojo.isObject(esri.layers.KMLLayer))throw new Error("This Javascript application must require the esri.layers.KMLLayer package in order to use a site with KML layers");c=new geocortex.essentials.KmlService}else if(f.drawingBehavior===a.DrawingBehavior.WFS_LAYER){if(!dojo.isObject(esri.layers.WFSLayer))throw new Error("This Javascript application must require the esri.layers.WFSLayer package in order to use a site with feature WFS layers");c=new n.WFSLayerService}else if(f.drawingBehavior===a.DrawingBehavior.STREAM_LAYER){if(!dojo.isObject(esri.layers.StreamLayer))throw new Error("This Javascript application must require the esri.layers.StreamLayer package in order to use a site with Stream layers");var y=f.layers[0];y&&f.displayName&&(y.displayName=f.displayName),c=new s.StreamLayerService}else c=new i.MapService;c.isUserCreated=!0,c.userLayerType=a.UserLayerType.LAYER_ADDITION,c.essentialsMap=e,c.initialize(f),c instanceof r.FeatureLayerService&&(c.moveEnabled=!0,c.rotateEnabled=!0,c.editVerticesEnabled=!0,c.scaleEnabled=!0);for(var m=0,v=c.layers;m0)g.supportsIdentify=g.supportsQuery=g.identifiable=g.queryable=!1;else{g.identifiable=g.supportsIdentify,g.queryable=g.supportsQuery,g.searchable=!0,g.showMapTips=!0,(c instanceof s.StreamLayerService||c instanceof n.WFSLayerService)&&(g.identifiable=g.supportsIdentify=!0,g.queryable=g.supportsQuery=!1);var _=c.serviceLayer,S=_ instanceof esri.layers.GraphicsLayer||_ instanceof esri.layers.ArcGISDynamicMapServiceLayer;g.snappable=S,g.snappingEnabled=S}}if(c.serviceLayer.loaded)return o(c);p=c.serviceLayer.on("load",function(e){return p&&p.remove(),h&&h.remove(),o(c)}),h=c.serviceLayer.on("error",function(e){return p&&p.remove(),h&&h.remove(),u(e.error)})})},e}();t.ServiceDiscoveryUtilities=u})},"geocortex/essentials/utilities/SiteResourceIdComparer":function(){define(["require","exports","./StringUtilities"],function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.equals=function(e,t){return!(!e||!t||e!==t&&!i.StringUtilities.endsWith(e,this.separator+t))},e.lookUp=function(e,t){if(e&&t){var r=0,n=null;for(r=0;r=1){for(n=0;n0){var r=e.childNodes[0].prefix;if(""!=r&&(i=e.getElementsByTagName(r+":"+t)).length>=1)for(var n=0;nthis._version)throw new Error("Form version "+u+" is incompatible with current API version "+this._version);this.title=new i.Observable(r.getElementText(l,"Title")),this.maxWidth=new i.Observable(parseInt(r.getElementText(l,"MaxWidth"))),this.maxHeight=new i.Observable(parseInt(r.getElementText(l,"MaxHeight")));var c=r.getElement(l,"KnownTypes");if(null!=c)for(h=0;h=0){var r=e.attributes[i].nodeValue,n=r.indexOf(":");n>=0&&n+10?this.selected.set(e[0]):this.dataItems.length()>0&&this.selected.set(this.dataItems.getAt(0))},i.prototype._render=function(){return u.renderFormItem(this)},i}(r.AbstractFormItem);i.ComboBoxFormItem=p})},"geocortex/forms/items/ContainerFormItem":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./FormItem","geocortex/framework/observables","./../../forms"],function(e,i,r,n,s){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var a=function(e){function i(t,i){var r=e.call(this,t,i)||this;if(r.formItems=new n.ObservableCollection,r.formItemType="ContainerFormItem",r.createElementDelegate=function(e,t){return i.createElementDelegate(e,t)},t){r.orientation=new n.Observable(s.getElementText(t,"Orientation")),r.description=new n.Observable(s.getElementText(t,"Description")),r.maxWidth=new n.Observable(parseInt(s.getElementText(t,"MaxWidth"))),r.visibleControlID=new n.Observable(s.getElementText(t,"VisibleControlID")),r.visibleControlValue=new n.Observable(s.getElementText(t,"VisibleControlValue"));var a=s.getElement(t,"FormItems");if(null!=a)for(var o=0;o=0&&(r.formItems.removeAt(e),r.formItems.insertItem(e,r))})}}else r.orientation=new n.Observable("Vertical"),r.description=new n.Observable(""),r.maxWidth=new n.Observable(NaN),r.visibleControlID=new n.Observable(""),r.visibleControlValue=new n.Observable("");return r}return t(i,e),i.prototype.validate=function(){var e=[];if(this.isVisible.get()&&null!=this.formItems)for(var t=0;t=0;e--)this.formItems.getAt(e)._destroy();this.formItems.clear()},i.prototype._render=function(){return s.renderFormItem(this)},i.prototype.getFormItemById=function(e){for(var t=0,i=this.formItems.length();t=0){c=!1;break}}r.nullable.set(c),r.dateFormat=new s.Observable(o.getElementText(t,"DateFormat")),r.includeTimePicker=new s.Observable("true"===o.getElementText(t,"IncludeTimePicker"));var f=null;r.includeTimePicker.get()&&(r.timePickerItem=new a.TimePickerFormItem(o.getElement(t,"TimePickerItem")),f=r.timePickerItem.initialTime.get());var y=o.getElementText(t,"InitialDate");if(u=null===o.getElementText(t,"InitializeWithCurrentDate")?!y:"true"===o.getElementText(t,"InitializeWithCurrentDate"),y){if(l.containsTimezone(y)){var m=Math.max(y.lastIndexOf("Z"),y.lastIndexOf("+"),y.lastIndexOf("-"));m>0&&(y=y.substring(0,m))}y+=l.getTimezoneString()}var v=null;(u||y)&&(v=new Date(y)),v&&!isNaN(v.getTime())?(v.getTimezoneOffset()!=l.getTimezoneOffset()&&v.setTime(v.getTime()-6e4*(l.getTimezoneOffset()-v.getTimezoneOffset())),f&&(v.setHours(f.getHours()),v.setMinutes(f.getMinutes()),v.setSeconds(f.getSeconds())),r.initialDate=new s.Observable(v)):r.initialDate=new s.Observable(f)}else r.dateFormat=new s.Observable,r.initialDate=new s.Observable(null),r.includeTimePicker=new s.Observable(!1);if(u){var g=new Date;r.includeTimePicker.get()||(g.setHours(0),g.setMinutes(0),g.setSeconds(0)),r.date=new s.Observable(g),r.initialDate.set(g)}else r.date=new s.Observable(r.initialDate.get());return r.date.bind(null,function(e){return r._notifyResultChanged()}),r}return t(i,e),i.prototype.getResult=function(){var e=this.date.get(),t=null===e?null:new Date(e.toString());if(t)if(isNaN(t.getTime()))t=this.initialDate.get();else{var i=0,r=!this.attached_pickerType||!this.attached_pickerType.get||this.attached_pickerType.get().toLowerCase().indexOf("native")>-1;e instanceof Date||this.includeTimePicker.get()||!r||(i=6e4*t.getTimezoneOffset()),t="/Date({0})/".format(t.getTime()+i)}return new u.FormItemResult(this.argumentName.get(),t)},i.prototype._render=function(){return o.renderFormItem(this)},i}(r.AbstractFormItem);i.DatePickerFormItem=c})},"geocortex/forms/items/FilePickerFormItem":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./FormItem","./LabelContainer","geocortex/framework/observables","./../../forms","./FormItemResult","./../../workflow/ArgumentValueWrapper"],function(e,i,r,n,s,a,o,l){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var u=function(e){function i(t,i){var r=e.call(this,t,i)||this;return r.files=new s.ObservableCollection,r.formItemType="FilePickerFormItem",r.isSupported=new s.Observable("undefined"!=typeof FileReader&&r._isFileInputSupported()),t?(r.acceptFileTypes=new s.Observable(a.getElementText(t,"AcceptFileTypes")),r.allowMultiple=new s.Observable(a._parseBoolean(a.getElementText(t,"AllowMultiple")))):(r.acceptFileTypes=new s.Observable(null),r.allowMultiple=new s.Observable(!1)),n.initLabelContainer(r,t,i),r.files.bind(null,function(e){return r._notifyResultChanged()}),r}return t(i,e),i.prototype.clear=function(){this.files.clear(),this.refresh()},i.prototype.getResult=function(){for(var e=[],t=0;tparseInt(o)?r.height.set("auto"):r.width.set("auto"):(r.width=new n.Observable("auto"),r.height=new n.Observable("auto"))}else r.source=new n.Observable(""),r.width=new n.Observable("auto"),r.height=new n.Observable("auto");return r}return t(i,e),i.prototype._render=function(){return s.renderFormItem(this)},i}(r.AbstractFormItem);i.ImageFormItem=a})},"geocortex/forms/items/LabelContainer":function(){define(["require","exports","./LabelFormItem","./../../forms"],function(e,t,i,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initLabelContainer=function(e,t,n){t?(e.label=new i.LabelFormItem(r.getElement(t,"Label")),""==e.label.toolTip.get()&&null!=e.toolTip&&e.label.toolTip.set(e.toolTip.get())):e.label=new i.LabelFormItem(null)}})},"geocortex/forms/items/LabelFormItem":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./FormItem","geocortex/framework/observables","./../../forms"],function(e,i,r,n,s){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var a=function(e){function i(t,i){var r=e.call(this,t,i)||this;return r.formItemType="LabelFormItem",t?(r.text=new n.Observable(s.getElementText(t,"Text")),r.labelForItemID=new n.Observable(s.getElementText(t,"LabelForItemID"))):(r.text=new n.Observable(null),r.labelForItemID=new n.Observable(null)),r}return t(i,e),i.prototype._render=function(){return s.renderFormItem(this)},i}(r.AbstractFormItem);i.LabelFormItem=a})},"geocortex/forms/items/ListBoxFormItem":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./FormItem","./LabelContainer","./QueryTaskFormItem","./LabelFormItem","geocortex/framework/observables","./DataItemsFormItem","./../../forms","./FormItemResult"],function(e,i,r,n,s,a,o,l,u,c){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var p=function(e){function i(t,i){var r=e.call(this,t,i)||this;if(r.selection=new o.ObservableCollection,r.selectedValues=new o.ObservableCollection,r._selectedValuesLookup=null,r.isBusy=new o.Observable(!1),r.formItemType="ListBoxFormItem",n.initLabelContainer(r,t,i),l.initDataItemsFormItem(r,t,i),r.size=new o.Observable(6),t){r.maxHeight=new o.Observable(parseInt(u.getElementText(t,"MaxHeight"))),r.selectionMode=new o.Observable(u.getElementText(t,"SelectionMode"));var c=u.getElementText(t,"Size");if(c){var p=parseInt(c);p>0&&r.size.set(p)}var h=u.getElement(t,"SelectedValues");if(h){var d;for(r._selectedValuesLookup={},d=0;d0&&(e=(r=this.selection.getAt(0))?r.getValue():null),new c.FormItemResult(this.argumentName.get(),e,!0);for(var t=[],i=0;i0&&(_=r.formItem.dataItems.getAt(0)),!0===t&&r.triggerCascading(null==_?null:_.value),r.formItem.handleResultsComplete&&r.formItem.handleResultsComplete()}})}},e.prototype._getWhereClause=function(e){var t=this,i=this.queryWhereClause.get();return(i=i.replace(/{1:([a-zA-Z0-9]+)(:[a-zA-Z0-9]+)?}/g,function(e,i,r){var n=t.formItem.formDefinition.getFormItemById(i);if(!n)return"{unknown form item "+i+"}";var s=n.getResult().value;if(!r)return s;if(":SQL"===r)return t._escapeForWhere(s);var a=/:[fF](\d+)/.exec(r);return a?parseFloat(s).toFixed(+a[1]):"{unknown format clause "+r+"}"})).format(this._escapeForWhere(e))},e.prototype._escapeForWhere=function(e){return e&&"number"==typeof e&&(e=e.toString()),(e||"").replace(/\'/g,"''")},e}();t.QueryTaskRunner=u})},"geocortex/forms/items/RadioButtonFormItem":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./FormItem","geocortex/framework/observables","./../../forms","./FormItemResult","./ContainerFormItem"],function(e,i,r,n,s,a,o){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var l=function(e){function i(t,r){var a=e.call(this,t,r)||this;return a.formItemType="RadioButtonFormItem",t?(a.text=new n.Observable(s.getElementText(t,"Text")),a.checked=new n.Observable(s._parseBoolean(s.getElementText(t,"Checked"))),a.textLocation=new n.Observable(s.getElementText(t,"TextLocation")),a.groupName=new n.Observable(s.getElementText(t,"GroupName"))):(a.text=new n.Observable(null),a.checked=new n.Observable(!1),a.textLocation=new n.Observable("Right"),a.groupName=new n.Observable(null)),a.checked.bind(null,function(e){e&&i._findButtonsInGroup(a.groupName.get(),a.formDefinition.containerFormItem).forEach(function(e){e!==a&&e.checked.set(!1)}),a._notifyResultChanged()}),a}return t(i,e),i.prototype.getResult=function(){var e=this.__getRadioValueClosure,t=!!e&&e();return new a.FormItemResult(this.argumentName.get(),t)},i.prototype._render=function(){return s.renderFormItem(this)},i._findButtonsInGroup=function(e,t){var r=[];return t&&t.formItems.get().forEach(function(t){t instanceof i?t.groupName.get()===e&&r.push(t):t instanceof o.ContainerFormItem&&i._findButtonsInGroup(e,t).forEach(function(e){return r.push(e)})}),r},i}(r.AbstractFormItem);i.RadioButtonFormItem=l})},"geocortex/forms/items/TextAreaFormItem":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./TextBoxFormItem","geocortex/framework/observables","./../../forms"],function(e,i,r,n,s){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var a=function(e){function i(t,i){var r=e.call(this,t,i)||this;return r.formItemType="TextAreaFormItem",r.textboxHeight=t?new n.Observable(parseInt(s.getElementText(t,"TextboxHeight"))):new n.Observable(1),r}return t(i,e),i}(r.TextBoxFormItem);i.TextAreaFormItem=a})},"geocortex/forms/items/TextBoxFormItem":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./FormItem","./LabelContainer","geocortex/framework/observables","./../../forms","./FormItemResult"],function(e,i,r,n,s,a,o){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var l=function(e){function i(t,i){var r=e.call(this,t,i)||this;if(r.formItemType="TextBoxFormItem",t){var o=a.getElementText(t,"DefaultText");r.defaultText=new s.Observable(o),r.text=new s.Observable(o),r.inputScope=new s.Observable(a.getElementText(t,"InputScope")),r.textboxWidth=new s.Observable(parseInt(a.getElementText(t,"TextboxWidth"))),r.readOnly=new s.Observable(a._parseBoolean(a.getElementText(t,"ReadOnly")))}else r.defaultText=new s.Observable(""),r.text=new s.Observable(""),r.inputScope=new s.Observable("Default"),r.textboxWidth=new s.Observable(NaN),r.readOnly=new s.Observable(!1);return n.initLabelContainer(r,t,i),r.text.bind(null,function(e){return r._notifyResultChanged()}),r}return t(i,e),i.prototype.getResult=function(){return new o.FormItemResult(this.argumentName.get(),this.text.get())},i.prototype._render=function(){return a.renderFormItem(this)},i}(r.AbstractFormItem);i.TextBoxFormItem=l})},"geocortex/forms/items/TimePickerFormItem":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./FormItem","./LabelContainer","geocortex/framework/observables","./../../forms","geocortex/framework/utils/DateUtils","./FormItemResult"],function(e,i,r,n,s,a,o,l){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var u=function(e){function i(t,i){var r=e.call(this,t,i)||this;if(r.initialTime=new s.Observable,r.nullable=new s.Observable(!1),r.timeFormat=new s.Observable,r.jQueryPickerTimeAsInfoMsg=new s.Observable(!1),r.formItemType="TimePickerFormItem",n.initLabelContainer(r,t,i),t){for(var l=!0,u=t.getElementsByTagNameNS?t.getElementsByTagNameNS("http://schemas.datacontract.org/2004/07/Geocortex.Forms.Client.Items.Validation","ValidationItem"):t.getElementsByTagName("ValidationItem"),c=0;c=0){l=!1;break}}r.nullable.set(l);var h=a.getElementText(t,"jQueryPickerTimeAsInfoMsg");h&&r.jQueryPickerTimeAsInfoMsg.set("true"===h);var d=a.getElementText(t,"InitialTime");(null===a.getElementText(t,"InitializeWithCurrentTime")?d:"true"!==a.getElementText(t,"InitializeWithCurrentTime"))?d?(o.containsTimezone(d)||(d+=o.getTimezoneString()),r.initialTime.set(Date.fromISO(d))):r.initialTime.set(null):r.initialTime.set(new Date),r.timeFormat.set(a.getElementText(t,"TimeFormat"))}else r.timeFormat.set("LongTime"),r.initialTime.set(new Date);return r.time=new s.Observable(r.initialTime.get()),r.time.bind(null,function(e){return r._notifyResultChanged()}),r}return t(i,e),i.prototype.getResult=function(){var e=this.time.get();return e&&(e=new Date(e.toString()),e="/Date({0})/".format(e.getTime())),new l.FormItemResult(this.argumentName.get(),e)},i.prototype._render=function(){return a.renderFormItem(this)},i}(r.AbstractFormItem);i.TimePickerFormItem=u})},"geocortex/forms/items/validation/FileSizeValidationItem":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./ValidationItem","./../../../forms","./ValidationResult","./../../../workflow/ArgumentValueWrapper","./../../FileItem"],function(e,i,r,n,s,a,o){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var l=function(e){function i(t){var i=e.call(this,t)||this;return i.totalFileSize=parseInt(n.getElementText(t,"TotalFileSize")),i}return t(i,e),i.prototype.validate=function(e){if(e instanceof a.ArgumentValueWrapper&&e.value&&e.value instanceof Array){for(var t=0,i=0;ithis.totalFileSize)return new s.ValidationResult(!1,this.message)}return new s.ValidationResult(!0,null)},i}(r.ValidationItem);i.FileSizeValidationItem=l})},"geocortex/forms/items/validation/NumericRangeValidationItem":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./ValidationItem","./../../../forms","./ValidationResult"],function(e,i,r,n,s){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var a=function(e){function i(t){var i=e.call(this,t)||this;return i.minimumValue=parseFloat(n.getElementText(t,"MinimumValue")),i.maximumValue=parseFloat(n.getElementText(t,"MaximumValue")),i}return t(i,e),i.prototype.validate=function(e){if(null===e||void 0===e||""===e)return new s.ValidationResult(!0,null);var t=parseFloat(e);return null==t||isNaN(t)||tthis.maximumValue?new s.ValidationResult(!1,this.message):new s.ValidationResult(!0,null)},i}(r.ValidationItem);i.NumericRangeValidationItem=a})},"geocortex/forms/items/validation/RegexValidationItem":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./ValidationItem","./../../../forms","./ValidationResult"],function(e,i,r,n,s){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var a=function(e){function i(t){var i=e.call(this,t)||this;return i.expression=n.getElementText(t,"Expression"),i.ignoreCase=n._parseBoolean(n.getElementText(t,"IgnoreCase")),i}return t(i,e),i.prototype.validate=function(e){if(null===e||void 0===e||""===e)return new s.ValidationResult(!0,null);var t="",i=this.expression;this.ignoreCase&&(t+="i"),'^(?(")(".+?"@)|(([0-9a-zA-Z]((\\.(?!\\.))|[-!#\\$%&\'\\*\\+/=\\?\\^`\\{\\}\\|~\\w])*)(?<=[0-9a-zA-Z])@))(?(\\[)(\\[(\\d{1,3}\\.){3}\\d{1,3}\\])|(([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,6}))$'==this.expression&&(i="^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$");var r=null;try{r=new RegExp(i,t)}catch(e){}return null==r||r.test(e)?new s.ValidationResult(!0,null):new s.ValidationResult(!1,this.message)},i}(r.ValidationItem);i.RegexValidationItem=a})},"geocortex/forms/items/validation/RequiredValidationItem":function(){var e,t=this&&this.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)});define(["require","exports","./ValidationItem","./ValidationResult"],function(e,i,r,n){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var s=function(e){function i(t){return e.call(this,t)||this}return t(i,e),i.prototype.validate=function(e){var t=!0,i=null;return(void 0===e||null===e||"string"==typeof e&&""===dojo.trim(e)||void 0!==e.length&&e.length<=0||e.value&&dojo.isArray(e.value)&&0===e.value.length)&&(t=!1,i=this.message),new n.ValidationResult(t,i)},i}(r.ValidationItem);i.RequiredValidationItem=s})},"geocortex/forms/items/validation/ValidationItem":function(){define(["require","exports","./../../../forms"],function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this.message=i.getElementText(e,"Message")}return e.prototype.validate=function(e){throw new Error("Abstract method")},e}();t.ValidationItem=r})},"geocortex/forms/items/validation/ValidationResult":function(){define(["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e,t){this.isValid=e,this.errorMessage=t};t.ValidationResult=i})}}}),require({cache:{"geocortex/forms":function(){define(["require","exports"],function(e,t){"use strict";function i(e,t){var i=e.getElementsByTagName(t);if(i.length>=1){for(n=0;n0){var r=e.childNodes[0].prefix;if(""!=r&&(i=e.getElementsByTagName(r+":"+t)).length>=1)for(var n=0;ni.config.io.postLength;if(!n.scheme&&!n.host&&!n.port)return!1;if(o()&&"https"===n.scheme)return!1;var l=!(s.protocol+"//"+s.hostname+(s.port?":"+s.port:"")==n.scheme+"://"+n.host+(n.port?":"+n.port:""));t=a&&l}catch(e){}return t}function o(){return/\bGeocortexApp\b/.test(navigator.userAgent)||/http:\/\/127.0.0.1(:[0-9]*)?\/viewerpackages\//gi.test(window.location.href)}Object.defineProperty(t,"__esModule",{value:!0}),t.deferredResolve=function(e,t){e&&-1==e.fired&&e.resolve(t)},t.deferredReject=function(e,t){e&&-1==e.fired&&e.reject(t)},t.encodeJson=function(e){var t=function e(t){var i,r=typeof t;if(null==t||"undefined"===r||"number"===r||"boolean"===r||"string"===r)return t;if("function"==typeof t.toJson&&(i=t.toJson()),dojo.isArray(t))for(i=[],n=0;n-1||void 0!==i[n])){var s=t[n];"function"!=typeof s&&(i[n]=e(s))}}return i}(e),i={};for(var r in t)dojo.isArray(t[r])||"object"==typeof t[r]?i[r]=JSON.stringify(t[r]):i[r]=t[r];return i},t.request=function(e,t){t||(t={}),t.gcx||(t.gcx={}),void 0===t.gcx.preventCache?e.preventCache=!0:t.gcx.preventCache?e.preventCache=!0:e.preventCache=!1,e.timeout=e.timeout||i.config.io.timeout,e.handleAs=e.handleAs||"json";var s=a(e),o=r.hasProxy();if(s&&!o){var l=new Error("Cross-domain or large requests require a proxy.");dojo.isFunction(e.error)&&e.error(l);var u=new dojo.Deferred;return u.errback(l),u}return delete e.gcx,t.useProxy=s,t.hasOwnProperty("disableIdentityLookup")||(t.disableIdentityLookup=!0),new n.RestHelperHTTPService(e,t).send()},t.requiresProxy=a,t.isNative=o,t.urlToQueryObject=function(e){var t=e.indexOf("?");return-1===t?null:dojo.queryToObject(e.substring(t+1))},t._getExtensions=function(e){var t=[];if(!e)return t;t.length=e.length;for(var i=0;i-1&&this._logScaleChange(this._previousScale,e.lod.scale),this._previousScale=e.lod.scale;else{var i=this._map.getScale();null!==i&&(this._previousScale!=i&&this._previousScale>-1&&this._logScaleChange(this._previousScale,i),this._previousScale=i)}},e.prototype._logScaleChange=function(e,t){if(this._enabled){var i={data:[{name:"ArcGISScale",columns:[]}]};i.data[0].columns=[{type:"float",name:"ScaleOld",key:"ScaleOld"},{type:"float",name:"ScaleNew",key:"ScaleNew"}],i.data[0].rows=[{ScaleOld:e,ScaleNew:t}],this._queueData(i)}},e.prototype.logToolUsage=function(e,t){if(this._enabled){var i={data:[{name:"ArcGISTool",columns:[]}]};i.data[0].columns=[{type:"ustr",name:"Tool",key:"Tool"},{type:"ustr",name:"ToolData",key:"ToolData"}],i.data[0].rows=[{Tool:e,ToolData:t}],this._queueData(i)}},e.prototype._queueData=function(e){e.platform="js",e.data[0].columns.push({type:"now",name:"SampleTime",key:"SampleTime"},{type:"origin",name:"UserAddress",key:"UserAddress"},{type:"ustr",name:"SiteId",key:"SiteId"},{type:"ustr",name:"UserAgent",key:"UserAgent"},{type:"ustr",name:"UserName",key:"UserName"},{type:"ustr",name:"LayerList",key:"LayerList"},{type:"int",name:"SessionId",key:"SessionId"},{type:"ustr",name:"ClientType",key:"ClientType"},{type:"host",name:"MachineName",key:"MachineName"}),dojo.mixin(e.data[0].rows[0],{SiteId:this._siteId,UserAgent:navigator.userAgent,UserName:this.userName,LayerList:this._getCurrentLayerList(),SessionId:this._sessionId,ClientType:"JavaScript"}),this._pendingEvents.push(e),this._timer.reset()},e.prototype._flushQueue=function(){for(this._timer.stop();this._pendingEvents.length>0;){var e=this._pendingEvents.shift();this._logData(e)}},e.prototype._logData=function(e){try{dojo.xhrPost({url:this._endpointUrl,postData:JSON.stringify(e),timeout:1e4,load:dojo.hitch(this,this._handleLogSuccessResponse),error:dojo.hitch(this,this._handleLogErrorResponse)})}catch(e){console.log(e.message),this._incrementFailures()}},e.prototype._handleLogSuccessResponse=function(e){this._numConsecutiveFailures=0},e.prototype._handleLogErrorResponse=function(e){console.log(e),this._incrementFailures()},e.prototype._incrementFailures=function(){++this._numConsecutiveFailures>2&&(dojo.disconnect(this._extentConnect),this._enabled=!1)},e.prototype._getCurrentLayerList=function(){for(var e="",t=this._map.layerIds,i=0;i3&&(e=e.substring(0,e.length-2)),e},e.prototype._crc32=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",i=0;i127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}var n,s=0;s^=-1;for(var a=0,o=(e=t).length;a>>8^"0x"+"00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D".substr(9*n,8);return(s^=-1).toString()},e}();t.EventRelay=r})}}}),require({cache:{"geocortex/workflow":function(){},"geocortex/workflow/ActivityContext":function(){define(["require","exports","./ArgumentValueWrapper","./ArgumentInfo","./DefaultActivityHandlers","./WorkflowControllerProxy"],function(e,t,i,r,n,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t,i,r){this.activityComplete=null,this._dispatcher=e,this._pendingIndex=t,this._workflow=i,this._workflowState=r}return e.prototype.dispatcher=function(){return this._dispatcher},e.prototype.workflow=function(){return this._workflow},e.prototype.getDisplayName=function(){return this._workflowState?this._workflowState.pendingExternalActivities[this._pendingIndex].displayName:""},e.prototype.getInputNames=function(){var e=[];if(this._workflowState)for(var t=this._workflowState.pendingExternalActivities[this._pendingIndex].inputs,i=0;i=0&&(e=e.substring(0,t))}return e},e.prototype.getActivityExternalId=function(){return this._workflowState?this._workflowState.pendingExternalActivities[this._pendingIndex].externalId:""},e.prototype.getInputArgumentTypeName=function(e){if(this._workflowState)for(var t=this._workflowState.pendingExternalActivities[this._pendingIndex].inputs,i=0;i0&&e.dispatcher().handleOpenReportUrl(i,e),e.setValue("ResultUrl",i),e.completeActivity()},function(t){e.dispatcher().handleError(new Error("Error running report '"+t.message+"'"),e)})}else e.dispatcher().handleError(new Error("Cannot find report '"+l+"'"),e)},t.showDebug=function(e,t,i){var r,n=new a.FormDefinition;if(n.maxHeight.set(600),n.maxWidth.set(500),t?(n.title.set("Debug - Input Arguments for "+e.getDisplayName()),n.containerFormItem.description.set("Input Arguments:"),r=e.getInputNames()):(n.title.set("Debug - Output Arguments for "+e.getDisplayName()),n.containerFormItem.description.set("Output Arguments:"),r=e.getOutputNames()),null!=r&&r.length>0)for(var s=0;s0&&s.setUpdateDelay(i),dojo.connect(s,"onError",function(t){e.setValue("Result",p(esri.tasks.JobInfo.STATUS_FAILED)),e.completeActivity()}),dojo.connect(s,"onStatusUpdate",function(t){if(!n){var a=t.jobStatus;a==esri.tasks.JobInfo.STATUS_CANCELLED||a==esri.tasks.JobInfo.STATUS_DELETED||a==esri.tasks.JobInfo.STATUS_FAILED||a==esri.tasks.JobInfo.STATUS_SUCCEEDED||a==esri.tasks.JobInfo.STATUS_TIMED_OUT?(n=!0,e.setValue("Result",p(a)),e.completeActivity()):window.setTimeout(function(){s.checkJobStatus(r)},i)}}),s.checkJobStatus(r)},t._getJobStatusCode=p,t.handleGetLayerInfoByProperty=function(e){if(!e)throw new Error("Get Map Service Info: required context was not supplied.");var t=e.getValue("PropertyName");if(null==t)throw new Error("Provide a Property Name: No property name available.");var i=e.getSite();if(!i)throw new Error("Set Layer Visibility: No site available.");for(var r=[],n=i.essentialsMap.mapServices,s={mapServiceUrl:"",mapServiceId:"",token:"",isVisible:!1,isDynamic:!1,propertyValue:null,id:"",name:"",displayName:"",layerUrl:""},a=null,o=0;o=0;--u)l.add(n.features[u]);s&&(l.renderer=esri.renderer.fromJson(JSON.parse(s))),o&&a.addLayer(l)}finally{l.resume()}e.completeActivity()}})},"geocortex/workflow/MapActivityHandlers":function(){define(["require","exports","./../essentials/utilities/SiteResourceIdComparer","./../essentials/LayerType","./../essentials/ReportParameters","./../essentials/Resolution","./../essentials/Scale","./../essentials/TextField"],function(e,t,i,r,n,s,a,o){"use strict";var l;Object.defineProperty(t,"__esModule",{value:!0}),(l=t.MapActivityHandlers||(t.MapActivityHandlers={})).handleRefreshMap=function(e){var t=e.getValue("MapServiceId");if(null==e.getEsriMap())throw new Error("Refresh Map: no map available.");var r=function(e){var t=e.serviceLayer;if("function"==typeof t.refresh)if("boolean"==typeof t.disableClientCaching){var i=t.disableClientCaching;t.disableClientCaching=!0,t.refresh(),t.disableClientCaching=i}else t.refresh()},n=e.workflow().site.essentialsMap.mapServices;if(t){var s=i.SiteResourceIdComparer.lookUp(n,t);s&&r(s)}else dojo.forEach(n,function(e){r(e)});e.completeActivity()},l.handleGetMapExtent=function(e){var t=e.getEsriMap();if(null==t)throw new Error("Get Map Extent: No map available.");e.setValue("Extent",t.extent),e.completeActivity()},l.handleGetMapInfo=function(e){var t=e.getEsriMap();if(null==t)throw new Error("Get Map Info: No map available.");e.setValue("Extent",t.extent),e.setValue("Scale",esri.geometry.getScale(t)),e.setValue("SpatialReference",t.spatialReference),e.setValue("Height",t.height),e.setValue("Width",t.width);var i=[];null!=t.layerIds&&(i=i.concat(t.layerIds)),null!=t.graphicsLayerIds&&(i=i.concat(t.graphicsLayerIds)),e.setValue("MapServiceIds",i),e.completeActivity()},l.handleSetMapExtent=function(e){var t=e.getValue("Extent");if(null==t)throw new Error("Set Map Extent: required Extent argument was not supplied.");var i=e.getEsriMap();if(null==i)throw new Error("Set Map Extent: No map available.");t.spatialReference&&(t.spatialReference.wkid||t.spatialReference.wkt)||(t.spatialReference=i.spatialReference);var r=e.getSite();r&&r.essentialsMap?r.essentialsMap.extentManager.setExtentWithPriority(t,10):i.setExtent(t),e.completeActivity()},l.handleCaptureGeometry=function(e){function t(t,r,n){n.deactivate(),dojo.disconnect(r),i.setDrawObjectContext(null),e.setValue("Result",t),e.completeActivity()}var i=e.dispatcher();if(!i.abortMapBasedActivity())throw new Error("Could not deactivate current map based activity.");var r=e.getValue("CaptureType"),n=e.getEsriMap();if(null==n)throw new Error("Capture Geometry: No map available.");if("function"!=typeof esri.toolbars.Draw)throw new Error('dojo.require("esri.toolbars.draw") must be added to your client code to use CaptureGeometry activity.');var s=new esri.toolbars.Draw(n),a=dojo.connect(s,"onDrawEnd",dojo.hitch(a,function(e){t(e,a,s)})),o=!0,l=function(e){var i;switch(r){case 0:i=esri.toolbars.Draw.EXTENT;break;case 1:i=esri.toolbars.Draw.FREEHAND_POLYGON;break;case 2:i=esri.toolbars.Draw.FREEHAND_POLYLINE;break;case 3:i=esri.toolbars.Draw.LINE;break;case 4:i=esri.toolbars.Draw.POINT;break;case 5:i=esri.toolbars.Draw.MULTI_POINT;break;case 6:i=esri.toolbars.Draw.POLYGON;break;case 7:i=esri.toolbars.Draw.POLYLINE;break;case 8:t(n.extent,a,s),o=!1;break;default:i=esri.toolbars.Draw.EXTENT}return i}();o&&s.activate(l),i.setDrawObjectContext({activityContext:e,toolbar:s,drawEvent:a})},l._pickSupported=function(e,t){if(!e||e.length<=0)return null;if(t)for(var i=t.toUpperCase(),r=0;r0)for(n=0;n=0&&(m[n]=m[n].substring(y+"\\\\".length));else e.dispatcher().handleError(new Error("Intersect Layers: no input layers provided."),e);for((s=e.getSite())||e.dispatcher().handleError(new Error("Intersect Layers: no site available."),e),(a=s.essentialsMap)||e.dispatcher().handleError(new Error("Intersect Layers: no map available."),e),(!a.mapServices||a.mapServices.length<=0)&&e.dispatcher().handleError(new Error("Intersect Layers: no map service is configured for the map."),e),t=0;t0&&i)for(var g=0;g0&&(v.grid=b[0])}m.print(v,function(t){var i=t?t.href:null;e.setValue("ResultUrl",i),e.completeActivity()},function(t){e.dispatcher().handleError(new Error("Error printing map '"+t.message+"'"),e)})}})},"geocortex/workflow/MapServiceActivityHandlers":function(){define(["require","exports","./../essentials/utilities/SiteResourceIdComparer"],function(e,t,i){"use strict";function r(e,t){return t&&e&&e.essentialsMap&&e.essentialsMap.mapServices?i.SiteResourceIdComparer.lookUp(e.essentialsMap.mapServices,t):null}function n(e,t){if(!e||!t)return null;if(null!=e.layerIds)for(r=0;r0&&(t=e.substring(0,i)),t},r=i(e[t].runtimeTypeName);if(e[t].value=h(e[t].value,r),null==e[t].value){var n=i(e[t].typeName);e[t].value=h(e[t].value,n)}}}function h(e,t){var i=e;switch(t){case"ESRI.ArcGIS.Client.Tasks.FeatureSet":var r=e;if(null!=r){var n=new esri.tasks.FeatureSet(r);n.features=n.features||[],i=n}break;case"ESRI.ArcGIS.Client.Geometry.Geometry":case"ESRI.ArcGIS.Client.Geometry.Envelope":case"ESRI.ArcGIS.Client.Geometry.MapPoint":case"ESRI.ArcGIS.Client.Geometry.MultiPoint":case"ESRI.ArcGIS.Client.Geometry.Polygon":case"ESRI.ArcGIS.Client.Geometry.Polyline":var s=e;if(null!=s){var a=esri.geometry.fromJson(s);a&&a.spatialReference&&!s.spatialReference&&(a.spatialReference=null),i=a}break;case"ESRI.ArcGIS.Client.Geometry.SpatialReference":var o=e;null!=o&&(i=new esri.SpatialReference(o));break;case"ESRI.ArcGIS.Client.LayerMapSource":(l=e)&&(i=new esri.layers.LayerMapSource(l));break;case"ESRI.ArcGIS.Client.LayerDataSource":var l=e;l&&(i=new esri.layers.LayerDataSource(l));break;case"ESRI.ArcGIS.Client.TimeExtent":if(e instanceof Array){var u=e;if(u.length>0){var c=new Date(u[0]),p=u.length>1?new Date(u[1]):c;i=new esri.TimeExtent(c,p)}}break;case"ESRI.ArcGIS.Client.Graphic":e&&(i=e.toJson());break;case"System.DateTime":e instanceof Date&&(i="/Date("+e.getTime()+")/")}return i}function d(e){var t=[];if(null!=e)for(var i=0;i