// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
require({cache:{"dijit/_TemplatedMixin":function(){define("dojo/cache dojo/_base/declare dojo/dom-construct dojo/_base/lang dojo/on dojo/sniff dojo/string ./_AttachMixin".split(" "),function(m,n,d,v,t,e,k,r){var c=n("dijit._TemplatedMixin",r,{templateString:null,templatePath:null,_skipNodeCache:!1,searchContainerNode:!0,_stringRepl:function(c){var h=this.declaredClass,u=this;return k.substitute(c,this,function(c,b){"!"==b.charAt(0)&&(c=v.getObject(b.substr(1),!1,u));if("undefined"==typeof c)throw Error(h+
" template:"+b);return null==c?"":"!"==b.charAt(0)?c:this._escapeValue(""+c)},this)},_escapeValue:function(c){return c.replace(/["'<>&]/g,function(c){return{"\x26":"\x26amp;","\x3c":"\x26lt;","\x3e":"\x26gt;",'"':"\x26quot;","'":"\x26#x27;"}[c]})},buildRendering:function(){if(!this._rendered){this.templateString||(this.templateString=m(this.templatePath,{sanitize:!0}));var h=c.getCachedTemplate(this.templateString,this._skipNodeCache,this.ownerDocument),q;if(v.isString(h)){if(q=d.toDom(this._stringRepl(h),
this.ownerDocument),1!=q.nodeType)throw Error("Invalid template: "+h);}else q=h.cloneNode(!0);this.domNode=q}this.inherited(arguments);this._rendered||this._fillContent(this.srcNodeRef);this._rendered=!0},_fillContent:function(c){var h=this.containerNode;if(c&&h)for(;c.hasChildNodes();)h.appendChild(c.firstChild)}});c._templateCache={};c.getCachedTemplate=function(h,q,u){var x=c._templateCache,b=h,g=x[b];if(g){try{if(!g.ownerDocument||g.ownerDocument==(u||document))return g}catch(a){}d.destroy(g)}h=
k.trim(h);if(q||h.match(/\$\{([^\}]+)\}/g))return x[b]=h;q=d.toDom(h,u);if(1!=q.nodeType)throw Error("Invalid template: "+h);return x[b]=q};e("ie")&&t(window,"unload",function(){var h=c._templateCache,q;for(q in h){var u=h[q];"object"==typeof u&&d.destroy(u);delete h[q]}});return c})},"dojo/cache":function(){define(["./_base/kernel","./text"],function(m){return m.cache})},"dijit/_AttachMixin":function(){define("require dojo/_base/array dojo/_base/connect dojo/_base/declare dojo/_base/lang dojo/mouse dojo/on dojo/touch ./_WidgetBase".split(" "),
function(m,n,d,v,t,e,k,r,c){var h=t.delegate(r,{mouseenter:e.enter,mouseleave:e.leave,keypress:d._keypress}),q;d=v("dijit._AttachMixin",null,{constructor:function(){this._attachPoints=[];this._attachEvents=[]},buildRendering:function(){this.inherited(arguments);this._attachTemplateNodes(this.domNode);this._beforeFillContent()},_beforeFillContent:function(){},_attachTemplateNodes:function(c){for(var h=c;;)if(1==h.nodeType&&(this._processTemplateNode(h,function(b,g){return b.getAttribute(g)},this._attach)||
this.searchContainerNode)&&h.firstChild)h=h.firstChild;else{if(h==c)break;for(;!h.nextSibling;)if(h=h.parentNode,h==c)return;h=h.nextSibling}},_processTemplateNode:function(c,h,b){var g=!0,a=this.attachScope||this,f=h(c,"dojoAttachPoint")||h(c,"data-dojo-attach-point");if(f)for(var l=f.split(/\s*,\s*/);f=l.shift();)t.isArray(a[f])?a[f].push(c):a[f]=c,g="containerNode"!=f,this._attachPoints.push(f);if(h=h(c,"dojoAttachEvent")||h(c,"data-dojo-attach-event"))for(f=h.split(/\s*,\s*/),l=t.trim;h=f.shift();)if(h){var y=
null;-1!=h.indexOf(":")?(y=h.split(":"),h=l(y[0]),y=l(y[1])):h=l(h);y||(y=h);this._attachEvents.push(b(c,h,t.hitch(a,y)))}return g},_attach:function(c,d,b){d=d.replace(/^on/,"").toLowerCase();d="dijitclick"==d?q||(q=m("./a11yclick")):h[d]||d;return k(c,d,b)},_detachTemplateNodes:function(){var c=this.attachScope||this;n.forEach(this._attachPoints,function(h){delete c[h]});this._attachPoints=[];n.forEach(this._attachEvents,function(c){c.remove()});this._attachEvents=[]},destroyRendering:function(){this._detachTemplateNodes();
this.inherited(arguments)}});t.extend(c,{dojoAttachEvent:"",dojoAttachPoint:""});return d})},"dijit/_WidgetBase":function(){define("require dojo/_base/array dojo/aspect dojo/_base/config dojo/_base/connect dojo/_base/declare dojo/dom dojo/dom-attr dojo/dom-class dojo/dom-construct dojo/dom-geometry dojo/dom-style dojo/has dojo/_base/kernel dojo/_base/lang dojo/on dojo/ready dojo/Stateful dojo/topic dojo/_base/window ./Destroyable dojo/has!dojo-bidi?./_BidiMixin ./registry".split(" "),function(m,n,
d,v,t,e,k,r,c,h,q,u,x,b,g,a,f,l,y,F,B,A,z){function w(a){return function(b){r[b?"set":"remove"](this.domNode,a,b);this._set(a,b)}}x.add("dijit-legacy-requires",!b.isAsync);x.add("dojo-bidi",!1);x("dijit-legacy-requires")&&f(0,function(){m(["dijit/_base/manager"])});var D={};v=e("dijit._WidgetBase",[l,B],{id:"",_setIdAttr:"domNode",lang:"",_setLangAttr:w("lang"),dir:"",_setDirAttr:w("dir"),"class":"",_setClassAttr:{node:"domNode",type:"class"},_setTypeAttr:null,style:"",title:"",tooltip:"",baseClass:"",
srcNodeRef:null,domNode:null,containerNode:null,ownerDocument:null,_setOwnerDocumentAttr:function(a){this._set("ownerDocument",a)},attributeMap:{},_blankGif:v.blankGif||m.toUrl("dojo/resources/blank.gif"),textDir:"",_introspect:function(){var a=this.constructor;if(!a._setterAttrs){var b=a.prototype,f=a._setterAttrs=[],a=a._onMap={},l;for(l in b.attributeMap)f.push(l);for(l in b)/^on/.test(l)&&(a[l.substring(2).toLowerCase()]=l),/^_set[A-Z](.*)Attr$/.test(l)&&(l=l.charAt(4).toLowerCase()+l.substr(5,
l.length-9),b.attributeMap&&l in b.attributeMap||f.push(l))}},postscript:function(a,b){this.create(a,b)},create:function(a,b){this._introspect();this.srcNodeRef=k.byId(b);this._connects=[];this._supportingWidgets=[];this.srcNodeRef&&this.srcNodeRef.id&&"string"==typeof this.srcNodeRef.id&&(this.id=this.srcNodeRef.id);a&&(this.params=a,g.mixin(this,a));this.postMixInProperties();this.id||(this.id=z.getUniqueId(this.declaredClass.replace(/\./g,"_")),this.params&&delete this.params.id);this.ownerDocument=
this.ownerDocument||(this.srcNodeRef?this.srcNodeRef.ownerDocument:document);this.ownerDocumentBody=F.body(this.ownerDocument);z.add(this);this.buildRendering();var f;if(this.domNode){this._applyAttributes();var l=this.srcNodeRef;l&&l.parentNode&&this.domNode!==l&&(l.parentNode.replaceChild(this.domNode,l),f=!0);this.domNode.setAttribute("widgetId",this.id)}this.postCreate();f&&delete this.srcNodeRef;this._created=!0},_applyAttributes:function(){var a={},b;for(b in this.params||{})a[b]=this._get(b);
n.forEach(this.constructor._setterAttrs,function(b){if(!(b in a)){var f=this._get(b);f&&this.set(b,f)}},this);for(b in a)this.set(b,a[b])},postMixInProperties:function(){},buildRendering:function(){this.domNode||(this.domNode=this.srcNodeRef||this.ownerDocument.createElement("div"));if(this.baseClass){var a=this.baseClass.split(" ");this.isLeftToRight()||(a=a.concat(n.map(a,function(a){return a+"Rtl"})));c.add(this.domNode,a)}},postCreate:function(){},startup:function(){this._started||(this._started=
!0,n.forEach(this.getChildren(),function(a){a._started||a._destroyed||!g.isFunction(a.startup)||(a.startup(),a._started=!0)}))},destroyRecursive:function(a){this._beingDestroyed=!0;this.destroyDescendants(a);this.destroy(a)},destroy:function(a){function b(b){b.destroyRecursive?b.destroyRecursive(a):b.destroy&&b.destroy(a)}this._beingDestroyed=!0;this.uninitialize();n.forEach(this._connects,g.hitch(this,"disconnect"));n.forEach(this._supportingWidgets,b);this.domNode&&n.forEach(z.findWidgets(this.domNode,
this.containerNode),b);this.destroyRendering(a);z.remove(this.id);this._destroyed=!0},destroyRendering:function(a){this.bgIframe&&(this.bgIframe.destroy(a),delete this.bgIframe);this.domNode&&(a?r.remove(this.domNode,"widgetId"):h.destroy(this.domNode),delete this.domNode);this.srcNodeRef&&(a||h.destroy(this.srcNodeRef),delete this.srcNodeRef)},destroyDescendants:function(a){n.forEach(this.getChildren(),function(b){b.destroyRecursive&&b.destroyRecursive(a)})},uninitialize:function(){return!1},_setStyleAttr:function(a){var b=
this.domNode;g.isObject(a)?u.set(b,a):b.style.cssText=b.style.cssText?b.style.cssText+("; "+a):a;this._set("style",a)},_attrToDom:function(a,b,f){f=3<=arguments.length?f:this.attributeMap[a];n.forEach(g.isArray(f)?f:[f],function(f){var l=this[f.node||f||"domNode"];switch(f.type||"attribute"){case "attribute":g.isFunction(b)&&(b=g.hitch(this,b));f=f.attribute?f.attribute:/^on[A-Z][a-zA-Z]*$/.test(a)?a.toLowerCase():a;l.tagName?r.set(l,f,b):l.set(f,b);break;case "innerText":l.innerHTML="";l.appendChild(this.ownerDocument.createTextNode(b));
break;case "innerHTML":l.innerHTML=b;break;case "class":c.replace(l,b,this[a]);break;case "toggleClass":c.toggle(l,f.className||a,b)}},this)},get:function(a){var b=this._getAttrNames(a);return this[b.g]?this[b.g]():this._get(a)},set:function(a,b){if("object"===typeof a){for(var f in a)this.set(f,a[f]);return this}f=this._getAttrNames(a);var l=this[f.s];if(g.isFunction(l))var c=l.apply(this,Array.prototype.slice.call(arguments,1));else{var l=this.focusNode&&!g.isFunction(this.focusNode)?"focusNode":
"domNode",w=this[l]&&this[l].tagName,h;if((h=w)&&!(h=D[w])){h=this[l];var y={},q;for(q in h)y[q.toLowerCase()]=!0;h=D[w]=y}q=h;f=a in this.attributeMap?this.attributeMap[a]:f.s in this?this[f.s]:q&&f.l in q&&"function"!=typeof b||/^aria-|^data-|^role$/.test(a)?l:null;null!=f&&this._attrToDom(a,b,f);this._set(a,b)}return c||this},_attrPairNames:{},_getAttrNames:function(a){var b=this._attrPairNames;if(b[a])return b[a];var f=a.replace(/^[a-z]|-[a-zA-Z]/g,function(a){return a.charAt(a.length-1).toUpperCase()});
return b[a]={n:a+"Node",s:"_set"+f+"Attr",g:"_get"+f+"Attr",l:f.toLowerCase()}},_set:function(a,b){var f=this[a];this[a]=b;!this._created||f===b||f!==f&&b!==b||(this._watchCallbacks&&this._watchCallbacks(a,f,b),this.emit("attrmodified-"+a,{detail:{prevValue:f,newValue:b}}))},_get:function(a){return this[a]},emit:function(b,f,l){f=f||{};void 0===f.bubbles&&(f.bubbles=!0);void 0===f.cancelable&&(f.cancelable=!0);f.detail||(f.detail={});f.detail.widget=this;var g,c=this["on"+b];c&&(g=c.apply(this,l?
l:[f]));this._started&&!this._beingDestroyed&&a.emit(this.domNode,b.toLowerCase(),f);return g},on:function(b,f){var l=this._onMap(b);return l?d.after(this,l,f,!0):this.own(a(this.domNode,b,f))[0]},_onMap:function(a){var b=this.constructor,f=b._onMap;if(!f){var f=b._onMap={},l;for(l in b.prototype)/^on/.test(l)&&(f[l.replace(/^on/,"").toLowerCase()]=l)}return f["string"==typeof a&&a.toLowerCase()]},toString:function(){return"[Widget "+this.declaredClass+", "+(this.id||"NO ID")+"]"},getChildren:function(){return this.containerNode?
z.findWidgets(this.containerNode):[]},getParent:function(){return z.getEnclosingWidget(this.domNode.parentNode)},connect:function(a,b,f){return this.own(t.connect(a,b,this,f))[0]},disconnect:function(a){a.remove()},subscribe:function(a,b){return this.own(y.subscribe(a,g.hitch(this,b)))[0]},unsubscribe:function(a){a.remove()},isLeftToRight:function(){return this.dir?"ltr"==this.dir.toLowerCase():q.isBodyLtr(this.ownerDocument)},isFocusable:function(){return this.focus&&"none"!=u.get(this.domNode,"display")},
placeAt:function(a,b){var f=!a.tagName&&z.byId(a);!f||!f.addChild||b&&"number"!==typeof b?(f=f&&"domNode"in f?f.containerNode&&!/after|before|replace/.test(b||"")?f.containerNode:f.domNode:k.byId(a,this.ownerDocument),h.place(this.domNode,f,b),!this._started&&(this.getParent()||{})._started&&this.startup()):f.addChild(this,b);return this},defer:function(a,b){var f=setTimeout(g.hitch(this,function(){f&&(f=null,this._destroyed||g.hitch(this,a)())}),b||0);return{remove:function(){f&&(clearTimeout(f),
f=null);return null}}}});x("dojo-bidi")&&v.extend(A);return v})},"dijit/Destroyable":function(){define(["dojo/_base/array","dojo/aspect","dojo/_base/declare"],function(m,n,d){return d("dijit.Destroyable",null,{destroy:function(d){this._destroyed=!0},own:function(){var d=["destroyRecursive","destroy","remove"];m.forEach(arguments,function(t){function e(){r.remove();m.forEach(c,function(c){c.remove()})}var k,r=n.before(this,"destroy",function(c){t[k](c)}),c=[];t.then?(k="cancel",t.then(e,e)):m.forEach(d,
function(h){"function"===typeof t[h]&&(k||(k=h),c.push(n.after(t,h,e,!0)))})},this);return arguments}})})},"dijit/form/Select":function(){define("dojo/_base/array dojo/_base/declare dojo/dom-attr dojo/dom-class dojo/dom-geometry dojo/i18n dojo/keys dojo/_base/lang dojo/on dojo/sniff ./_FormSelectWidget ../_HasDropDown ../DropDownMenu ../MenuItem ../MenuSeparator ../Tooltip ../_KeyNavMixin ../registry dojo/text!./templates/Select.html dojo/i18n!./nls/validate".split(" "),function(m,n,d,v,t,e,k,r,c,
h,q,u,x,b,g,a,f,l,y){function F(a){return function(b){this._isLoaded?this.inherited(a,arguments):this.loadDropDown(r.hitch(this,a,b))}}var B=n("dijit.form._SelectMenu",x,{autoFocus:!0,buildRendering:function(){this.inherited(arguments);this.domNode.setAttribute("role","listbox")},postCreate:function(){this.inherited(arguments);this.own(c(this.domNode,"selectstart",function(a){a.preventDefault();a.stopPropagation()}))},focus:function(){var a=!1,b=this.parentWidget.value;r.isArray(b)&&(b=b[b.length-
1]);b&&m.forEach(this.parentWidget._getChildren(),function(f){f.option&&b===f.option.value&&(a=!0,this.focusChild(f,!1))},this);a||this.inherited(arguments)}});t=n("dijit.form.Select"+(h("dojo-bidi")?"_NoBidi":""),[q,u,f],{baseClass:"dijitSelect dijitValidationTextBox",templateString:y,_buttonInputDisabled:h("ie")?"disabled":"",required:!1,state:"",message:"",tooltipPosition:[],emptyLabel:"\x26#160;",_isLoaded:!1,_childrenLoaded:!1,labelType:"html",_fillContent:function(){this.inherited(arguments);
if(this.options.length&&!this.value&&this.srcNodeRef){var a=this.srcNodeRef.selectedIndex||0;this._set("value",this.options[0<=a?a:0].value)}this.dropDown=new B({id:this.id+"_menu",parentWidget:this});v.add(this.dropDown.domNode,this.baseClass.replace(/\s+|$/g,"Menu "))},_getMenuItemForOption:function(a){if(a.value||a.label){var f=r.hitch(this,"_setValueAttr",a);a=new b({option:a,label:("text"===this.labelType?(a.label||"").toString().replace(/&/g,"\x26amp;").replace(/</g,"\x26lt;"):a.label)||this.emptyLabel,
onClick:f,ownerDocument:this.ownerDocument,dir:this.dir,textDir:this.textDir,disabled:a.disabled||!1});a.focusNode.setAttribute("role","option");return a}return new g({ownerDocument:this.ownerDocument})},_addOptionItem:function(a){this.dropDown&&this.dropDown.addChild(this._getMenuItemForOption(a))},_getChildren:function(){return this.dropDown?this.dropDown.getChildren():[]},focus:function(){if(!this.disabled&&this.focusNode.focus)try{this.focusNode.focus()}catch(A){}},focusChild:function(a){a&&this.set("value",
a.option)},_getFirst:function(){var a=this._getChildren();return a.length?a[0]:null},_getLast:function(){var a=this._getChildren();return a.length?a[a.length-1]:null},childSelector:function(a){return(a=l.byNode(a))&&a.getParent()==this.dropDown},onKeyboardSearch:function(a,b,f,l){a&&this.focusChild(a)},_loadChildren:function(a){if(!0===a)if(this.dropDown&&(delete this.dropDown.focusedChild,this.focusedChild=null),this.options.length)this.inherited(arguments);else{m.forEach(this._getChildren(),function(a){a.destroyRecursive()});
var f=new b({ownerDocument:this.ownerDocument,label:this.emptyLabel});this.dropDown.addChild(f)}else this._updateSelection();this._isLoaded=!1;this._childrenLoaded=!0;this._loadingStore||this._setValueAttr(this.value,!1)},_refreshState:function(){this._started&&this.validate(this.focused)},startup:function(){this.inherited(arguments);this._refreshState()},_setValueAttr:function(a){this.inherited(arguments);d.set(this.valueNode,"value",this.get("value"));this._refreshState()},_setNameAttr:"valueNode",
_setDisabledAttr:function(a){this.inherited(arguments);this._refreshState()},_setRequiredAttr:function(a){this._set("required",a);this.focusNode.setAttribute("aria-required",a);this._refreshState()},_setOptionsAttr:function(a){this._isLoaded=!1;this._set("options",a)},_setDisplay:function(a){a=("text"===this.labelType?(a||"").replace(/&/g,"\x26amp;").replace(/</g,"\x26lt;"):a)||this.emptyLabel;this.containerNode.innerHTML='\x3cspan role\x3d"option" aria-selected\x3d"true" class\x3d"dijitReset dijitInline '+
this.baseClass.replace(/\s+|$/g,"Label ")+'"\x3e'+a+"\x3c/span\x3e"},validate:function(b){b=this.disabled||this.isValid(b);this._set("state",b?"":this._hasBeenBlurred?"Error":"Incomplete");this.focusNode.setAttribute("aria-invalid",b?"false":"true");var f=b?"":this._missingMsg;f&&this.focused&&this._hasBeenBlurred?a.show(f,this.domNode,this.tooltipPosition,!this.isLeftToRight()):a.hide(this.domNode);this._set("message",f);return b},isValid:function(){return!this.required||0===this.value||!/^\s*$/.test(this.value||
"")},reset:function(){this.inherited(arguments);a.hide(this.domNode);this._refreshState()},postMixInProperties:function(){this.inherited(arguments);this._missingMsg=e.getLocalization("dijit.form","validate",this.lang).missingMessage},postCreate:function(){this.inherited(arguments);this.own(c(this.domNode,"selectstart",function(a){a.preventDefault();a.stopPropagation()}));this.domNode.setAttribute("aria-expanded","false");var a=this._keyNavCodes;delete a[k.LEFT_ARROW];delete a[k.RIGHT_ARROW]},_setStyleAttr:function(a){this.inherited(arguments);
v.toggle(this.domNode,this.baseClass.replace(/\s+|$/g,"FixedWidth "),!!this.domNode.style.width)},isLoaded:function(){return this._isLoaded},loadDropDown:function(a){this._loadChildren(!0);this._isLoaded=!0;a()},destroy:function(b){this.dropDown&&!this.dropDown._destroyed&&(this.dropDown.destroyRecursive(b),delete this.dropDown);a.hide(this.domNode);this.inherited(arguments)},_onFocus:function(){this.validate(!0)},_onBlur:function(){a.hide(this.domNode);this.inherited(arguments);this.validate(!1)}});
h("dojo-bidi")&&(t=n("dijit.form.Select",t,{_setDisplay:function(a){this.inherited(arguments);this.applyTextDir(this.containerNode)}}));t._Menu=B;t.prototype._onContainerKeydown=F("_onContainerKeydown");t.prototype._onContainerKeypress=F("_onContainerKeypress");return t})},"dijit/form/_FormSelectWidget":function(){define("dojo/_base/array dojo/_base/Deferred dojo/aspect dojo/data/util/sorter dojo/_base/declare dojo/dom dojo/dom-class dojo/_base/kernel dojo/_base/lang dojo/query dojo/when dojo/store/util/QueryResults ./_FormValueWidget".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x){return t("dijit.form._FormSelectWidget",x,{multiple:!1,options:null,store:null,_setStoreAttr:function(b){this._created&&this._deprecatedSetStore(b)},query:null,_setQueryAttr:function(b){this._created&&this._deprecatedSetStore(this.store,this.selectedValue,{query:b})},queryOptions:null,_setQueryOptionsAttr:function(b){this._created&&this._deprecatedSetStore(this.store,this.selectedValue,{queryOptions:b})},labelAttr:"",onFetch:null,sortByLabel:!0,loadChildrenOnOpen:!1,
onLoadDeferred:null,getOptions:function(b){var g=this.options||[];if(null==b)return g;if(c.isArrayLike(b))return m.map(b,"return this.getOptions(item);",this);c.isString(b)&&(b={value:b});c.isObject(b)&&(m.some(g,function(a,f){for(var l in b)if(!(l in a)||a[l]!=b[l])return!1;b=f;return!0})||(b=-1));return 0<=b&&b<g.length?g[b]:null},addOption:function(b){m.forEach(c.isArrayLike(b)?b:[b],function(b){b&&c.isObject(b)&&this.options.push(b)},this);this._loadChildren()},removeOption:function(b){b=this.getOptions(c.isArrayLike(b)?
b:[b]);m.forEach(b,function(b){b&&(this.options=m.filter(this.options,function(a){return a.value!==b.value||a.label!==b.label}),this._removeOptionItem(b))},this);this._loadChildren()},updateOption:function(b){m.forEach(c.isArrayLike(b)?b:[b],function(b){var a=this.getOptions({value:b.value}),f;if(a)for(f in b)a[f]=b[f]},this);this._loadChildren()},setStore:function(b,g,a){r.deprecated(this.declaredClass+"::setStore(store, selectedValue, fetchArgs) is deprecated. Use set('query', fetchArgs.query), set('queryOptions', fetchArgs.queryOptions), set('store', store), or set('value', selectedValue) instead.",
"","2.0");this._deprecatedSetStore(b,g,a)},_deprecatedSetStore:function(b,g,a){var f=this.store;a=a||{};if(f!==b){for(var l;l=this._notifyConnections.pop();)l.remove();b.get||(c.mixin(b,{_oldAPI:!0,get:function(a){var b=new n;this.fetchItemByIdentity({identity:a,onItem:function(a){b.resolve(a)},onError:function(a){b.reject(a)}});return b.promise},query:function(a,b){var f=new n(function(){l.abort&&l.abort()});f.total=new n;var l=this.fetch(c.mixin({query:a,onBegin:function(a){f.total.resolve(a)},
onComplete:function(a){f.resolve(a)},onError:function(a){f.reject(a)}},b));return new u(f)}}),b.getFeatures()["dojo.data.api.Notification"]&&(this._notifyConnections=[d.after(b,"onNew",c.hitch(this,"_onNewItem"),!0),d.after(b,"onDelete",c.hitch(this,"_onDeleteItem"),!0),d.after(b,"onSet",c.hitch(this,"_onSetItem"),!0)]));this._set("store",b)}this.options&&this.options.length&&this.removeOption(this.options);this._queryRes&&this._queryRes.close&&this._queryRes.close();this._observeHandle&&this._observeHandle.remove&&
(this._observeHandle.remove(),this._observeHandle=null);a.query&&this._set("query",a.query);a.queryOptions&&this._set("queryOptions",a.queryOptions);b&&b.query&&(this._loadingStore=!0,this.onLoadDeferred=new n,this._queryRes=b.query(this.query,this.queryOptions),q(this._queryRes,c.hitch(this,function(f){if(this.sortByLabel&&!a.sort&&f.length)if(b.getValue)f.sort(v.createSortFunction([{attribute:b.getLabelAttributes(f[0])[0]}],b));else{var l=this.labelAttr;f.sort(function(a,b){return a[l]>b[l]?1:b[l]>
a[l]?-1:0})}a.onFetch&&(f=a.onFetch.call(this,f,a));m.forEach(f,function(a){this._addOptionForItem(a)},this);this._queryRes.observe&&(this._observeHandle=this._queryRes.observe(c.hitch(this,function(a,b,f){b==f?this._onSetItem(a):(-1!=b&&this._onDeleteItem(a),-1!=f&&this._onNewItem(a))}),!0));this._loadingStore=!1;this.set("value","_pendingValue"in this?this._pendingValue:g);delete this._pendingValue;this.loadChildrenOnOpen?this._pseudoLoadChildren(f):this._loadChildren();this.onLoadDeferred.resolve(!0);
this.onSetStore()}),c.hitch(this,function(a){console.error("dijit.form.Select: "+a.toString());this.onLoadDeferred.reject(a)})));return f},_setValueAttr:function(b,g){this._onChangeActive||(g=null);if(this._loadingStore)this._pendingValue=b;else if(null!=b){b=c.isArrayLike(b)?m.map(b,function(a){return c.isObject(a)?a:{value:a}}):c.isObject(b)?[b]:[{value:b}];b=m.filter(this.getOptions(b),function(a){return a&&a.value});var a=this.getOptions()||[];this.multiple||b[0]&&b[0].value||!a.length||(b[0]=
a[0]);m.forEach(a,function(a){a.selected=m.some(b,function(b){return b.value===a.value})});a=m.map(b,function(a){return a.value});if("undefined"!=typeof a&&"undefined"!=typeof a[0]){var f=m.map(b,function(a){return a.label});this._setDisplay(this.multiple?f:f[0]);this.inherited(arguments,[this.multiple?a:a[0],g]);this._updateSelection()}}},_getDisplayedValueAttr:function(){var b=m.map([].concat(this.get("selectedOptions")),function(b){return b&&"label"in b?b.label:b?b.value:null},this);return this.multiple?
b:b[0]},_setDisplayedValueAttr:function(b){this.set("value",this.getOptions("string"==typeof b?{label:b}:b))},_loadChildren:function(){this._loadingStore||(m.forEach(this._getChildren(),function(b){b.destroyRecursive()}),m.forEach(this.options,this._addOptionItem,this),this._updateSelection())},_updateSelection:function(){this.focusedChild=null;this._set("value",this._getValueFromOpts());var b=[].concat(this.value);if(b&&b[0]){var g=this;m.forEach(this._getChildren(),function(a){var f=m.some(b,function(b){return a.option&&
b===a.option.value});f&&!g.multiple&&(g.focusedChild=a);k.toggle(a.domNode,this.baseClass.replace(/\s+|$/g,"SelectedOption "),f);a.domNode.setAttribute("aria-selected",f?"true":"false")},this)}},_getValueFromOpts:function(){var b=this.getOptions()||[];if(!this.multiple&&b.length){var g=m.filter(b,function(a){return a.selected})[0];if(g&&g.value)return g.value;b[0].selected=!0;return b[0].value}return this.multiple?m.map(m.filter(b,function(a){return a.selected}),function(a){return a.value})||[]:""},
_onNewItem:function(b,g){g&&g.parent||this._addOptionForItem(b)},_onDeleteItem:function(b){this.removeOption({value:this.store.getIdentity(b)})},_onSetItem:function(b){this.updateOption(this._getOptionObjForItem(b))},_getOptionObjForItem:function(b){var g=this.store,a=this.labelAttr&&this.labelAttr in b?b[this.labelAttr]:g.getLabel(b);return{value:a?g.getIdentity(b):null,label:a,item:b}},_addOptionForItem:function(b){var g=this.store;g.isItemLoaded&&!g.isItemLoaded(b)?g.loadItem({item:b,onItem:function(a){this._addOptionForItem(a)},
scope:this}):(b=this._getOptionObjForItem(b),this.addOption(b))},constructor:function(b){this._oValue=(b||{}).value||null;this._notifyConnections=[]},buildRendering:function(){this.inherited(arguments);e.setSelectable(this.focusNode,!1)},_fillContent:function(){this.options||(this.options=this.srcNodeRef?h("\x3e *",this.srcNodeRef).map(function(b){return"separator"===b.getAttribute("type")?{value:"",label:"",selected:!1,disabled:!1}:{value:b.getAttribute("data-"+r._scopeName+"-value")||b.getAttribute("value"),
label:String(b.innerHTML),selected:b.getAttribute("selected")||!1,disabled:b.getAttribute("disabled")||!1}},this):[]);this.value?this.multiple&&"string"==typeof this.value&&this._set("value",this.value.split(",")):this._set("value",this._getValueFromOpts())},postCreate:function(){this.inherited(arguments);d.after(this,"onChange",c.hitch(this,"_updateSelection"));var b=this.store;b&&(b.getIdentity||b.getFeatures()["dojo.data.api.Identity"])&&(this.store=null,this._deprecatedSetStore(b,this._oValue,
{query:this.query,queryOptions:this.queryOptions}));this._storeInitialized=!0},startup:function(){this._loadChildren();this.inherited(arguments)},destroy:function(){for(var b;b=this._notifyConnections.pop();)b.remove();this._queryRes&&this._queryRes.close&&this._queryRes.close();this._observeHandle&&this._observeHandle.remove&&(this._observeHandle.remove(),this._observeHandle=null);this.inherited(arguments)},_addOptionItem:function(){},_removeOptionItem:function(){},_setDisplay:function(){},_getChildren:function(){return[]},
_getSelectedOptionsAttr:function(){return this.getOptions({selected:!0})},_pseudoLoadChildren:function(){},onSetStore:function(){}})})},"dojo/data/util/sorter":function(){define(["../../_base/lang"],function(m){var n={};m.setObject("dojo.data.util.sorter",n);n.basicComparator=function(d,n){var t=-1;null===d&&(d=void 0);null===n&&(n=void 0);if(d==n)t=0;else if(d>n||null==d)t=1;return t};n.createSortFunction=function(d,v){function t(c,b,g,a){return function(f,l){var h=a.getValue(f,c),q=a.getValue(l,
c);return b*g(h,q)}}for(var e=[],k,r=v.comparatorMap,c=n.basicComparator,h=0;h<d.length;h++){k=d[h];var q=k.attribute;if(q){k=k.descending?-1:1;var u=c;r&&("string"!==typeof q&&"toString"in q&&(q=q.toString()),u=r[q]||c);e.push(t(q,k,u,v))}}return function(c,b){for(var g=0;g<e.length;){var a=e[g++](c,b);if(0!==a)return a}return 0}};return n})},"dijit/form/_FormValueWidget":function(){define(["dojo/_base/declare","dojo/sniff","./_FormWidget","./_FormValueMixin"],function(m,n,d,v){return m("dijit.form._FormValueWidget",
[d,v],{_layoutHackIE7:function(){if(7==n("ie"))for(var d=this.domNode,e=d.parentNode,k=d.firstChild||d,r=k.style.filter,c=this;e&&0==e.clientHeight;)(function(){var h=c.connect(e,"onscroll",function(){c.disconnect(h);k.style.filter=(new Date).getMilliseconds();c.defer(function(){k.style.filter=r})})})(),e=e.parentNode}})})},"dijit/form/_FormWidget":function(){define("dojo/_base/declare dojo/sniff dojo/_base/kernel dojo/ready ../_Widget ../_CssStateMixin ../_TemplatedMixin ./_FormWidgetMixin".split(" "),
function(m,n,d,v,t,e,k,r){n("dijit-legacy-requires")&&v(0,function(){require(["dijit/form/_FormValueWidget"])});return m("dijit.form._FormWidget",[t,k,e,r],{setDisabled:function(c){d.deprecated("setDisabled("+c+") is deprecated. Use set('disabled',"+c+") instead.","","2.0");this.set("disabled",c)},setValue:function(c){d.deprecated("dijit.form._FormWidget:setValue("+c+") is deprecated.  Use set('value',"+c+") instead.","","2.0");this.set("value",c)},getValue:function(){d.deprecated(this.declaredClass+
"::getValue() is deprecated. Use get('value') instead.","","2.0");return this.get("value")},postMixInProperties:function(){this.nameAttrSetting=this.name&&!n("msapp")?'name\x3d"'+this.name.replace(/"/g,"\x26quot;")+'"':"";this.inherited(arguments)}})})},"dijit/_Widget":function(){define("dojo/aspect dojo/_base/config dojo/_base/connect dojo/_base/declare dojo/has dojo/_base/kernel dojo/_base/lang dojo/query dojo/ready ./registry ./_WidgetBase ./_OnDijitClickMixin ./_FocusMixin dojo/uacss ./hccss".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x){function b(){}function g(a){return function(f,l,g,c){return f&&"string"==typeof l&&f[l]==b?f.on(l.substring(2).toLowerCase(),k.hitch(g,c)):a.apply(d,arguments)}}m.around(d,"connect",g);e.connect&&m.around(e,"connect",g);m=v("dijit._Widget",[q,u,x],{onClick:b,onDblClick:b,onKeyDown:b,onKeyPress:b,onKeyUp:b,onMouseDown:b,onMouseMove:b,onMouseOut:b,onMouseOver:b,onMouseLeave:b,onMouseEnter:b,onMouseUp:b,constructor:function(a){this._toConnect={};for(var f in a)this[f]===
b&&(this._toConnect[f.replace(/^on/,"").toLowerCase()]=a[f],delete a[f])},postCreate:function(){this.inherited(arguments);for(var a in this._toConnect)this.on(a,this._toConnect[a]);delete this._toConnect},on:function(a,f){return this[this._onMap(a)]===b?d.connect(this.domNode,a.toLowerCase(),this,f):this.inherited(arguments)},_setFocusedAttr:function(a){this._focused=a;this._set("focused",a)},setAttribute:function(a,b){e.deprecated(this.declaredClass+"::setAttribute(attr, value) is deprecated. Use set() instead.",
"","2.0");this.set(a,b)},attr:function(a,b){return 2<=arguments.length||"object"===typeof a?this.set.apply(this,arguments):this.get(a)},getDescendants:function(){e.deprecated(this.declaredClass+"::getDescendants() is deprecated. Use getChildren() instead.","","2.0");return this.containerNode?r("[widgetId]",this.containerNode).map(h.byNode):[]},_onShow:function(){this.onShow()},onShow:function(){},onHide:function(){},onClose:function(){return!0}});t("dijit-legacy-requires")&&c(0,function(){require(["dijit/_base"])});
return m})},"dijit/_OnDijitClickMixin":function(){define("dojo/on dojo/_base/array dojo/keys dojo/_base/declare dojo/has ./a11yclick".split(" "),function(m,n,d,v,t,e){m=v("dijit._OnDijitClickMixin",null,{connect:function(d,r,c){return this.inherited(arguments,[d,"ondijitclick"==r?e:r,c])}});m.a11yclick=e;return m})},"dijit/_FocusMixin":function(){define(["./focus","./_WidgetBase","dojo/_base/declare","dojo/_base/lang"],function(m,n,d,v){v.extend(n,{focused:!1,onFocus:function(){},onBlur:function(){},
_onFocus:function(){this.onFocus()},_onBlur:function(){this.onBlur()}});return d("dijit._FocusMixin",null,{_focusManager:m})})},"dijit/hccss":function(){define(["dojo/dom-class","dojo/hccss","dojo/domReady","dojo/_base/window"],function(m,n,d,v){d(function(){n("highcontrast")&&m.add(v.body(),"dijit_a11y")});return n})},"dojo/hccss":function(){define("require ./_base/config ./dom-class ./dom-style ./has ./domReady ./_base/window".split(" "),function(m,n,d,v,t,e,k){t.add("highcontrast",function(){var d=
k.doc.createElement("div");try{d.style.cssText='border: 1px solid; border-color:red green; position: absolute; height: 5px; top: -999px;background-image: url("'+(n.blankGif||m.toUrl("./resources/blank.gif"))+'");';k.body().appendChild(d);var c=v.getComputedStyle(d),h=c.backgroundImage;return c.borderTopColor==c.borderRightColor||h&&("none"==h||"url(invalid-url:)"==h)}catch(q){return console.warn("hccss: exception detecting high-contrast mode, document is likely hidden: "+q.toString()),!1}finally{8>=
t("ie")?d.outerHTML="":k.body().removeChild(d)}});e(function(){t("highcontrast")&&d.add(k.body(),"dj_a11y")});return t})},"dijit/_CssStateMixin":function(){define("dojo/_base/array dojo/_base/declare dojo/dom dojo/dom-class dojo/has dojo/_base/lang dojo/on dojo/domReady dojo/touch dojo/_base/window ./a11yclick ./registry".split(" "),function(m,n,d,v,t,e,k,r,c,h,q,u){n=n("dijit._CssStateMixin",[],{hovering:!1,active:!1,_applyAttributes:function(){this.inherited(arguments);m.forEach("disabled readOnly checked selected focused state hovering active _opened".split(" "),
function(b){this.watch(b,e.hitch(this,"_setStateClass"))},this);for(var c in this.cssStateNodes||{})this._trackMouseState(this[c],this.cssStateNodes[c]);this._trackMouseState(this.domNode,this.baseClass);this._setStateClass()},_cssMouseEvent:function(c){if(!this.disabled)switch(c.type){case "mouseover":case "MSPointerOver":case "pointerover":this._set("hovering",!0);this._set("active",this._mouseDown);break;case "mouseout":case "MSPointerOut":case "pointerout":this._set("hovering",!1);this._set("active",
!1);break;case "mousedown":case "touchstart":case "MSPointerDown":case "pointerdown":case "keydown":this._set("active",!0);break;case "mouseup":case "dojotouchend":case "MSPointerUp":case "pointerup":case "keyup":this._set("active",!1)}},_setStateClass:function(){function c(a){b=b.concat(m.map(b,function(b){return b+a}),"dijit"+a)}var b=this.baseClass.split(" ");this.isLeftToRight()||c("Rtl");var g="mixed"==this.checked?"Mixed":this.checked?"Checked":"";this.checked&&c(g);this.state&&c(this.state);
this.selected&&c("Selected");this._opened&&c("Opened");this.disabled?c("Disabled"):this.readOnly?c("ReadOnly"):this.active?c("Active"):this.hovering&&c("Hover");this.focused&&c("Focused");var g=this.stateNode||this.domNode,a={};m.forEach(g.className.split(" "),function(b){a[b]=!0});"_stateClasses"in this&&m.forEach(this._stateClasses,function(b){delete a[b]});m.forEach(b,function(b){a[b]=!0});var f=[],l;for(l in a)f.push(l);g.className=f.join(" ");this._stateClasses=b},_subnodeCssMouseEvent:function(c,
b,g){function a(a){v.toggle(c,b+"Active",a)}if(!this.disabled&&!this.readOnly)switch(g.type){case "mouseover":case "MSPointerOver":case "pointerover":v.toggle(c,b+"Hover",!0);break;case "mouseout":case "MSPointerOut":case "pointerout":v.toggle(c,b+"Hover",!1);a(!1);break;case "mousedown":case "touchstart":case "MSPointerDown":case "pointerdown":case "keydown":a(!0);break;case "mouseup":case "MSPointerUp":case "pointerup":case "dojotouchend":case "keyup":a(!1);break;case "focus":case "focusin":v.toggle(c,
b+"Focused",!0);break;case "blur":case "focusout":v.toggle(c,b+"Focused",!1)}},_trackMouseState:function(c,b){c._cssState=b}});r(function(){function x(a,b,l){if(!l||!d.isDescendant(l,b))for(;b&&b!=l;b=b.parentNode)if(b._cssState){var f=u.getEnclosingWidget(b);f&&(b==f.domNode?f._cssMouseEvent(a):f._subnodeCssMouseEvent(b,b._cssState,a))}}var b=h.body(),g;k(b,c.over,function(a){x(a,a.target,a.relatedTarget)});k(b,c.out,function(a){x(a,a.target,a.relatedTarget)});k(b,q.press,function(a){g=a.target;
x(a,g)});k(b,q.release,function(a){x(a,g);g=null});k(b,"focusin, focusout",function(a){var b=a.target;if(b._cssState&&!b.getAttribute("widgetId")){var l=u.getEnclosingWidget(b);l&&l._subnodeCssMouseEvent(b,b._cssState,a)}})});return n})},"dijit/form/_FormWidgetMixin":function(){define("dojo/_base/array dojo/_base/declare dojo/dom-attr dojo/dom-style dojo/_base/lang dojo/mouse dojo/on dojo/sniff dojo/window ../a11y".split(" "),function(m,n,d,v,t,e,k,r,c,h){return n("dijit.form._FormWidgetMixin",null,
{name:"",alt:"",value:"",type:"text","aria-label":"focusNode",tabIndex:"0",_setTabIndexAttr:"focusNode",disabled:!1,intermediateChanges:!1,scrollOnFocus:!0,_setIdAttr:"focusNode",_setDisabledAttr:function(c){this._set("disabled",c);/^(button|input|select|textarea|optgroup|option|fieldset)$/i.test(this.focusNode.tagName)?d.set(this.focusNode,"disabled",c):this.focusNode.setAttribute("aria-disabled",c?"true":"false");this.valueNode&&d.set(this.valueNode,"disabled",c);c?(this._set("hovering",!1),this._set("active",
!1),c="tabIndex"in this.attributeMap?this.attributeMap.tabIndex:"_setTabIndexAttr"in this?this._setTabIndexAttr:"focusNode",m.forEach(t.isArray(c)?c:[c],function(c){c=this[c];r("webkit")||h.hasDefaultTabStop(c)?c.setAttribute("tabIndex","-1"):c.removeAttribute("tabIndex")},this)):""!=this.tabIndex&&this.set("tabIndex",this.tabIndex)},_onFocus:function(h){if("mouse"==h&&this.isFocusable())var q=this.own(k(this.focusNode,"focus",function(){b.remove();q.remove()}))[0],d=r("pointer-events")?"pointerup":
r("MSPointer")?"MSPointerUp":r("touch-events")?"touchend, mouseup":"mouseup",b=this.own(k(this.ownerDocumentBody,d,t.hitch(this,function(g){b.remove();q.remove();this.focused&&("touchend"==g.type?this.defer("focus"):this.focus())})))[0];this.scrollOnFocus&&this.defer(function(){c.scrollIntoView(this.domNode)});this.inherited(arguments)},isFocusable:function(){return!this.disabled&&this.focusNode&&"none"!=v.get(this.domNode,"display")},focus:function(){if(!this.disabled&&this.focusNode.focus)try{this.focusNode.focus()}catch(q){}},
compare:function(c,h){return"number"==typeof c&&"number"==typeof h?isNaN(c)&&isNaN(h)?0:c-h:c>h?1:c<h?-1:0},onChange:function(){},_onChangeActive:!1,_handleOnChange:function(c,h){void 0!=this._lastValueReported||null!==h&&this._onChangeActive||(this._resetValue=this._lastValueReported=c);this._pendingOnChange=this._pendingOnChange||typeof c!=typeof this._lastValueReported||0!=this.compare(c,this._lastValueReported);(this.intermediateChanges||h||void 0===h)&&this._pendingOnChange&&(this._lastValueReported=
c,this._pendingOnChange=!1,this._onChangeActive&&(this._onChangeHandle&&this._onChangeHandle.remove(),this._onChangeHandle=this.defer(function(){this._onChangeHandle=null;this.onChange(c)})))},create:function(){this.inherited(arguments);this._onChangeActive=!0},destroy:function(){this._onChangeHandle&&(this._onChangeHandle.remove(),this.onChange(this._lastValueReported));this.inherited(arguments)}})})},"dijit/form/_FormValueMixin":function(){define("dojo/_base/declare dojo/dom-attr dojo/keys dojo/_base/lang dojo/on ./_FormWidgetMixin".split(" "),
function(m,n,d,v,t,e){return m("dijit.form._FormValueMixin",e,{readOnly:!1,_setReadOnlyAttr:function(d){n.set(this.focusNode,"readOnly",d);this._set("readOnly",d)},postCreate:function(){this.inherited(arguments);void 0===this._resetValue&&(this._lastValueReported=this._resetValue=this.value)},_setValueAttr:function(d,e){this._handleOnChange(d,e)},_handleOnChange:function(d,e){this._set("value",d);this.inherited(arguments)},undo:function(){this._setValueAttr(this._lastValueReported,!1)},reset:function(){this._hasBeenBlurred=
!1;this._setValueAttr(this._resetValue,!0)}})})},"dijit/_HasDropDown":function(){define("dojo/_base/declare dojo/_base/Deferred dojo/dom dojo/dom-attr dojo/dom-class dojo/dom-geometry dojo/dom-style dojo/has dojo/keys dojo/_base/lang dojo/on dojo/touch ./registry ./focus ./popup ./_FocusMixin".split(" "),function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,a){return m("dijit._HasDropDown",a,{_buttonNode:null,_arrowWrapperNode:null,_popupStateNode:null,_aroundNode:null,dropDown:null,autoWidth:!0,forceWidth:!1,maxHeight:-1,
dropDownPosition:["below","above"],_stopClickEvents:!0,_onDropDownMouseDown:function(a){this.disabled||this.readOnly||("MSPointerDown"!=a.type&&a.preventDefault(),this.own(q.once(this.ownerDocument,u.release,h.hitch(this,"_onDropDownMouseUp"))),this.toggleDropDown())},_onDropDownMouseUp:function(a){var b=this.dropDown,f=!1;if(a&&this._opened){var g=e.position(this._buttonNode,!0);if(!(a.pageX>=g.x&&a.pageX<=g.x+g.w&&a.pageY>=g.y&&a.pageY<=g.y+g.h)){for(g=a.target;g&&!f;)t.contains(g,"dijitPopup")?
f=!0:g=g.parentNode;if(f){g=a.target;if(b.onItemClick){for(var c;g&&!(c=x.byNode(g));)g=g.parentNode;if(c&&c.onClick&&c.getParent)c.getParent().onItemClick(c,a)}return}}}this._opened?b.focus&&(!1!==b.autoFocus||"mouseup"==a.type&&!this.hovering)&&(this._focusDropDownTimer=this.defer(function(){b.focus();delete this._focusDropDownTimer})):this.focus&&this.defer("focus")},_onDropDownClick:function(a){this._stopClickEvents&&(a.stopPropagation(),a.preventDefault())},buildRendering:function(){this.inherited(arguments);
this._buttonNode=this._buttonNode||this.focusNode||this.domNode;this._popupStateNode=this._popupStateNode||this.focusNode||this._buttonNode;var a={after:this.isLeftToRight()?"Right":"Left",before:this.isLeftToRight()?"Left":"Right",above:"Up",below:"Down",left:"Left",right:"Right"}[this.dropDownPosition[0]]||this.dropDownPosition[0]||"Down";t.add(this._arrowWrapperNode||this._buttonNode,"dijit"+a+"ArrowButton")},postCreate:function(){this.inherited(arguments);var a=this.focusNode||this.domNode;this.own(q(this._buttonNode,
u.press,h.hitch(this,"_onDropDownMouseDown")),q(this._buttonNode,"click",h.hitch(this,"_onDropDownClick")),q(a,"keydown",h.hitch(this,"_onKey")),q(a,"keyup",h.hitch(this,"_onKeyUp")))},destroy:function(){this._opened&&this.closeDropDown(!0);this.dropDown&&(this.dropDown._destroyed||this.dropDown.destroyRecursive(),delete this.dropDown);this.inherited(arguments)},_onKey:function(a){if(!this.disabled&&!this.readOnly){var b=this.dropDown,f=a.target;b&&this._opened&&b.handleKey&&!1===b.handleKey(a)?(a.stopPropagation(),
a.preventDefault()):b&&this._opened&&a.keyCode==c.ESCAPE?(this.closeDropDown(),a.stopPropagation(),a.preventDefault()):!this._opened&&(a.keyCode==c.DOWN_ARROW||(a.keyCode==c.ENTER||a.keyCode==c.SPACE&&(!this._searchTimer||a.ctrlKey||a.altKey||a.metaKey))&&("input"!==(f.tagName||"").toLowerCase()||f.type&&"text"!==f.type.toLowerCase()))&&(this._toggleOnKeyUp=!0,a.stopPropagation(),a.preventDefault())}},_onKeyUp:function(){if(this._toggleOnKeyUp){delete this._toggleOnKeyUp;this.toggleDropDown();var a=
this.dropDown;a&&a.focus&&this.defer(h.hitch(a,"focus"),1)}},_onBlur:function(){this.closeDropDown(!1);this.inherited(arguments)},isLoaded:function(){return!0},loadDropDown:function(a){a()},loadAndOpenDropDown:function(){var a=new n,b=h.hitch(this,function(){this.openDropDown();a.resolve(this.dropDown)});this.isLoaded()?b():this.loadDropDown(b);return a},toggleDropDown:function(){this.disabled||this.readOnly||(this._opened?this.closeDropDown(!0):this.loadAndOpenDropDown())},openDropDown:function(){var a=
this.dropDown,b=a.domNode,c=this._aroundNode||this.domNode,d=this,q=g.open({parent:this,popup:a,around:c,orient:this.dropDownPosition,maxHeight:this.maxHeight,onExecute:function(){d.closeDropDown(!0)},onCancel:function(){d.closeDropDown(!0)},onClose:function(){v.set(d._popupStateNode,"popupActive",!1);t.remove(d._popupStateNode,"dijitHasDropDownOpen");d._set("_opened",!1)}});if(this.forceWidth||this.autoWidth&&c.offsetWidth>a._popupWrapper.offsetWidth){var c=c.offsetWidth-a._popupWrapper.offsetWidth,
u={w:a.domNode.offsetWidth+c};this._origStyle=b.style.cssText;h.isFunction(a.resize)?a.resize(u):e.setMarginBox(b,u);"R"==q.corner[1]&&(a._popupWrapper.style.left=a._popupWrapper.style.left.replace("px","")-c+"px")}v.set(this._popupStateNode,"popupActive","true");t.add(this._popupStateNode,"dijitHasDropDownOpen");this._set("_opened",!0);this._popupStateNode.setAttribute("aria-expanded","true");this._popupStateNode.setAttribute("aria-owns",a.id);"presentation"===b.getAttribute("role")||b.getAttribute("aria-labelledby")||
b.setAttribute("aria-labelledby",this.id);return q},closeDropDown:function(a){this._focusDropDownTimer&&(this._focusDropDownTimer.remove(),delete this._focusDropDownTimer);this._opened&&(this._popupStateNode.setAttribute("aria-expanded","false"),a&&this.focus&&this.focus(),g.close(this.dropDown),this._opened=!1);this._origStyle&&(this.dropDown.domNode.style.cssText=this._origStyle,delete this._origStyle)}})})},"dijit/popup":function(){define("dojo/_base/array dojo/aspect dojo/_base/declare dojo/dom dojo/dom-attr dojo/dom-construct dojo/dom-geometry dojo/dom-style dojo/has dojo/keys dojo/_base/lang dojo/on ./place ./BackgroundIframe ./Viewport ./main dojo/touch".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,a){function f(){this._popupWrapper&&(e.destroy(this._popupWrapper),delete this._popupWrapper)}d=d(null,{_stack:[],_beginZIndex:1E3,_idGen:1,_repositionAll:function(){if(this._firstAroundNode){var a=this._firstAroundPosition,b=k.position(this._firstAroundNode,!0),f=b.x-a.x,a=b.y-a.y;if(f||a)for(this._firstAroundPosition=b,b=0;b<this._stack.length;b++){var g=this._stack[b].wrapper.style;g.top=parseFloat(g.top)+a+"px";"auto"==g.right?g.left=parseFloat(g.left)+f+
"px":g.right=parseFloat(g.right)-f+"px"}this._aroundMoveListener=setTimeout(q.hitch(this,"_repositionAll"),f||a?10:50)}},_createWrapper:function(a){var b=a._popupWrapper,l=a.domNode;b||(b=e.create("div",{"class":"dijitPopup",style:{display:"none"},role:"region","aria-label":a["aria-label"]||a.label||a.name||a.id},a.ownerDocumentBody),b.appendChild(l),l=l.style,l.display="",l.visibility="",l.position="",l.top="0px",a._popupWrapper=b,n.after(a,"destroy",f,!0),"ontouchend"in document&&u(b,"touchend",
function(a){/^(input|button|textarea)$/i.test(a.target.tagName)||a.preventDefault()}),b.dojoClick=!0);return b},moveOffScreen:function(a){var b=this._createWrapper(a);a=k.isBodyLtr(a.ownerDocument);var f={visibility:"hidden",top:"-9999px",display:""};f[a?"left":"right"]="-9999px";f[a?"right":"left"]="auto";r.set(b,f);return b},hide:function(a){var b=this._createWrapper(a);r.set(b,{display:"none",height:"auto",overflowY:"visible",border:""});a=a.domNode;"_originalStyle"in a&&(a.style.cssText=a._originalStyle)},
getTopPopup:function(){for(var a=this._stack,b=a.length-1;0<b&&a[b].parent===a[b-1].widget;b--);return a[b]},open:function(a){for(var f=this._stack,l=a.popup,d=l.domNode,e=a.orient||["below","below-alt","above","above-alt"],z=a.parent?a.parent.isLeftToRight():k.isBodyLtr(l.ownerDocument),w=a.around,D=a.around&&a.around.id?a.around.id+"_dropdown":"popup_"+this._idGen++;f.length&&(!a.parent||!v.isDescendant(a.parent.domNode,f[f.length-1].widget.domNode));)this.close(f[f.length-1].widget);var C=this.moveOffScreen(l);
l.startup&&!l._started&&l.startup();var E,n=k.position(d);if("maxHeight"in a&&-1!=a.maxHeight)E=a.maxHeight||Infinity;else{E=g.getEffectiveBox(this.ownerDocument);var m=w?k.position(w,!1):{y:a.y-(a.padding||0),h:2*(a.padding||0)};E=Math.floor(Math.max(m.y,E.h-(m.y+m.h)))}n.h>E&&(n=r.getComputedStyle(d),r.set(C,{overflowY:"scroll",height:E+"px",border:n.borderLeftWidth+" "+n.borderLeftStyle+" "+n.borderLeftColor}),d._originalStyle=d.style.cssText,d.style.border="none");t.set(C,{id:D,style:{zIndex:this._beginZIndex+
f.length},"class":"dijitPopup "+(l.baseClass||l["class"]||"").split(" ")[0]+"Popup",dijitPopupParent:a.parent?a.parent.id:""});0==f.length&&w&&(this._firstAroundNode=w,this._firstAroundPosition=k.position(w,!0),this._aroundMoveListener=setTimeout(q.hitch(this,"_repositionAll"),50));c("config-bgIframe")&&!l.bgIframe&&(l.bgIframe=new b(C));D=l.orient?q.hitch(l,"orient"):null;e=w?x.around(C,w,e,z,D):x.at(C,a,"R"==e?["TR","BR","TL","BL"]:["TL","BL","TR","BR"],a.padding,D);C.style.visibility="visible";
d.style.visibility="visible";d=[];d.push(u(C,"keydown",q.hitch(this,function(b){if(b.keyCode==h.ESCAPE&&a.onCancel)b.stopPropagation(),b.preventDefault(),a.onCancel();else if(b.keyCode==h.TAB&&(b.stopPropagation(),b.preventDefault(),(b=this.getTopPopup())&&b.onCancel))b.onCancel()})));l.onCancel&&a.onCancel&&d.push(l.on("cancel",a.onCancel));d.push(l.on(l.onExecute?"execute":"change",q.hitch(this,function(){var a=this.getTopPopup();if(a&&a.onExecute)a.onExecute()})));f.push({widget:l,wrapper:C,parent:a.parent,
onExecute:a.onExecute,onCancel:a.onCancel,onClose:a.onClose,handlers:d});if(l.onOpen)l.onOpen(e);return e},close:function(a){for(var b=this._stack;a&&m.some(b,function(b){return b.widget==a})||!a&&b.length;){var f=b.pop(),l=f.widget,g=f.onClose;l.bgIframe&&(l.bgIframe.destroy(),delete l.bgIframe);if(l.onClose)l.onClose();for(var c;c=f.handlers.pop();)c.remove();l&&l.domNode&&this.hide(l);g&&g()}0==b.length&&this._aroundMoveListener&&(clearTimeout(this._aroundMoveListener),this._firstAroundNode=this._firstAroundPosition=
this._aroundMoveListener=null)}});return a.popup=new d})},"dijit/place":function(){define("dojo/_base/array dojo/dom-geometry dojo/dom-style dojo/_base/kernel dojo/_base/window ./Viewport ./main".split(" "),function(m,n,d,v,t,e,k){function r(c,q,u,x){var b=e.getEffectiveBox(c.ownerDocument);c.parentNode&&"body"==String(c.parentNode.tagName).toLowerCase()||t.body(c.ownerDocument).appendChild(c);var g=null;m.some(q,function(a){var f=a.corner,l=a.pos,h=0,d={w:{L:b.l+b.w-l.x,R:l.x-b.l,M:b.w}[f.charAt(1)],
h:{T:b.t+b.h-l.y,B:l.y-b.t,M:b.h}[f.charAt(0)]},q=c.style;q.left=q.right="auto";u&&(h=u(c,a.aroundCorner,f,d,x),h="undefined"==typeof h?0:h);var w=c.style,e=w.display,k=w.visibility;"none"==w.display&&(w.visibility="hidden",w.display="");q=n.position(c);w.display=e;w.visibility=k;e={L:l.x,R:l.x-q.w,M:Math.max(b.l,Math.min(b.l+b.w,l.x+(q.w>>1))-q.w)}[f.charAt(1)];k={T:l.y,B:l.y-q.h,M:Math.max(b.t,Math.min(b.t+b.h,l.y+(q.h>>1))-q.h)}[f.charAt(0)];l=Math.max(b.l,e);w=Math.max(b.t,k);e=Math.min(b.l+b.w,
e+q.w)-l;k=Math.min(b.t+b.h,k+q.h)-w;h+=q.w-e+(q.h-k);if(null==g||h<g.overflow)g={corner:f,aroundCorner:a.aroundCorner,x:l,y:w,w:e,h:k,overflow:h,spaceAvailable:d};return!h});g.overflow&&u&&u(c,g.aroundCorner,g.corner,g.spaceAvailable,x);q=g.y;var a=g.x,f=t.body(c.ownerDocument);/relative|absolute/.test(d.get(f,"position"))&&(q-=d.get(f,"marginTop"),a-=d.get(f,"marginLeft"));f=c.style;f.top=q+"px";f.left=a+"px";f.right="auto";return g}var c={TL:"BR",TR:"BL",BL:"TR",BR:"TL"};return k.place={at:function(h,
d,u,e,b){u=m.map(u,function(b){var a={corner:b,aroundCorner:c[b],pos:{x:d.x,y:d.y}};e&&(a.pos.x+="L"==b.charAt(1)?e.x:-e.x,a.pos.y+="T"==b.charAt(0)?e.y:-e.y);return a});return r(h,u,b)},around:function(c,q,u,e,b){function g(a,b){t.push({aroundCorner:a,corner:b,pos:{x:{L:A,R:A+w,M:A+(w>>1)}[a.charAt(1)],y:{T:z,B:z+D,M:z+(D>>1)}[a.charAt(0)]}})}var a;if("string"==typeof q||"offsetWidth"in q||"ownerSVGElement"in q){if(a=n.position(q,!0),/^(above|below)/.test(u[0])){var f=n.getBorderExtents(q),l=q.firstChild?
n.getBorderExtents(q.firstChild):{t:0,l:0,b:0,r:0},h=n.getBorderExtents(c),x=c.firstChild?n.getBorderExtents(c.firstChild):{t:0,l:0,b:0,r:0};a.y+=Math.min(f.t+l.t,h.t+x.t);a.h-=Math.min(f.t+l.t,h.t+x.t)+Math.min(f.b+l.b,h.b+x.b)}}else a=q;if(q.parentNode)for(f="absolute"==d.getComputedStyle(q).position,q=q.parentNode;q&&1==q.nodeType&&"BODY"!=q.nodeName;){l=n.position(q,!0);h=d.getComputedStyle(q);/relative|absolute/.test(h.position)&&(f=!1);if(!f&&/hidden|auto|scroll/.test(h.overflow)){var x=Math.min(a.y+
a.h,l.y+l.h),k=Math.min(a.x+a.w,l.x+l.w);a.x=Math.max(a.x,l.x);a.y=Math.max(a.y,l.y);a.h=x-a.y;a.w=k-a.x}"absolute"==h.position&&(f=!0);q=q.parentNode}var A=a.x,z=a.y,w="w"in a?a.w:a.w=a.width,D="h"in a?a.h:(v.deprecated("place.around: dijit/place.__Rectangle: { x:"+A+", y:"+z+", height:"+a.height+", width:"+w+" } has been deprecated.  Please use { x:"+A+", y:"+z+", h:"+a.height+", w:"+w+" }","","2.0"),a.h=a.height),t=[];m.forEach(u,function(a){var b=e;switch(a){case "above-centered":g("TM","BM");
break;case "below-centered":g("BM","TM");break;case "after-centered":b=!b;case "before-centered":g(b?"ML":"MR",b?"MR":"ML");break;case "after":b=!b;case "before":g(b?"TL":"TR",b?"TR":"TL");g(b?"BL":"BR",b?"BR":"BL");break;case "below-alt":b=!b;case "below":g(b?"BL":"BR",b?"TL":"TR");g(b?"BR":"BL",b?"TR":"TL");break;case "above-alt":b=!b;case "above":g(b?"TL":"TR",b?"BL":"BR");g(b?"TR":"TL",b?"BR":"BL");break;default:g(a.aroundCorner,a.corner)}});c=r(c,t,b,{w:w,h:D});c.aroundNodePos=a;return c}}})},
"dijit/Viewport":function(){define(["dojo/Evented","dojo/on","dojo/domReady","dojo/sniff","dojo/window"],function(m,n,d,v,t){var e=new m,k;d(function(){var d=t.getBox();e._rlh=n(window,"resize",function(){var c=t.getBox();if(d.h!=c.h||d.w!=c.w)d=c,e.emit("resize")});if(8==v("ie")){var c=screen.deviceXDPI;setInterval(function(){screen.deviceXDPI!=c&&(c=screen.deviceXDPI,e.emit("resize"))},500)}v("ios")&&(n(document,"focusin",function(c){k=c.target}),n(document,"focusout",function(c){k=null}))});e.getEffectiveBox=
function(d){d=t.getBox(d);var c=k&&k.tagName&&k.tagName.toLowerCase();v("ios")&&k&&!k.readOnly&&("textarea"==c||"input"==c&&/^(color|email|number|password|search|tel|text|url)$/.test(k.type))&&(d.h*=0==orientation||180==orientation?.66:.4,c=k.getBoundingClientRect(),d.h=Math.max(d.h,c.top+c.height));return d};return e})},"dijit/BackgroundIframe":function(){define("require ./main dojo/_base/config dojo/dom-construct dojo/dom-style dojo/_base/lang dojo/on dojo/sniff".split(" "),function(m,n,d,v,t,e,
k,r){r.add("config-bgIframe",(r("ie")||r("trident"))&&!/IEMobile\/10\.0/.test(navigator.userAgent));var c=new function(){var c=[];this.pop=function(){var h;c.length?(h=c.pop(),h.style.display=""):(9>r("ie")?(h=d.dojoBlankHtmlUrl||m.toUrl("dojo/resources/blank.html")||'javascript:""',h=document.createElement("\x3ciframe src\x3d'"+h+"' role\x3d'presentation' style\x3d'position: absolute; left: 0px; top: 0px;z-index: -1; filter:Alpha(Opacity\x3d\"0\");'\x3e")):(h=v.create("iframe"),h.src='javascript:""',
h.className="dijitBackgroundIframe",h.setAttribute("role","presentation"),t.set(h,"opacity",.1)),h.tabIndex=-1);return h};this.push=function(h){h.style.display="none";c.push(h)}};n.BackgroundIframe=function(h){if(!h.id)throw Error("no id");if(r("config-bgIframe")){var d=this.iframe=c.pop();h.appendChild(d);7>r("ie")||r("quirks")?(this.resize(h),this._conn=k(h,"resize",e.hitch(this,"resize",h))):t.set(d,{width:"100%",height:"100%"})}};e.extend(n.BackgroundIframe,{resize:function(c){this.iframe&&t.set(this.iframe,
{width:c.offsetWidth+"px",height:c.offsetHeight+"px"})},destroy:function(){this._conn&&(this._conn.remove(),this._conn=null);this.iframe&&(this.iframe.parentNode.removeChild(this.iframe),c.push(this.iframe),delete this.iframe)}});return n.BackgroundIframe})},"dijit/DropDownMenu":function(){define(["dojo/_base/declare","dojo/keys","dojo/text!./templates/Menu.html","./_MenuBase"],function(m,n,d,v){return m("dijit.DropDownMenu",v,{templateString:d,baseClass:"dijitMenu",_onUpArrow:function(){this.focusPrev()},
_onDownArrow:function(){this.focusNext()},_onRightArrow:function(d){this._moveToPopup(d);d.stopPropagation();d.preventDefault()},_onLeftArrow:function(d){if(this.parentMenu)if(this.parentMenu._isMenuBar)this.parentMenu.focusPrev();else this.onCancel(!1);else d.stopPropagation(),d.preventDefault()}})})},"dijit/_MenuBase":function(){define("dojo/_base/array dojo/_base/declare dojo/dom dojo/dom-attr dojo/dom-class dojo/_base/lang dojo/mouse dojo/on dojo/window ./a11yclick ./registry ./_Widget ./_CssStateMixin ./_KeyNavContainer ./_TemplatedMixin".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g){return n("dijit._MenuBase",[u,g,b,x],{selected:null,_setSelectedAttr:function(a){this.selected!=a&&(this.selected&&(this.selected._setSelected(!1),this._onChildDeselect(this.selected)),a&&a._setSelected(!0),this._set("selected",a))},activated:!1,_setActivatedAttr:function(a){t.toggle(this.domNode,"dijitMenuActive",a);t.toggle(this.domNode,"dijitMenuPassive",!a);this._set("activated",a)},parentMenu:null,popupDelay:500,passivePopupDelay:Infinity,autoFocus:!1,
childSelector:function(a){var b=q.byNode(a);return a.parentNode==this.containerNode&&b&&b.focus},postCreate:function(){var a=this,b="string"==typeof this.childSelector?this.childSelector:e.hitch(this,"childSelector");this.own(r(this.containerNode,r.selector(b,k.enter),function(){a.onItemHover(q.byNode(this))}),r(this.containerNode,r.selector(b,k.leave),function(){a.onItemUnhover(q.byNode(this))}),r(this.containerNode,r.selector(b,h),function(b){a.onItemClick(q.byNode(this),b);b.stopPropagation()}),
r(this.containerNode,r.selector(b,"focusin"),function(){a._onItemFocus(q.byNode(this))}));this.inherited(arguments)},onKeyboardSearch:function(a,b,l,g){this.inherited(arguments);if(a&&(-1==g||a.popup&&1==g))this.onItemClick(a,b)},_keyboardSearchCompare:function(a,b){return a.shortcutKey?b==a.shortcutKey.toLowerCase()?-1:0:this.inherited(arguments)?1:0},onExecute:function(){},onCancel:function(){},_moveToPopup:function(a){if(this.focusedChild&&this.focusedChild.popup&&!this.focusedChild.disabled)this.onItemClick(this.focusedChild,
a);else(a=this._getTopMenu())&&a._isMenuBar&&a.focusNext()},_onPopupHover:function(){this.set("selected",this.currentPopupItem);this._stopPendingCloseTimer()},onItemHover:function(a){this.activated?(this.set("selected",a),!a.popup||a.disabled||this.hover_timer||(this.hover_timer=this.defer(function(){this._openItemPopup(a)},this.popupDelay))):Infinity>this.passivePopupDelay&&(this.passive_hover_timer&&this.passive_hover_timer.remove(),this.passive_hover_timer=this.defer(function(){this.onItemClick(a,
{type:"click"})},this.passivePopupDelay));this._hoveredChild=a;a._set("hovering",!0)},_onChildDeselect:function(a){this._stopPopupTimer();this.currentPopupItem==a&&(this._stopPendingCloseTimer(),this._pendingClose_timer=this.defer(function(){this.currentPopupItem=this._pendingClose_timer=null;a._closePopup()},this.popupDelay))},onItemUnhover:function(a){this._hoveredChild==a&&(this._hoveredChild=null);this.passive_hover_timer&&(this.passive_hover_timer.remove(),this.passive_hover_timer=null);a._set("hovering",
!1)},_stopPopupTimer:function(){this.hover_timer&&(this.hover_timer=this.hover_timer.remove())},_stopPendingCloseTimer:function(){this._pendingClose_timer&&(this._pendingClose_timer=this._pendingClose_timer.remove())},_getTopMenu:function(){for(var a=this;a.parentMenu;a=a.parentMenu);return a},onItemClick:function(a,b){this.passive_hover_timer&&this.passive_hover_timer.remove();this.focusChild(a);if(a.disabled)return!1;if(a.popup){this.set("selected",a);this.set("activated",!0);var f=/^key/.test(b._origType||
b.type)||0==b.clientX&&0==b.clientY;this._openItemPopup(a,f)}else this.onExecute(),a._onClick?a._onClick(b):a.onClick(b)},_openItemPopup:function(a,b){if(a!=this.currentPopupItem){this.currentPopupItem&&(this._stopPendingCloseTimer(),this.currentPopupItem._closePopup());this._stopPopupTimer();var f=a.popup;f.parentMenu=this;this.own(this._mouseoverHandle=r.once(f.domNode,"mouseover",e.hitch(this,"_onPopupHover")));var g=this;a._openPopup({parent:this,orient:this._orient||["after","before"],onCancel:function(){b&&
g.focusChild(a);g._cleanUp()},onExecute:e.hitch(this,"_cleanUp",!0),onClose:function(){g._mouseoverHandle&&(g._mouseoverHandle.remove(),delete g._mouseoverHandle)}},b);this.currentPopupItem=a}},onOpen:function(){this.isShowingNow=!0;this.set("activated",!0)},onClose:function(){this.set("activated",!1);this.set("selected",null);this.isShowingNow=!1;this.parentMenu=null},_closeChild:function(){this._stopPopupTimer();this.currentPopupItem&&(this.focused&&(v.set(this.selected.focusNode,"tabIndex",this.tabIndex),
this.selected.focusNode.focus()),this.currentPopupItem._closePopup(),this.currentPopupItem=null)},_onItemFocus:function(a){if(this._hoveredChild&&this._hoveredChild!=a)this.onItemUnhover(this._hoveredChild);this.set("selected",a)},_onBlur:function(){this._cleanUp(!0);this.inherited(arguments)},_cleanUp:function(a){this._closeChild();"undefined"==typeof this.isShowingNow&&this.set("activated",!1);a&&this.set("selected",null)}})})},"dijit/_KeyNavContainer":function(){define("dojo/_base/array dojo/_base/declare dojo/dom-attr dojo/_base/kernel dojo/keys dojo/_base/lang ./registry ./_Container ./_FocusMixin ./_KeyNavMixin".split(" "),
function(m,n,d,v,t,e,k,r,c,h){return n("dijit._KeyNavContainer",[c,h,r],{connectKeyNavHandlers:function(c,h){var d=this._keyNavCodes={},b=e.hitch(this,"focusPrev"),g=e.hitch(this,"focusNext");m.forEach(c,function(a){d[a]=b});m.forEach(h,function(a){d[a]=g});d[t.HOME]=e.hitch(this,"focusFirstChild");d[t.END]=e.hitch(this,"focusLastChild")},startupKeyNavChildren:function(){v.deprecated("startupKeyNavChildren() call no longer needed","","2.0")},startup:function(){this.inherited(arguments);m.forEach(this.getChildren(),
e.hitch(this,"_startupChild"))},addChild:function(c,h){this.inherited(arguments);this._startupChild(c)},_startupChild:function(c){c.set("tabIndex","-1")},_getFirst:function(){var c=this.getChildren();return c.length?c[0]:null},_getLast:function(){var c=this.getChildren();return c.length?c[c.length-1]:null},focusNext:function(){this.focusChild(this._getNextFocusableChild(this.focusedChild,1))},focusPrev:function(){this.focusChild(this._getNextFocusableChild(this.focusedChild,-1),!0)},childSelector:function(c){return(c=
k.byNode(c))&&c.getParent()==this}})})},"dijit/_Container":function(){define(["dojo/_base/array","dojo/_base/declare","dojo/dom-construct","dojo/_base/kernel"],function(m,n,d,v){return n("dijit._Container",null,{buildRendering:function(){this.inherited(arguments);this.containerNode||(this.containerNode=this.domNode)},addChild:function(t,e){var k=this.containerNode;if(0<e){for(k=k.firstChild;0<e;)1==k.nodeType&&e--,k=k.nextSibling;k?e="before":(k=this.containerNode,e="last")}d.place(t.domNode,k,e);
this._started&&!t._started&&t.startup()},removeChild:function(d){"number"==typeof d&&(d=this.getChildren()[d]);d&&(d=d.domNode)&&d.parentNode&&d.parentNode.removeChild(d)},hasChildren:function(){return 0<this.getChildren().length},_getSiblingOfChild:function(d,e){var k=this.getChildren(),r=m.indexOf(k,d);return k[r+e]},getIndexOfChild:function(d){return m.indexOf(this.getChildren(),d)}})})},"dijit/_KeyNavMixin":function(){define("dojo/_base/array dojo/_base/declare dojo/dom-attr dojo/keys dojo/_base/lang dojo/on dijit/registry dijit/_FocusMixin".split(" "),
function(m,n,d,v,t,e,k,r){return n("dijit._KeyNavMixin",r,{tabIndex:"0",childSelector:null,postCreate:function(){this.inherited(arguments);d.set(this.domNode,"tabIndex",this.tabIndex);if(!this._keyNavCodes){var c=this._keyNavCodes={};c[v.HOME]=t.hitch(this,"focusFirstChild");c[v.END]=t.hitch(this,"focusLastChild");c[this.isLeftToRight()?v.LEFT_ARROW:v.RIGHT_ARROW]=t.hitch(this,"_onLeftArrow");c[this.isLeftToRight()?v.RIGHT_ARROW:v.LEFT_ARROW]=t.hitch(this,"_onRightArrow");c[v.UP_ARROW]=t.hitch(this,
"_onUpArrow");c[v.DOWN_ARROW]=t.hitch(this,"_onDownArrow")}var h=this,c="string"==typeof this.childSelector?this.childSelector:t.hitch(this,"childSelector");this.own(e(this.domNode,"keypress",t.hitch(this,"_onContainerKeypress")),e(this.domNode,"keydown",t.hitch(this,"_onContainerKeydown")),e(this.domNode,"focus",t.hitch(this,"_onContainerFocus")),e(this.containerNode,e.selector(c,"focusin"),function(c){h._onChildFocus(k.getEnclosingWidget(this),c)}))},_onLeftArrow:function(){},_onRightArrow:function(){},
_onUpArrow:function(){},_onDownArrow:function(){},focus:function(){this.focusFirstChild()},_getFirstFocusableChild:function(){return this._getNextFocusableChild(null,1)},_getLastFocusableChild:function(){return this._getNextFocusableChild(null,-1)},focusFirstChild:function(){this.focusChild(this._getFirstFocusableChild())},focusLastChild:function(){this.focusChild(this._getLastFocusableChild())},focusChild:function(c,h){c&&(this.focusedChild&&c!==this.focusedChild&&this._onChildBlur(this.focusedChild),
c.set("tabIndex",this.tabIndex),c.focus(h?"end":"start"))},_onContainerFocus:function(c){c.target!==this.domNode||this.focusedChild||this.focus()},_onFocus:function(){d.set(this.domNode,"tabIndex","-1");this.inherited(arguments)},_onBlur:function(c){d.set(this.domNode,"tabIndex",this.tabIndex);this.focusedChild&&(this.focusedChild.set("tabIndex","-1"),this.lastFocusedChild=this.focusedChild,this._set("focusedChild",null));this.inherited(arguments)},_onChildFocus:function(c){c&&c!=this.focusedChild&&
(this.focusedChild&&!this.focusedChild._destroyed&&this.focusedChild.set("tabIndex","-1"),c.set("tabIndex",this.tabIndex),this.lastFocused=c,this._set("focusedChild",c))},_searchString:"",multiCharSearchDuration:1E3,onKeyboardSearch:function(c,h,d,u){c&&this.focusChild(c)},_keyboardSearchCompare:function(c,h){var d=c.domNode,d=(c.label||(d.focusNode?d.focusNode.label:"")||d.innerText||d.textContent||"").replace(/^\s+/,"").substr(0,h.length).toLowerCase();return h.length&&d==h?-1:0},_isFormElement:function(c){return"INPUT"===
c.tagName||"TEXTAREA"===c.tagName||"SELECT"===c.tagName||"BUTTON"===c.tagName},_onContainerKeydown:function(c){if(!this._isFormElement(document.activeElement)){var h=this._keyNavCodes[c.keyCode];h?(h(c,this.focusedChild),c.stopPropagation(),c.preventDefault(),this._searchString=""):c.keyCode!=v.SPACE||!this._searchTimer||c.ctrlKey||c.altKey||c.metaKey||(c.stopImmediatePropagation(),c.preventDefault(),this._keyboardSearch(c," "))}},_onContainerKeypress:function(c){this._isFormElement(document.activeElement)||
c.charCode<=v.SPACE||c.ctrlKey||c.altKey||c.metaKey||(c.preventDefault(),c.stopPropagation(),this._keyboardSearch(c,String.fromCharCode(c.charCode).toLowerCase()))},_keyboardSearch:function(c,h){var d=null,u,e=0;t.hitch(this,function(){this._searchTimer&&this._searchTimer.remove();this._searchString+=h;var b=/^(.)\1*$/.test(this._searchString)?1:this._searchString.length;u=this._searchString.substr(0,b);this._searchTimer=this.defer(function(){this._searchTimer=null;this._searchString=""},this.multiCharSearchDuration);
var c=this.focusedChild||null;if(1==b||!c)if(c=this._getNextFocusableChild(c,1),!c)return;b=c;do{var a=this._keyboardSearchCompare(c,u);a&&0==e++&&(d=c);if(-1==a){e=-1;break}c=this._getNextFocusableChild(c,1)}while(c&&c!=b)})();this.onKeyboardSearch(d,c,u,e)},_onChildBlur:function(){},_getNextFocusableChild:function(c,h){var d=c;do{if(c)c=this._getNext(c,h);else if(c=this[0<h?"_getFirst":"_getLast"](),!c)break;if(null!=c&&c!=d&&c.isFocusable())return c}while(c!=d);return null},_getFirst:function(){return null},
_getLast:function(){return null},_getNext:function(c,h){if(c)for(c=c.domNode;c;)if((c=c[0>h?"previousSibling":"nextSibling"])&&"getAttribute"in c){var d=k.byNode(c);if(d)return d}return null}})})},"dijit/MenuItem":function(){define("dojo/_base/declare dojo/dom dojo/dom-attr dojo/dom-class dojo/_base/kernel dojo/sniff dojo/_base/lang ./_Widget ./_TemplatedMixin ./_Contained ./_CssStateMixin dojo/text!./templates/MenuItem.html".split(" "),function(m,n,d,v,t,e,k,r,c,h,q,u){k=m("dijit.MenuItem"+(e("dojo-bidi")?
"_NoBidi":""),[r,c,h,q],{templateString:u,baseClass:"dijitMenuItem",label:"",_setLabelAttr:function(c){this._set("label",c);var b="",g;g=c.search(/{\S}/);if(0<=g){var b=c.charAt(g+1),a=c.substr(0,g);c=c.substr(g+3);g=a+b+c;c=a+'\x3cspan class\x3d"dijitMenuItemShortcutKey"\x3e'+b+"\x3c/span\x3e"+c}else g=c;this.domNode.setAttribute("aria-label",g+" "+this.accelKey);this.containerNode.innerHTML=c;this._set("shortcutKey",b)},iconClass:"dijitNoIcon",_setIconClassAttr:{node:"iconNode",type:"class"},accelKey:"",
disabled:!1,_fillContent:function(c){!c||"label"in this.params||this._set("label",c.innerHTML)},buildRendering:function(){this.inherited(arguments);d.set(this.containerNode,"id",this.id+"_text");this.accelKeyNode&&d.set(this.accelKeyNode,"id",this.id+"_accel");n.setSelectable(this.domNode,!1)},onClick:function(){},focus:function(){try{8==e("ie")&&this.containerNode.focus(),this.focusNode.focus()}catch(x){}},_setSelected:function(c){v.toggle(this.domNode,"dijitMenuItemSelected",c)},setLabel:function(c){t.deprecated("dijit.MenuItem.setLabel() is deprecated.  Use set('label', ...) instead.",
"","2.0");this.set("label",c)},setDisabled:function(c){t.deprecated("dijit.Menu.setDisabled() is deprecated.  Use set('disabled', bool) instead.","","2.0");this.set("disabled",c)},_setDisabledAttr:function(c){this.focusNode.setAttribute("aria-disabled",c?"true":"false");this._set("disabled",c)},_setAccelKeyAttr:function(c){this.accelKeyNode&&(this.accelKeyNode.style.display=c?"":"none",this.accelKeyNode.innerHTML=c,d.set(this.containerNode,"colSpan",c?"1":"2"));this._set("accelKey",c)}});e("dojo-bidi")&&
(k=m("dijit.MenuItem",k,{_setLabelAttr:function(c){this.inherited(arguments);"auto"===this.textDir&&this.applyTextDir(this.textDirNode)}}));return k})},"dijit/_Contained":function(){define(["dojo/_base/declare","./registry"],function(m,n){return m("dijit._Contained",null,{_getSibling:function(d){var n=this.getParent();return n&&n._getSiblingOfChild&&n._getSiblingOfChild(this,"previous"==d?-1:1)||null},getPreviousSibling:function(){return this._getSibling("previous")},getNextSibling:function(){return this._getSibling("next")},
getIndexInParent:function(){var d=this.getParent();return d&&d.getIndexOfChild?d.getIndexOfChild(this):-1}})})},"dijit/MenuSeparator":function(){define("dojo/_base/declare dojo/dom ./_WidgetBase ./_TemplatedMixin ./_Contained dojo/text!./templates/MenuSeparator.html".split(" "),function(m,n,d,v,t,e){return m("dijit.MenuSeparator",[d,v,t],{templateString:e,buildRendering:function(){this.inherited(arguments);n.setSelectable(this.domNode,!1)},isFocusable:function(){return!1}})})},"dijit/Tooltip":function(){define("dojo/_base/array dojo/_base/declare dojo/_base/fx dojo/dom dojo/dom-class dojo/dom-geometry dojo/dom-style dojo/_base/lang dojo/mouse dojo/on dojo/sniff ./_base/manager ./place ./_Widget ./_TemplatedMixin ./BackgroundIframe dojo/text!./templates/Tooltip.html ./main".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,a,f,l){function y(){}var F=n("dijit._MasterTooltip",[b,g],{duration:u.defaultDuration,templateString:f,postCreate:function(){this.ownerDocumentBody.appendChild(this.domNode);this.bgIframe=new a(this.domNode);this.fadeIn=d.fadeIn({node:this.domNode,duration:this.duration,onEnd:r.hitch(this,"_onShow")});this.fadeOut=d.fadeOut({node:this.domNode,duration:this.duration,onEnd:r.hitch(this,"_onHide")})},show:function(a,b,f,c,l,g,h){if(!this.aroundNode||this.aroundNode!==
b||this.containerNode.innerHTML!=a)if("playing"==this.fadeOut.status())this._onDeck=arguments;else{this.containerNode.innerHTML=a;l&&this.set("textDir",l);this.containerNode.align=c?"right":"left";var w=x.around(this.domNode,b,f&&f.length?f:B.defaultPosition,!c,r.hitch(this,"orient")),d=w.aroundNodePos;"M"==w.corner.charAt(0)&&"M"==w.aroundCorner.charAt(0)?(this.connectorNode.style.top=d.y+(d.h-this.connectorNode.offsetHeight>>1)-w.y+"px",this.connectorNode.style.left=""):"M"==w.corner.charAt(1)&&
"M"==w.aroundCorner.charAt(1)?this.connectorNode.style.left=d.x+(d.w-this.connectorNode.offsetWidth>>1)-w.x+"px":(this.connectorNode.style.left="",this.connectorNode.style.top="");k.set(this.domNode,"opacity",0);this.fadeIn.play();this.isShowingNow=!0;this.aroundNode=b;this.onMouseEnter=g||y;this.onMouseLeave=h||y}},orient:function(a,b,f,c,l){this.connectorNode.style.top="";var g=c.h;c=c.w;a.className="dijitTooltip "+{"MR-ML":"dijitTooltipRight","ML-MR":"dijitTooltipLeft","TM-BM":"dijitTooltipAbove",
"BM-TM":"dijitTooltipBelow","BL-TL":"dijitTooltipBelow dijitTooltipABLeft","TL-BL":"dijitTooltipAbove dijitTooltipABLeft","BR-TR":"dijitTooltipBelow dijitTooltipABRight","TR-BR":"dijitTooltipAbove dijitTooltipABRight","BR-BL":"dijitTooltipRight","BL-BR":"dijitTooltipLeft"}[b+"-"+f];this.domNode.style.width="auto";var w=e.position(this.domNode);if(q("ie")||q("trident"))w.w+=2;e.setMarginBox(this.domNode,{w:Math.min(Math.max(c,1),w.w)});"B"==f.charAt(0)&&"B"==b.charAt(0)?(a=e.position(a),b=this.connectorNode.offsetHeight,
a.h>g?(this.connectorNode.style.top=g-(l.h+b>>1)+"px",this.connectorNode.style.bottom=""):(this.connectorNode.style.bottom=Math.min(Math.max(l.h/2-b/2,0),a.h-b)+"px",this.connectorNode.style.top="")):(this.connectorNode.style.top="",this.connectorNode.style.bottom="");return Math.max(0,w.w-c)},_onShow:function(){q("ie")&&(this.domNode.style.filter="")},hide:function(a){this._onDeck&&this._onDeck[1]==a?this._onDeck=null:this.aroundNode===a&&(this.fadeIn.stop(),this.isShowingNow=!1,this.aroundNode=
null,this.fadeOut.play());this.onMouseEnter=this.onMouseLeave=y},_onHide:function(){this.domNode.style.cssText="";this.containerNode.innerHTML="";this._onDeck&&(this.show.apply(this,this._onDeck),this._onDeck=null)}});q("dojo-bidi")&&F.extend({_setAutoTextDir:function(a){this.applyTextDir(a);m.forEach(a.children,function(a){this._setAutoTextDir(a)},this)},_setTextDirAttr:function(a){this._set("textDir",a);"auto"==a?this._setAutoTextDir(this.containerNode):this.containerNode.dir=this.textDir}});l.showTooltip=
function(a,b,f,c,g,h,d){f&&(f=m.map(f,function(a){return{after:"after-centered",before:"before-centered"}[a]||a}));B._masterTT||(l._masterTT=B._masterTT=new F);return B._masterTT.show(a,b,f,c,g,h,d)};l.hideTooltip=function(a){return B._masterTT&&B._masterTT.hide(a)};var B=n("dijit.Tooltip",b,{label:"",showDelay:400,hideDelay:400,connectId:[],position:[],selector:"",_setConnectIdAttr:function(a){m.forEach(this._connections||[],function(a){m.forEach(a,function(a){a.remove()})},this);this._connectIds=
m.filter(r.isArrayLike(a)?a:a?[a]:[],function(a){return v.byId(a,this.ownerDocument)},this);this._connections=m.map(this._connectIds,function(a){a=v.byId(a,this.ownerDocument);var b=this.selector,f=b?function(a){return h.selector(b,a)}:function(a){return a},l=this;return[h(a,f(c.enter),function(){l._onHover(this)}),h(a,f("focusin"),function(){l._onHover(this)}),h(a,f(c.leave),r.hitch(l,"_onUnHover")),h(a,f("focusout"),r.hitch(l,"set","state","DORMANT"))]},this);this._set("connectId",a)},addTarget:function(a){a=
a.id||a;-1==m.indexOf(this._connectIds,a)&&this.set("connectId",this._connectIds.concat(a))},removeTarget:function(a){a=m.indexOf(this._connectIds,a.id||a);0<=a&&(this._connectIds.splice(a,1),this.set("connectId",this._connectIds))},buildRendering:function(){this.inherited(arguments);t.add(this.domNode,"dijitTooltipData")},startup:function(){this.inherited(arguments);var a=this.connectId;m.forEach(r.isArrayLike(a)?a:[a],this.addTarget,this)},getContent:function(a){return this.label||this.domNode.innerHTML},
state:"DORMANT",_setStateAttr:function(a){if(!(this.state==a||"SHOW TIMER"==a&&"SHOWING"==this.state||"HIDE TIMER"==a&&"DORMANT"==this.state)){this._hideTimer&&(this._hideTimer.remove(),delete this._hideTimer);this._showTimer&&(this._showTimer.remove(),delete this._showTimer);switch(a){case "DORMANT":this._connectNode&&(B.hide(this._connectNode),delete this._connectNode,this.onHide());break;case "SHOW TIMER":"SHOWING"!=this.state&&(this._showTimer=this.defer(function(){this.set("state","SHOWING")},
this.showDelay));break;case "SHOWING":var b=this.getContent(this._connectNode);if(!b){this.set("state","DORMANT");return}B.show(b,this._connectNode,this.position,!this.isLeftToRight(),this.textDir,r.hitch(this,"set","state","SHOWING"),r.hitch(this,"set","state","HIDE TIMER"));this.onShow(this._connectNode,this.position);break;case "HIDE TIMER":this._hideTimer=this.defer(function(){this.set("state","DORMANT")},this.hideDelay)}this._set("state",a)}},_onHover:function(a){this._connectNode&&a!=this._connectNode&&
this.set("state","DORMANT");this._connectNode=a;this.set("state","SHOW TIMER")},_onUnHover:function(a){this.set("state","HIDE TIMER")},open:function(a){this.set("state","DORMANT");this._connectNode=a;this.set("state","SHOWING")},close:function(){this.set("state","DORMANT")},onShow:function(){},onHide:function(){},destroy:function(){this.set("state","DORMANT");m.forEach(this._connections||[],function(a){m.forEach(a,function(a){a.remove()})},this);this.inherited(arguments)}});B._MasterTooltip=F;B.show=
l.showTooltip;B.hide=l.hideTooltip;B.defaultPosition=["after-centered","before-centered"];return B})},"dijit/form/ValidationTextBox":function(){define("dojo/_base/declare dojo/_base/kernel dojo/_base/lang dojo/i18n ./TextBox ../Tooltip dojo/text!./templates/ValidationTextBox.html dojo/i18n!./nls/validate".split(" "),function(m,n,d,v,t,e,k){var r=m("dijit.form.ValidationTextBox",t,{templateString:k,required:!1,promptMessage:"",invalidMessage:"$_unset_$",missingMessage:"$_unset_$",message:"",constraints:{},
pattern:".*",regExp:"",regExpGen:function(){},state:"",tooltipPosition:[],_deprecateRegExp:function(c,h){h!=r.prototype[c]&&(n.deprecated("ValidationTextBox id\x3d"+this.id+", set('"+c+"', ...) is deprecated.  Use set('pattern', ...) instead.","","2.0"),this.set("pattern",h))},_setRegExpGenAttr:function(c){this._deprecateRegExp("regExpGen",c);this._set("regExpGen",this._computeRegexp)},_setRegExpAttr:function(c){this._deprecateRegExp("regExp",c)},_setValueAttr:function(){this.inherited(arguments);
this._refreshState()},validator:function(c,h){return(new RegExp("^(?:"+this._computeRegexp(h)+")"+(this.required?"":"?")+"$")).test(c)&&(!this.required||!this._isEmpty(c))&&(this._isEmpty(c)||void 0!==this.parse(c,h))},_isValidSubset:function(){return 0==this.textbox.value.search(this._partialre)},isValid:function(){return this.validator(this.textbox.value,this.get("constraints"))},_isEmpty:function(c){return(this.trim?/^\s*$/:/^$/).test(c)},getErrorMessage:function(){var c="$_unset_$"==this.invalidMessage?
this.messages.invalidMessage:this.invalidMessage?this.invalidMessage:this.promptMessage,h="$_unset_$"==this.missingMessage?this.messages.missingMessage:this.missingMessage?this.missingMessage:c;return this.required&&this._isEmpty(this.textbox.value)?h:c},getPromptMessage:function(){return this.promptMessage},_maskValidSubsetError:!0,validate:function(c){var h="",d=this.disabled||this.isValid(c);d&&(this._maskValidSubsetError=!0);var u=this._isEmpty(this.textbox.value),e=!d&&c&&this._isValidSubset();
this._set("state",d?"":((!this._hasBeenBlurred||c)&&u||e)&&(this._maskValidSubsetError||e&&!this._hasBeenBlurred&&c)?"Incomplete":"Error");this.focusNode.setAttribute("aria-invalid","Error"==this.state?"true":"false");"Error"==this.state?(this._maskValidSubsetError=c&&e,h=this.getErrorMessage(c)):"Incomplete"==this.state?(h=this.getPromptMessage(c),this._maskValidSubsetError=!this._hasBeenBlurred||c):u&&(h=this.getPromptMessage(c));this.set("message",h);return d},displayMessage:function(c){c&&this.focused?
e.show(c,this.domNode,this.tooltipPosition,!this.isLeftToRight()):e.hide(this.domNode)},_refreshState:function(){this._created&&this.validate(this.focused);this.inherited(arguments)},constructor:function(c){this.constraints=d.clone(this.constraints);this.baseClass+=" dijitValidationTextBox"},startup:function(){this.inherited(arguments);this._refreshState()},_setConstraintsAttr:function(c){!c.locale&&this.lang&&(c.locale=this.lang);this._set("constraints",c);this._refreshState()},_setPatternAttr:function(c){this._set("pattern",
c);this._refreshState()},_computeRegexp:function(c){var d=this.pattern;"function"==typeof d&&(d=d.call(this,c));if(d!=this._lastRegExp){var q="";this._lastRegExp=d;".*"!=d&&d.replace(/\\.|\[\]|\[.*?[^\\]{1}\]|\{.*?\}|\(\?[=:!]|./g,function(c){switch(c.charAt(0)){case "{":case "+":case "?":case "*":case "^":case "$":case "|":case "(":q+=c;break;case ")":q+="|$)";break;default:q+="(?:"+c+"|$)"}});try{"".search(q)}catch(u){q=this.pattern,console.warn("RegExp error in "+this.declaredClass+": "+this.pattern)}this._partialre=
"^(?:"+q+")$"}return d},postMixInProperties:function(){this.inherited(arguments);this.messages=v.getLocalization("dijit.form","validate",this.lang);this._setConstraintsAttr(this.constraints)},_setDisabledAttr:function(c){this.inherited(arguments);this._refreshState()},_setRequiredAttr:function(c){this._set("required",c);this.focusNode.setAttribute("aria-required",c);this._refreshState()},_setMessageAttr:function(c){this._set("message",c);this.displayMessage(c)},reset:function(){this._maskValidSubsetError=
!0;this.inherited(arguments)},_onBlur:function(){this.displayMessage("");this.inherited(arguments)},destroy:function(){e.hide(this.domNode);this.inherited(arguments)}});return r})},"dijit/form/TextBox":function(){define("dojo/_base/declare dojo/dom-construct dojo/dom-style dojo/_base/kernel dojo/_base/lang dojo/on dojo/sniff ./_FormValueWidget ./_TextBoxMixin dojo/text!./templates/TextBox.html ../main".split(" "),function(m,n,d,v,t,e,k,r,c,h,q){r=m("dijit.form.TextBox"+(k("dojo-bidi")?"_NoBidi":""),
[r,c],{templateString:h,_singleNodeTemplate:'\x3cinput class\x3d"dijit dijitReset dijitLeft dijitInputField" data-dojo-attach-point\x3d"textbox,focusNode" autocomplete\x3d"off" type\x3d"${type}" ${!nameAttrSetting} /\x3e',_buttonInputDisabled:k("ie")?"disabled":"",baseClass:"dijitTextBox",postMixInProperties:function(){var c=this.type.toLowerCase();if(this.templateString&&"input"==this.templateString.toLowerCase()||("hidden"==c||"file"==c)&&this.templateString==this.constructor.prototype.templateString)this.templateString=
this._singleNodeTemplate;this.inherited(arguments)},postCreate:function(){this.inherited(arguments);9>k("ie")&&this.defer(function(){try{var c=d.getComputedStyle(this.domNode);if(c){var h=c.fontFamily;if(h){var b=this.domNode.getElementsByTagName("INPUT");if(b)for(c=0;c<b.length;c++)b[c].style.fontFamily=h}}}catch(g){}})},_setPlaceHolderAttr:function(c){this._set("placeHolder",c);this._phspan||(this._attachPoints.push("_phspan"),this._phspan=n.create("span",{className:"dijitPlaceHolder dijitInputField"},
this.textbox,"after"),this.own(e(this._phspan,"mousedown",function(c){c.preventDefault()}),e(this._phspan,"touchend, pointerup, MSPointerUp",t.hitch(this,function(){this.focus()}))));this._phspan.innerHTML="";this._phspan.appendChild(this._phspan.ownerDocument.createTextNode(c));this._updatePlaceHolder()},_onInput:function(c){this.inherited(arguments);this._updatePlaceHolder()},_updatePlaceHolder:function(){this._phspan&&(this._phspan.style.display=this.placeHolder&&!this.textbox.value?"":"none")},
_setValueAttr:function(c,d,b){this.inherited(arguments);this._updatePlaceHolder()},getDisplayedValue:function(){v.deprecated(this.declaredClass+"::getDisplayedValue() is deprecated. Use get('displayedValue') instead.","","2.0");return this.get("displayedValue")},setDisplayedValue:function(c){v.deprecated(this.declaredClass+"::setDisplayedValue() is deprecated. Use set('displayedValue', ...) instead.","","2.0");this.set("displayedValue",c)},_onBlur:function(c){this.disabled||(this.inherited(arguments),
this._updatePlaceHolder(),k("mozilla")&&this.selectOnClick&&(this.textbox.selectionStart=this.textbox.selectionEnd=void 0))},_onFocus:function(c){this.disabled||this.readOnly||(this.inherited(arguments),this._updatePlaceHolder())}});9>k("ie")&&(r.prototype._isTextSelected=function(){var c=this.ownerDocument.selection.createRange();return c.parentElement()==this.textbox&&0<c.text.length},q._setSelectionRange=c._setSelectionRange=function(c,d,b){c.createTextRange&&(c=c.createTextRange(),c.collapse(!0),
c.moveStart("character",-99999),c.moveStart("character",d),c.moveEnd("character",b-d),c.select())});k("dojo-bidi")&&(r=m("dijit.form.TextBox",r,{_setPlaceHolderAttr:function(c){this.inherited(arguments);this.applyTextDir(this._phspan)}}));return r})},"dijit/form/_TextBoxMixin":function(){define("dojo/_base/array dojo/_base/declare dojo/dom dojo/sniff dojo/keys dojo/_base/lang dojo/on ../main".split(" "),function(m,n,d,v,t,e,k,r){var c=n("dijit.form._TextBoxMixin"+(v("dojo-bidi")?"_NoBidi":""),null,
{trim:!1,uppercase:!1,lowercase:!1,propercase:!1,maxLength:"",selectOnClick:!1,placeHolder:"",_getValueAttr:function(){return this.parse(this.get("displayedValue"),this.constraints)},_setValueAttr:function(c,d,u){var h;void 0!==c&&(h=this.filter(c),"string"!=typeof u&&(u=null===h||"number"==typeof h&&isNaN(h)?"":this.filter(this.format(h,this.constraints)),0!=this.compare(h,this.filter(this.parse(u,this.constraints)))&&(u=null)));null==u||"number"==typeof u&&isNaN(u)||this.textbox.value==u||(this.textbox.value=
u,this._set("displayedValue",this.get("displayedValue")));this.inherited(arguments,[h,d])},displayedValue:"",_getDisplayedValueAttr:function(){return this.filter(this.textbox.value)},_setDisplayedValueAttr:function(c){null==c?c="":"string"!=typeof c&&(c=String(c));this.textbox.value=c;this._setValueAttr(this.get("value"),void 0);this._set("displayedValue",this.get("displayedValue"))},format:function(c){return null==c?"":c.toString?c.toString():c},parse:function(c){return c},_refreshState:function(){},
onInput:function(){},_onInput:function(c){this._lastInputEventValue=this.textbox.value;this._processInput(this._lastInputProducingEvent||c);delete this._lastInputProducingEvent;this.intermediateChanges&&this._handleOnChange(this.get("value"),!1)},_processInput:function(){this._refreshState();this._set("displayedValue",this.get("displayedValue"))},postCreate:function(){this.textbox.setAttribute("value",this.textbox.value);this.inherited(arguments);this.own(k(this.textbox,"keydown, keypress, paste, cut, compositionend",
e.hitch(this,function(c){var d;if("keydown"==c.type&&229!=c.keyCode){d=c.keyCode;switch(d){case t.SHIFT:case t.ALT:case t.CTRL:case t.META:case t.CAPS_LOCK:case t.NUM_LOCK:case t.SCROLL_LOCK:return}if(!c.ctrlKey&&!c.metaKey&&!c.altKey){switch(d){case t.NUMPAD_0:case t.NUMPAD_1:case t.NUMPAD_2:case t.NUMPAD_3:case t.NUMPAD_4:case t.NUMPAD_5:case t.NUMPAD_6:case t.NUMPAD_7:case t.NUMPAD_8:case t.NUMPAD_9:case t.NUMPAD_MULTIPLY:case t.NUMPAD_PLUS:case t.NUMPAD_ENTER:case t.NUMPAD_MINUS:case t.NUMPAD_PERIOD:case t.NUMPAD_DIVIDE:return}if(65<=
d&&90>=d||48<=d&&57>=d||d==t.SPACE)return;d=!1;for(var h in t)if(t[h]===c.keyCode){d=!0;break}if(!d)return}}(d=32<=c.charCode?String.fromCharCode(c.charCode):c.charCode)||(d=65<=c.keyCode&&90>=c.keyCode||48<=c.keyCode&&57>=c.keyCode||c.keyCode==t.SPACE?String.fromCharCode(c.keyCode):c.keyCode);d||(d=229);if("keypress"==c.type){if("string"!=typeof d)return;if("a"<=d&&"z">=d||"A"<=d&&"Z">=d||"0"<=d&&"9">=d||" "===d)if(c.ctrlKey||c.metaKey||c.altKey)return}var x={faux:!0},b;for(b in c)/^(layer[XY]|returnValue|keyLocation)$/.test(b)||
(h=c[b],"function"!=typeof h&&"undefined"!=typeof h&&(x[b]=h));e.mixin(x,{charOrCode:d,_wasConsumed:!1,preventDefault:function(){x._wasConsumed=!0;c.preventDefault()},stopPropagation:function(){c.stopPropagation()}});this._lastInputProducingEvent=x;!1===this.onInput(x)&&(x.preventDefault(),x.stopPropagation());if(!x._wasConsumed&&9>=v("ie"))switch(c.keyCode){case t.TAB:case t.ESCAPE:case t.DOWN_ARROW:case t.UP_ARROW:case t.LEFT_ARROW:case t.RIGHT_ARROW:break;default:c.keyCode==t.ENTER&&"textarea"!=
this.textbox.tagName.toLowerCase()||this.defer(function(){this.textbox.value!==this._lastInputEventValue&&k.emit(this.textbox,"input",{bubbles:!0})})}})),k(this.textbox,"input",e.hitch(this,"_onInput")),k(this.domNode,"keypress",function(c){c.stopPropagation()}))},_blankValue:"",filter:function(c){if(null===c)return this._blankValue;if("string"!=typeof c)return c;this.trim&&(c=e.trim(c));this.uppercase&&(c=c.toUpperCase());this.lowercase&&(c=c.toLowerCase());this.propercase&&(c=c.replace(/[^\s]+/g,
function(c){return c.substring(0,1).toUpperCase()+c.substring(1)}));return c},_setBlurValue:function(){this._setValueAttr(this.get("value"),!0)},_onBlur:function(c){this.disabled||(this._setBlurValue(),this.inherited(arguments))},_isTextSelected:function(){return this.textbox.selectionStart!=this.textbox.selectionEnd},_onFocus:function(d){this.disabled||this.readOnly||(this.selectOnClick&&"mouse"==d&&(this._selectOnClickHandle=k.once(this.domNode,"mouseup, touchend",e.hitch(this,function(d){this._isTextSelected()||
c.selectInputText(this.textbox)})),this.own(this._selectOnClickHandle),this.defer(function(){this._selectOnClickHandle&&(this._selectOnClickHandle.remove(),this._selectOnClickHandle=null)},500)),this.inherited(arguments),this._refreshState())},reset:function(){this.textbox.value="";this.inherited(arguments)}});v("dojo-bidi")&&(c=n("dijit.form._TextBoxMixin",c,{_setValueAttr:function(){this.inherited(arguments);this.applyTextDir(this.focusNode)},_setDisplayedValueAttr:function(){this.inherited(arguments);
this.applyTextDir(this.focusNode)},_onInput:function(){this.applyTextDir(this.focusNode);this.inherited(arguments)}}));c._setSelectionRange=r._setSelectionRange=function(c,d,u){c.setSelectionRange&&c.setSelectionRange(d,u)};c.selectInputText=r.selectInputText=function(h,e,u){h=d.byId(h);isNaN(e)&&(e=0);isNaN(u)&&(u=h.value?h.value.length:0);try{h.focus(),c._setSelectionRange(h,e,u)}catch(x){}};return c})},"dijit/form/DateTextBox":function(){define(["dojo/_base/declare","../Calendar","./_DateTimeTextBox"],
function(m,n,d){return m("dijit.form.DateTextBox",d,{baseClass:"dijitTextBox dijitComboBox dijitDateTextBox",popupClass:n,_selector:"date",maxHeight:Infinity,value:new Date("")})})},"dijit/Calendar":function(){define("dojo/_base/array dojo/date dojo/date/locale dojo/_base/declare dojo/dom-attr dojo/dom-class dojo/dom-construct dojo/_base/kernel dojo/keys dojo/_base/lang dojo/on dojo/sniff ./CalendarLite ./_Widget ./_CssStateMixin ./_TemplatedMixin ./form/DropDownButton".split(" "),function(m,n,d,
v,t,e,k,r,c,h,q,u,x,b,g,a,f){var l=v("dijit.Calendar",[x,b,g],{baseClass:"dijitCalendar",cssStateNodes:{decrementMonth:"dijitCalendarArrow",incrementMonth:"dijitCalendarArrow",previousYearLabelNode:"dijitCalendarPreviousYear",nextYearLabelNode:"dijitCalendarNextYear"},setValue:function(a){r.deprecated("dijit.Calendar:setValue() is deprecated.  Use set('value', ...) instead.","","2.0");this.set("value",a)},_createMonthWidget:function(){return new l._MonthDropDownButton({id:this.id+"_mddb",tabIndex:-1,
onMonthSelect:h.hitch(this,"_onMonthSelect"),lang:this.lang,dateLocaleModule:this.dateLocaleModule},this.monthNode)},postCreate:function(){this.inherited(arguments);this.own(q(this.domNode,"keydown",h.hitch(this,"_onKeyDown")),q(this.dateRowsNode,"mouseover",h.hitch(this,"_onDayMouseOver")),q(this.dateRowsNode,"mouseout",h.hitch(this,"_onDayMouseOut")),q(this.dateRowsNode,"mousedown",h.hitch(this,"_onDayMouseDown")),q(this.dateRowsNode,"mouseup",h.hitch(this,"_onDayMouseUp")))},_onMonthSelect:function(a){var b=
new this.dateClassObj(this.currentFocus);b.setDate(1);b.setMonth(a);a=this.dateModule.getDaysInMonth(b);var c=this.currentFocus.getDate();b.setDate(Math.min(c,a));this._setCurrentFocusAttr(b)},_onDayMouseOver:function(a){(a=e.contains(a.target,"dijitCalendarDateLabel")?a.target.parentNode:a.target)&&(a.dijitDateValue&&!e.contains(a,"dijitCalendarDisabledDate")||a==this.previousYearLabelNode||a==this.nextYearLabelNode)&&(e.add(a,"dijitCalendarHoveredDate"),this._currentNode=a)},_onDayMouseOut:function(a){!this._currentNode||
a.relatedTarget&&a.relatedTarget.parentNode==this._currentNode||(a="dijitCalendarHoveredDate",e.contains(this._currentNode,"dijitCalendarActiveDate")&&(a+=" dijitCalendarActiveDate"),e.remove(this._currentNode,a),this._currentNode=null)},_onDayMouseDown:function(a){(a=a.target.parentNode)&&a.dijitDateValue&&!e.contains(a,"dijitCalendarDisabledDate")&&(e.add(a,"dijitCalendarActiveDate"),this._currentNode=a)},_onDayMouseUp:function(a){(a=a.target.parentNode)&&a.dijitDateValue&&e.remove(a,"dijitCalendarActiveDate")},
handleKey:function(a){var b=-1,f,l=this.currentFocus;switch(a.keyCode){case c.RIGHT_ARROW:b=1;case c.LEFT_ARROW:f="day";this.isLeftToRight()||(b*=-1);break;case c.DOWN_ARROW:b=1;case c.UP_ARROW:f="week";break;case c.PAGE_DOWN:b=1;case c.PAGE_UP:f=a.ctrlKey||a.altKey?"year":"month";break;case c.END:l=this.dateModule.add(l,"month",1),f="day";case c.HOME:l=new this.dateClassObj(l);l.setDate(1);break;default:return!0}f&&(l=this.dateModule.add(l,f,b));this._setCurrentFocusAttr(l);return!1},_onKeyDown:function(a){this.handleKey(a)||
(a.stopPropagation(),a.preventDefault())},onValueSelected:function(){},onChange:function(a){this.onValueSelected(a)},getClassForDate:function(){}});l._MonthDropDownButton=v("dijit.Calendar._MonthDropDownButton",f,{onMonthSelect:function(){},postCreate:function(){this.inherited(arguments);this.dropDown=new l._MonthDropDown({id:this.id+"_mdd",onChange:this.onMonthSelect})},_setMonthAttr:function(a){var b=this.dateLocaleModule.getNames("months","wide","standAlone",this.lang,a);this.dropDown.set("months",
b);this.containerNode.innerHTML=(6==u("ie")?"":"\x3cdiv class\x3d'dijitSpacer'\x3e"+this.dropDown.domNode.innerHTML+"\x3c/div\x3e")+"\x3cdiv class\x3d'dijitCalendarMonthLabel dijitCalendarCurrentMonthLabel'\x3e"+b[a.getMonth()]+"\x3c/div\x3e"}});l._MonthDropDown=v("dijit.Calendar._MonthDropDown",[b,a,g],{months:[],baseClass:"dijitCalendarMonthMenu dijitMenu",templateString:"\x3cdiv data-dojo-attach-event\x3d'ondijitclick:_onClick'\x3e\x3c/div\x3e",_setMonthsAttr:function(a){this.domNode.innerHTML=
"";m.forEach(a,function(a,b){k.create("div",{className:"dijitCalendarMonthLabel",month:b,innerHTML:a},this.domNode)._cssState="dijitCalendarMonthLabel"},this)},_onClick:function(a){this.onChange(t.get(a.target,"month"))},onChange:function(){}});return l})},"dijit/CalendarLite":function(){define("dojo/_base/array dojo/_base/declare dojo/cldr/supplemental dojo/date dojo/date/locale dojo/date/stamp dojo/dom dojo/dom-class dojo/dom-attr dojo/_base/lang dojo/on dojo/sniff dojo/string ./_WidgetBase ./_TemplatedMixin dojo/text!./templates/Calendar.html ./a11yclick ./hccss".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,a){var f=n("dijit.CalendarLite",[b,g],{templateString:a,dowTemplateString:'\x3cth class\x3d"dijitReset dijitCalendarDayLabelTemplate" role\x3d"columnheader" scope\x3d"col"\x3e\x3cspan class\x3d"dijitCalendarDayLabel"\x3e${d}\x3c/span\x3e\x3c/th\x3e',dateTemplateString:'\x3ctd class\x3d"dijitReset" role\x3d"gridcell" data-dojo-attach-point\x3d"dateCells"\x3e\x3cspan class\x3d"dijitCalendarDateLabel" data-dojo-attach-point\x3d"dateLabels"\x3e\x3c/span\x3e\x3c/td\x3e',
weekTemplateString:'\x3ctr class\x3d"dijitReset dijitCalendarWeekTemplate" role\x3d"row"\x3e${d}${d}${d}${d}${d}${d}${d}\x3c/tr\x3e',value:new Date(""),datePackage:"",dayWidth:"narrow",tabIndex:"0",dayOffset:-1,currentFocus:new Date,_setSummaryAttr:"gridNode",baseClass:"dijitCalendar dijitCalendarLite",_isValidDate:function(a){return a&&!isNaN(a)&&"object"==typeof a&&a.toString()!=this.constructor.prototype.value.toString()},_getValueAttr:function(){var a=this._get("value");if(a&&!isNaN(a)){var b=
new this.dateClassObj(a);b.setHours(0,0,0,0);b.getDate()<a.getDate()&&(b=this.dateModule.add(b,"hour",1));return b}return null},_setValueAttr:function(a,b){"string"==typeof a&&(a=e.fromISOString(a));a=this._patchDate(a);if(this._isValidDate(a)&&!this.isDisabledDate(a,this.lang)){if(this._set("value",a),this.set("currentFocus",a),this._markSelectedDates([a]),this._created&&(b||"undefined"==typeof b))this.onChange(this.get("value"))}else this._set("value",null),this._markSelectedDates([])},_patchDate:function(a){if(a||
0===a)a=new this.dateClassObj(a),a.setHours(1,0,0,0);return a},_setText:function(a,b){for(;a.firstChild;)a.removeChild(a.firstChild);a.appendChild(a.ownerDocument.createTextNode(b))},_populateGrid:function(){var a=new this.dateClassObj(this.currentFocus);a.setDate(1);var a=this._patchDate(a),b=a.getDay(),f=this.dateModule.getDaysInMonth(a),g=this.dateModule.getDaysInMonth(this.dateModule.add(a,"month",-1)),h=new this.dateClassObj,u=0<=this.dayOffset?this.dayOffset:d.getFirstDayOfWeek(this.lang);u>
b&&(u-=7);if(!this.summary){var w=this.dateLocaleModule.getNames("months","wide","standAlone",this.lang,a);this.gridNode.setAttribute("summary",w[a.getMonth()])}this._date2cell={};m.forEach(this.dateCells,function(l,d){var w=d+u,e=new this.dateClassObj(a),q="dijitCalendar",x=0;w<b?(w=g-b+w+1,x=-1,q+="Previous"):w>=b+f?(w=w-b-f+1,x=1,q+="Next"):(w=w-b+1,q+="Current");x&&(e=this.dateModule.add(e,"month",x));e.setDate(w);this.dateModule.compare(e,h,"date")||(q="dijitCalendarCurrentDate "+q);this.isDisabledDate(e,
this.lang)?(q="dijitCalendarDisabledDate "+q,l.setAttribute("aria-disabled","true")):(q="dijitCalendarEnabledDate "+q,l.removeAttribute("aria-disabled"),l.setAttribute("aria-selected","false"));(x=this.getClassForDate(e,this.lang))&&(q=x+" "+q);l.className=q+"Month dijitCalendarDateTemplate";q=e.valueOf();this._date2cell[q]=l;l.dijitDateValue=q;q=e.getDateLocalized?e.getDateLocalized(this.lang):e.getDate();this._setText(this.dateLabels[d],q);c.set(l,"aria-label",t.format(e,{selector:"date",formatLength:"long"}))},
this)},_populateControls:function(){var a=new this.dateClassObj(this.currentFocus);a.setDate(1);this.monthWidget.set("month",a);var b=a.getFullYear()-1,c=new this.dateClassObj;m.forEach(["previous","current","next"],function(a){c.setFullYear(b++);this._setText(this[a+"YearLabelNode"],this.dateLocaleModule.format(c,{selector:"year",locale:this.lang}))},this)},goToToday:function(){this.set("value",new this.dateClassObj)},constructor:function(a){this.dateModule=a.datePackage?h.getObject(a.datePackage,
!1):v;this.dateClassObj=this.dateModule.Date||Date;this.dateLocaleModule=a.datePackage?h.getObject(a.datePackage+".locale",!1):t},_createMonthWidget:function(){return f._MonthWidget({id:this.id+"_mddb",lang:this.lang,dateLocaleModule:this.dateLocaleModule},this.monthNode)},buildRendering:function(){var a=this.dowTemplateString,b=this.dateLocaleModule.getNames("days",this.dayWidth,"standAlone",this.lang),c=0<=this.dayOffset?this.dayOffset:d.getFirstDayOfWeek(this.lang);this.dayCellsHtml=x.substitute([a,
a,a,a,a,a,a].join(""),{d:""},function(){return b[c++%7]});a=x.substitute(this.weekTemplateString,{d:this.dateTemplateString});this.dateRowsHtml=[a,a,a,a,a,a].join("");this.dateCells=[];this.dateLabels=[];this.inherited(arguments);k.setSelectable(this.domNode,!1);a=new this.dateClassObj(this.currentFocus);this.monthWidget=this._createMonthWidget();this.set("currentFocus",a,!1)},postCreate:function(){this.inherited(arguments);this._connectControls()},_connectControls:function(){var a=h.hitch(this,function(a,
b,c){this[a].dojoClick=!0;return q(this[a],"click",h.hitch(this,function(){this._setCurrentFocusAttr(this.dateModule.add(this.currentFocus,b,c))}))});this.own(a("incrementMonth","month",1),a("decrementMonth","month",-1),a("nextYearLabelNode","year",1),a("previousYearLabelNode","year",-1))},_setCurrentFocusAttr:function(a,b){var c=this.currentFocus,f=this._getNodeByDate(c);a=this._patchDate(a);this._set("currentFocus",a);this._date2cell&&0==this.dateModule.difference(c,a,"month")||(this._populateGrid(),
this._populateControls(),this._markSelectedDates([this.value]));c=this._getNodeByDate(a);c.setAttribute("tabIndex",this.tabIndex);(this.focused||b)&&c.focus();f&&f!=c&&(u("webkit")?f.setAttribute("tabIndex","-1"):f.removeAttribute("tabIndex"))},focus:function(){this._setCurrentFocusAttr(this.currentFocus,!0)},_onDayClick:function(a){a.stopPropagation();a.preventDefault();for(a=a.target;a&&!a.dijitDateValue&&0!==a.dijitDateValue;a=a.parentNode);a&&!r.contains(a,"dijitCalendarDisabledDate")&&this.set("value",
a.dijitDateValue)},_getNodeByDate:function(a){return(a=this._patchDate(a))&&this._date2cell?this._date2cell[a.valueOf()]:null},_markSelectedDates:function(a){function b(a,b){r.toggle(b,"dijitCalendarSelectedDate",a);b.setAttribute("aria-selected",a?"true":"false")}m.forEach(this._selectedCells||[],h.partial(b,!1));this._selectedCells=m.filter(m.map(a,this._getNodeByDate,this),function(a){return a});m.forEach(this._selectedCells,h.partial(b,!0))},onChange:function(){},isDisabledDate:function(){},getClassForDate:function(){}});
f._MonthWidget=n("dijit.CalendarLite._MonthWidget",b,{_setMonthAttr:function(a){var b=this.dateLocaleModule.getNames("months","wide","standAlone",this.lang,a),c=6==u("ie")?"":"\x3cdiv class\x3d'dijitSpacer'\x3e"+m.map(b,function(a){return"\x3cdiv\x3e"+a+"\x3c/div\x3e"}).join("")+"\x3c/div\x3e";this.domNode.innerHTML=c+"\x3cdiv class\x3d'dijitCalendarMonthLabel dijitCalendarCurrentMonthLabel'\x3e"+b[a.getMonth()]+"\x3c/div\x3e"}});return f})},"dojo/date/stamp":function(){define(["../_base/lang","../_base/array"],
function(m,n){var d={};m.setObject("dojo.date.stamp",d);d.fromISOString=function(v,t){d._isoRegExp||(d._isoRegExp=/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(.\d+)?)?((?:[+-](\d{2}):(\d{2}))|Z)?)?$/);var e=d._isoRegExp.exec(v),k=null;if(e){e.shift();e[1]&&e[1]--;e[6]&&(e[6]*=1E3);t&&(t=new Date(t),n.forEach(n.map("FullYear Month Date Hours Minutes Seconds Milliseconds".split(" "),function(c){return t["get"+c]()}),function(c,d){e[d]=e[d]||c}));k=new Date(e[0]||1970,e[1]||
0,e[2]||1,e[3]||0,e[4]||0,e[5]||0,e[6]||0);100>e[0]&&k.setFullYear(e[0]||1970);var r=0,c=e[7]&&e[7].charAt(0);"Z"!=c&&(r=60*(e[8]||0)+(Number(e[9])||0),"-"!=c&&(r*=-1));c&&(r-=k.getTimezoneOffset());r&&k.setTime(k.getTime()+6E4*r)}return k};d.toISOString=function(d,t){var e=function(c){return 10>c?"0"+c:c};t=t||{};var k=[],r=t.zulu?"getUTC":"get",c="";"time"!=t.selector&&(c=d[r+"FullYear"](),c=["0000".substr((c+"").length)+c,e(d[r+"Month"]()+1),e(d[r+"Date"]())].join("-"));k.push(c);if("date"!=t.selector){c=
[e(d[r+"Hours"]()),e(d[r+"Minutes"]()),e(d[r+"Seconds"]())].join(":");r=d[r+"Milliseconds"]();t.milliseconds&&(c+="."+(100>r?"0":"")+e(r));if(t.zulu)c+="Z";else if("time"!=t.selector)var r=d.getTimezoneOffset(),h=Math.abs(r),c=c+((0<r?"-":"+")+e(Math.floor(h/60))+":"+e(h%60));k.push(c)}return k.join("T")};return d})},"dijit/form/DropDownButton":function(){define("dojo/_base/declare dojo/_base/kernel dojo/_base/lang dojo/query ../registry ../popup ./Button ../_Container ../_HasDropDown dojo/text!./templates/DropDownButton.html ../a11yclick".split(" "),
function(m,n,d,v,t,e,k,r,c,h){return m("dijit.form.DropDownButton",[k,r,c],{baseClass:"dijitDropDownButton",templateString:h,_fillContent:function(){var c=this.srcNodeRef,d=this.containerNode;if(c&&d)for(;c.hasChildNodes();){var h=c.firstChild;h.hasAttribute&&(h.hasAttribute("data-dojo-type")||h.hasAttribute("dojoType")||h.hasAttribute("data-"+n._scopeName+"-type")||h.hasAttribute(n._scopeName+"Type"))?(this.dropDownContainer=this.ownerDocument.createElement("div"),this.dropDownContainer.appendChild(h)):
d.appendChild(h)}},startup:function(){this._started||(!this.dropDown&&this.dropDownContainer&&(this.dropDown=t.byNode(this.dropDownContainer.firstChild),delete this.dropDownContainer),this.dropDown&&e.hide(this.dropDown),this.inherited(arguments))},isLoaded:function(){var c=this.dropDown;return!!c&&(!c.href||c.isLoaded)},loadDropDown:function(c){var h=this.dropDown,e=h.on("load",d.hitch(this,function(){e.remove();c()}));h.refresh()},isFocusable:function(){return this.inherited(arguments)&&!this._mouseDown}})})},
"dijit/form/Button":function(){define("require dojo/_base/declare dojo/dom-class dojo/has dojo/_base/kernel dojo/_base/lang dojo/ready ./_FormWidget ./_ButtonMixin dojo/text!./templates/Button.html ../a11yclick".split(" "),function(m,n,d,v,t,e,k,r,c,h){v("dijit-legacy-requires")&&k(0,function(){m(["dijit/form/DropDownButton","dijit/form/ComboButton","dijit/form/ToggleButton"])});k=n("dijit.form.Button"+(v("dojo-bidi")?"_NoBidi":""),[r,c],{showLabel:!0,iconClass:"dijitNoIcon",_setIconClassAttr:{node:"iconNode",
type:"class"},baseClass:"dijitButton",templateString:h,_setValueAttr:"valueNode",_setNameAttr:function(c){this.valueNode&&this.valueNode.setAttribute("name",c)},postCreate:function(){this.inherited(arguments);this._setLabelFromContainer()},_setLabelFromContainer:function(){this.containerNode&&!this.label&&(this.label=e.trim(this.containerNode.innerHTML),this.onLabelSet())},_setShowLabelAttr:function(c){this.containerNode&&d.toggle(this.containerNode,"dijitDisplayNone",!c);this._set("showLabel",c)},
setLabel:function(c){t.deprecated("dijit.form.Button.setLabel() is deprecated.  Use set('label', ...) instead.","","2.0");this.set("label",c)},onLabelSet:function(){this.inherited(arguments);this.showLabel||"title"in this.params||(this.titleNode.title=e.trim(this.containerNode.innerText||this.containerNode.textContent||""))}});v("dojo-bidi")&&(k=n("dijit.form.Button",k,{onLabelSet:function(){this.inherited(arguments);this.titleNode.title&&this.applyTextDir(this.titleNode,this.titleNode.title)},_setTextDirAttr:function(c){this._created&&
this.textDir!=c&&(this._set("textDir",c),this._setLabelAttr(this.label))}}));return k})},"dijit/form/_ButtonMixin":function(){define(["dojo/_base/declare","dojo/dom","dojo/has","../registry"],function(m,n,d,v){var t=m("dijit.form._ButtonMixin"+(d("dojo-bidi")?"_NoBidi":""),null,{label:"",type:"button",__onClick:function(d){d.stopPropagation();d.preventDefault();this.disabled||this.valueNode.click(d);return!1},_onClick:function(d){if(this.disabled)return d.stopPropagation(),d.preventDefault(),!1;!1===
this.onClick(d)&&d.preventDefault();var e=d.defaultPrevented;if(!e&&"submit"==this.type&&!(this.valueNode||this.focusNode).form)for(var r=this.domNode;r.parentNode;r=r.parentNode){var c=v.byNode(r);if(c&&"function"==typeof c._onSubmit){c._onSubmit(d);d.preventDefault();e=!0;break}}return!e},postCreate:function(){this.inherited(arguments);n.setSelectable(this.focusNode,!1)},onClick:function(){return!0},_setLabelAttr:function(d){this._set("label",d);(this.containerNode||this.focusNode).innerHTML=d;
this.onLabelSet()},onLabelSet:function(){}});d("dojo-bidi")&&(t=m("dijit.form._ButtonMixin",t,{onLabelSet:function(){this.inherited(arguments);this.applyTextDir(this.containerNode||this.focusNode)}}));return t})},"dijit/form/_DateTimeTextBox":function(){define("dojo/date dojo/date/locale dojo/date/stamp dojo/_base/declare dojo/_base/lang ./RangeBoundTextBox ../_HasDropDown dojo/text!./templates/DropDownBox.html".split(" "),function(m,n,d,v,t,e,k,r){new Date("X");return v("dijit.form._DateTimeTextBox",
[e,k],{templateString:r,hasDownArrow:!0,cssStateNodes:{_buttonNode:"dijitDownArrowButton"},_unboundedConstraints:{},pattern:n.regexp,datePackage:"",postMixInProperties:function(){this.inherited(arguments);this._set("type","text")},compare:function(c,d){var h=this._isInvalidDate(c),u=this._isInvalidDate(d);if(h||u)return h&&u?0:h?-1:1;var h=this.format(c,this._unboundedConstraints),u=this.format(d,this._unboundedConstraints),e=this.parse(h,this._unboundedConstraints),b=this.parse(u,this._unboundedConstraints);
return h==u?0:m.compare(e,b,this._selector)},autoWidth:!0,format:function(c,d){return c?this.dateLocaleModule.format(c,d):""},parse:function(c,d){return this.dateLocaleModule.parse(c,d)||(this._isEmpty(c)?null:void 0)},serialize:function(c,h){c.toGregorian&&(c=c.toGregorian());return d.toISOString(c,h)},dropDownDefaultValue:new Date,value:new Date(""),_blankValue:null,popupClass:"",_selector:"",constructor:function(c){c=c||{};this.dateModule=c.datePackage?t.getObject(c.datePackage,!1):m;this.dateClassObj=
this.dateModule.Date||Date;this.dateClassObj instanceof Date||(this.value=new this.dateClassObj(this.value));this.dateLocaleModule=c.datePackage?t.getObject(c.datePackage+".locale",!1):n;this._set("pattern",this.dateLocaleModule.regexp);this._invalidDate=this.constructor.prototype.value.toString()},buildRendering:function(){this.inherited(arguments);this.hasDownArrow||(this._buttonNode.style.display="none");this.hasDownArrow||(this._buttonNode=this.domNode,this.baseClass+=" dijitComboBoxOpenOnClick")},
_setConstraintsAttr:function(c){c.selector=this._selector;c.fullYear=!0;var h=d.fromISOString;"string"==typeof c.min&&(c.min=h(c.min),this.dateClassObj instanceof Date||(c.min=new this.dateClassObj(c.min)));"string"==typeof c.max&&(c.max=h(c.max),this.dateClassObj instanceof Date||(c.max=new this.dateClassObj(c.max)));this.inherited(arguments);this._unboundedConstraints=t.mixin({},this.constraints,{min:null,max:null})},_isInvalidDate:function(c){return!c||isNaN(c)||"object"!=typeof c||c.toString()==
this._invalidDate},_setValueAttr:function(c,h,e){void 0!==c&&("string"==typeof c&&(c=d.fromISOString(c)),this._isInvalidDate(c)&&(c=null),c instanceof Date&&!(this.dateClassObj instanceof Date)&&(c=new this.dateClassObj(c)));this.inherited(arguments,[c,h,e]);this.value instanceof Date&&(this.filterString="");!1!==h&&this.dropDown&&this.dropDown.set("value",c,!1)},_set:function(c,d){if("value"==c){d instanceof Date&&!(this.dateClassObj instanceof Date)&&(d=new this.dateClassObj(d));var h=this._get("value");
if(h instanceof this.dateClassObj&&0==this.compare(d,h))return}this.inherited(arguments)},_setDropDownDefaultValueAttr:function(c){this._isInvalidDate(c)&&(c=new this.dateClassObj);this._set("dropDownDefaultValue",c)},openDropDown:function(c){this.dropDown&&this.dropDown.destroy();var d=t.isString(this.popupClass)?t.getObject(this.popupClass,!1):this.popupClass,e=this,u=this.get("value");this.dropDown=new d({onChange:function(c){e.set("value",c,!0)},id:this.id+"_popup",dir:e.dir,lang:e.lang,value:u,
textDir:e.textDir,currentFocus:this._isInvalidDate(u)?this.dropDownDefaultValue:u,constraints:e.constraints,filterString:e.filterString,datePackage:e.datePackage,isDisabledDate:function(c){return!e.rangeCheck(c,e.constraints)}});this.inherited(arguments)},_getDisplayedValueAttr:function(){return this.textbox.value},_setDisplayedValueAttr:function(c,d){this._setValueAttr(this.parse(c,this.constraints),d,c)}})})},"dijit/form/RangeBoundTextBox":function(){define(["dojo/_base/declare","dojo/i18n","./MappedTextBox",
"dojo/i18n!./nls/validate"],function(m,n,d){return m("dijit.form.RangeBoundTextBox",d,{rangeMessage:"",rangeCheck:function(d,t){return("min"in t?0<=this.compare(d,t.min):!0)&&("max"in t?0>=this.compare(d,t.max):!0)},isInRange:function(){return this.rangeCheck(this.get("value"),this.constraints)},_isDefinitelyOutOfRange:function(){var d=this.get("value");if(null==d)return!1;var t=!1;"min"in this.constraints&&(t=this.constraints.min,t=0>this.compare(d,"number"==typeof t&&0<=t&&0!=d?0:t));!t&&"max"in
this.constraints&&(t=this.constraints.max,t=0<this.compare(d,"number"!=typeof t||0<t?t:0));return t},_isValidSubset:function(){return this.inherited(arguments)&&!this._isDefinitelyOutOfRange()},isValid:function(d){return this.inherited(arguments)&&(this._isEmpty(this.textbox.value)&&!this.required||this.isInRange(d))},getErrorMessage:function(d){var t=this.get("value");return null==t||""===t||"number"==typeof t&&isNaN(t)||this.isInRange(d)?this.inherited(arguments):this.rangeMessage},postMixInProperties:function(){this.inherited(arguments);
this.rangeMessage||(this.messages=n.getLocalization("dijit.form","validate",this.lang),this.rangeMessage=this.messages.rangeMessage)}})})},"dijit/form/MappedTextBox":function(){define(["dojo/_base/declare","dojo/sniff","dojo/dom-construct","./ValidationTextBox"],function(m,n,d,v){return m("dijit.form.MappedTextBox",v,{postMixInProperties:function(){this.inherited(arguments);this.nameAttrSetting=""},_setNameAttr:"valueNode",serialize:function(d){return d.toString?d.toString():""},toString:function(){var d=
this.filter(this.get("value"));return null!=d?"string"==typeof d?d:this.serialize(d,this.constraints):""},validate:function(){this.valueNode.value=this.toString();return this.inherited(arguments)},buildRendering:function(){this.inherited(arguments);this.valueNode=d.place("\x3cinput type\x3d'hidden'"+(this.name&&!n("msapp")?' name\x3d"'+this.name.replace(/"/g,"\x26quot;")+'"':"")+"/\x3e",this.textbox,"after")},reset:function(){this.valueNode.value="";this.inherited(arguments)}})})},"dijit/form/TimeTextBox":function(){define("dojo/_base/declare dojo/keys dojo/query dojo/_base/lang ../_TimePicker ./_DateTimeTextBox".split(" "),
function(m,n,d,v,t,e){return m("dijit.form.TimeTextBox",e,{baseClass:"dijitTextBox dijitComboBox dijitTimeTextBox",popupClass:t,_selector:"time",value:new Date(""),maxHeight:-1,openDropDown:function(e){this.inherited(arguments);var k=d(".dijitTimePickerItemSelected",this.dropDown.domNode),c=this.dropDown.domNode.parentNode;c.scrollTop=k[0]?k[0].offsetTop-(c.clientHeight-k[0].clientHeight)/2:(c.scrollHeight-c.clientHeight)/2;this.dropDown.on("input",v.hitch(this,function(){this.set("value",this.dropDown.get("value"),
!1)}))},_onInput:function(){this.inherited(arguments);var d=this.get("displayedValue");this.filterString=d&&!this.parse(d,this.constraints)?d.toLowerCase():"";this._opened&&this.closeDropDown();this.openDropDown()}})})},"dijit/_TimePicker":function(){define("dojo/_base/array dojo/date dojo/date/locale dojo/date/stamp dojo/_base/declare dojo/dom-class dojo/dom-construct dojo/_base/kernel dojo/keys dojo/_base/lang dojo/sniff dojo/query dojo/mouse dojo/on ./_WidgetBase ./form/_ListMouseMixin".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,a){return t("dijit._TimePicker",[g,a],{baseClass:"dijitTimePicker",pickerMin:"T00:00:00",pickerMax:"T23:59:59",clickableIncrement:"T00:15:00",visibleIncrement:"T01:00:00",value:new Date,_visibleIncrement:2,_clickableIncrement:1,_totalIncrements:10,constraints:{},serialize:v.toISOString,buildRendering:function(){this.inherited(arguments);this.timeMenu=this.containerNode=this.domNode},setValue:function(a){r.deprecated("dijit._TimePicker:setValue() is deprecated.  Use set('value', ...) instead.",
"","2.0");this.set("value",a)},_setValueAttr:function(a){this._set("value",a);this._showText()},_setFilterStringAttr:function(a){this._set("filterString",a);this._showText()},isDisabledDate:function(){return!1},_getFilteredNodes:function(a,b,c,g){a=this.ownerDocument.createDocumentFragment();for(b=0;b<this._maxIncrement;b++)(c=this._createOption(b))&&a.appendChild(c);return a},_showText:function(){var a=v.fromISOString;this.domNode.innerHTML="";this._clickableIncrementDate=a(this.clickableIncrement);
this._visibleIncrementDate=a(this.visibleIncrement);var b=function(a){return 3600*a.getHours()+60*a.getMinutes()+a.getSeconds()},c=b(this._clickableIncrementDate),b=b(this._visibleIncrementDate);(this.value||this.currentFocus).getTime();this._refDate=a(this.pickerMin);this._refDate.setFullYear(1970,0,1);this._clickableIncrement=1;this._visibleIncrement=b/c;a=a(this.pickerMax);a.setFullYear(1970,0,1);a=.001*(a.getTime()-this._refDate.getTime());this._maxIncrement=Math.ceil((a+1)/c);c=this._getFilteredNodes();
!c.firstChild&&this.filterString?(this.filterString="",this._showText()):this.domNode.appendChild(c)},constructor:function(){this.constraints={}},postMixInProperties:function(){this.inherited(arguments);this._setConstraintsAttr(this.constraints)},_setConstraintsAttr:function(a){for(var b in{clickableIncrement:1,visibleIncrement:1,pickerMin:1,pickerMax:1})b in a&&(this[b]=a[b]);a.locale||(a.locale=this.lang)},_createOption:function(a){var b=new Date(this._refDate),c=this._clickableIncrementDate;b.setHours(b.getHours()+
c.getHours()*a,b.getMinutes()+c.getMinutes()*a,b.getSeconds()+c.getSeconds()*a);"time"==this.constraints.selector&&b.setFullYear(1970,0,1);var f=d.format(b,this.constraints);if(this.filterString&&0!==f.toLowerCase().indexOf(this.filterString))return null;c=this.ownerDocument.createElement("div");c.className=this.baseClass+"Item";c.date=b;c.idx=a;k.create("div",{"class":this.baseClass+"ItemInner",innerHTML:f},c);f=1>a%this._visibleIncrement&&-1<a%this._visibleIncrement;a=!f&&!(a%this._clickableIncrement);
f?c.className+=" "+this.baseClass+"Marker":a&&(c.className+=" "+this.baseClass+"Tick");this.isDisabledDate(b)&&(c.className+=" "+this.baseClass+"ItemDisabled");this.value&&!n.compare(this.value,b,this.constraints.selector)&&(c.selected=!0,c.className+=" "+this.baseClass+"ItemSelected",this._selectedDiv=c,f?c.className+=" "+this.baseClass+"MarkerSelected":a&&(c.className+=" "+this.baseClass+"TickSelected"),this._highlightOption(c,!0));return c},onOpen:function(){this.inherited(arguments);this.set("selected",
this._selectedDiv)},_onOptionSelected:function(a,b){var c=a.target.date||a.target.parentNode.date;c&&!this.isDisabledDate(c)&&(this._set("value",c),this.emit("input"),b&&(this._highlighted_option=null,this.set("value",c),this.onChange(c)))},onChange:function(){},_highlightOption:function(a,b){if(a){if(b)this._highlighted_option&&this._highlightOption(this._highlighted_option,!1),this._highlighted_option=a;else{if(this._highlighted_option!==a)return;this._highlighted_option=null}e.toggle(a,this.baseClass+
"ItemHover",b);e.contains(a,this.baseClass+"Marker")?e.toggle(a,this.baseClass+"MarkerHover",b):e.toggle(a,this.baseClass+"TickHover",b)}},handleKey:function(a){if(a.keyCode==c.DOWN_ARROW)return this.selectNextNode(),this._onOptionSelected({target:this._highlighted_option},!1),a.stopPropagation(),a.preventDefault(),!1;if(a.keyCode==c.UP_ARROW)return this.selectPreviousNode(),this._onOptionSelected({target:this._highlighted_option},!1),a.stopPropagation(),a.preventDefault(),!1;if(a.keyCode==c.ENTER||
a.keyCode===c.TAB){if(!this._keyboardSelected&&a.keyCode===c.TAB)return!0;this._highlighted_option&&this._onOptionSelected({target:this._highlighted_option},!0);return a.keyCode===c.TAB}},onHover:function(a){this._highlightOption(a,!0)},onUnhover:function(a){this._highlightOption(a,!1)},onSelect:function(a){this._highlightOption(a,!0)},onDeselect:function(a){this._highlightOption(a,!1)},onClick:function(a){this._onOptionSelected({target:a},!0)}})})},"dijit/form/_ListMouseMixin":function(){define(["dojo/_base/declare",
"dojo/on","dojo/touch","./_ListBase"],function(m,n,d,v){return m("dijit.form._ListMouseMixin",v,{postCreate:function(){this.inherited(arguments);this.domNode.dojoClick=!0;this._listConnect("click","_onClick");this._listConnect("mousedown","_onMouseDown");this._listConnect("mouseup","_onMouseUp");this._listConnect("mouseover","_onMouseOver");this._listConnect("mouseout","_onMouseOut")},_onClick:function(d,e){this._setSelectedAttr(e,!1);this._deferredClick&&this._deferredClick.remove();this._deferredClick=
this.defer(function(){this._deferredClick=null;this.onClick(e)})},_onMouseDown:function(d,e){this._hoveredNode&&(this.onUnhover(this._hoveredNode),this._hoveredNode=null);this._isDragging=!0;this._setSelectedAttr(e,!1)},_onMouseUp:function(d,e){this._isDragging=!1;var k=this.selected,r=this._hoveredNode;k&&e==k?this.defer(function(){this._onClick(d,k)}):r&&this.defer(function(){this._onClick(d,r)})},_onMouseOut:function(d,e){this._hoveredNode&&(this.onUnhover(this._hoveredNode),this._hoveredNode=
null);this._isDragging&&(this._cancelDrag=(new Date).getTime()+1E3)},_onMouseOver:function(d,e){this._cancelDrag&&((new Date).getTime()>this._cancelDrag&&(this._isDragging=!1),this._cancelDrag=null);this._hoveredNode=e;this.onHover(e);this._isDragging&&this._setSelectedAttr(e,!1)}})})},"dijit/form/_ListBase":function(){define(["dojo/_base/declare","dojo/on","dojo/window"],function(m,n,d){return m("dijit.form._ListBase",null,{selected:null,_listConnect:function(d,t){var e=this;return e.own(n(e.containerNode,
n.selector(function(d,e,c){return d.parentNode==c},d),function(d){e[t](d,this)}))},selectFirstNode:function(){for(var d=this.containerNode.firstChild;d&&"none"==d.style.display;)d=d.nextSibling;this._setSelectedAttr(d,!0)},selectLastNode:function(){for(var d=this.containerNode.lastChild;d&&"none"==d.style.display;)d=d.previousSibling;this._setSelectedAttr(d,!0)},selectNextNode:function(){var d=this.selected;if(d){for(d=d.nextSibling;d&&"none"==d.style.display;)d=d.nextSibling;d?this._setSelectedAttr(d,
!0):this.selectFirstNode()}else this.selectFirstNode()},selectPreviousNode:function(){var d=this.selected;if(d){for(d=d.previousSibling;d&&"none"==d.style.display;)d=d.previousSibling;d?this._setSelectedAttr(d,!0):this.selectLastNode()}else this.selectLastNode()},_setSelectedAttr:function(n,t){if(this.selected!=n){var e=this.selected;if(e)this.onDeselect(e);n&&(t&&d.scrollIntoView(n),this.onSelect(n));this._set("selected",n)}else if(n)this.onSelect(n)}})})},"dojo/data/ObjectStore":function(){define("../_base/lang ../Evented ../_base/declare ../_base/Deferred ../_base/array ../_base/connect ../regexp".split(" "),
function(m,n,d,v,t,e,k){function r(c){return"*"==c?".*":"?"==c?".":c}return d("dojo.data.ObjectStore",[n],{objectStore:null,constructor:function(c){this._dirtyObjects=[];c.labelAttribute&&(c.labelProperty=c.labelAttribute);m.mixin(this,c)},labelProperty:"label",getValue:function(c,d,e){return"function"===typeof c.get?c.get(d):d in c?c[d]:e},getValues:function(c,d){var h=this.getValue(c,d);return h instanceof Array?h:void 0===h?[]:[h]},getAttributes:function(c){var d=[],e;for(e in c)!c.hasOwnProperty(e)||
"_"==e.charAt(0)&&"_"==e.charAt(1)||d.push(e);return d},hasAttribute:function(c,d){return d in c},containsValue:function(c,d,e){return-1<t.indexOf(this.getValues(c,d),e)},isItem:function(c){return"object"==typeof c&&c&&!(c instanceof Date)},isItemLoaded:function(c){return c&&"function"!==typeof c.load},loadItem:function(c){var d;"function"===typeof c.item.load?v.when(c.item.load(),function(h){d=h;var e=h instanceof Error?c.onError:c.onItem;e&&e.call(c.scope,h)}):c.onItem&&c.onItem.call(c.scope,c.item);
return d},close:function(c){return c&&c.abort&&c.abort()},fetch:function(c){function d(a){c.onError&&c.onError.call(u,a,c)}c=m.delegate(c,c&&c.queryOptions);var e=this,u=c.scope||e,x=c.query;if("object"==typeof x){var x=m.delegate(x),b;for(b in x){var g=x[b];"string"==typeof g&&(x[b]=RegExp("^"+k.escapeString(g,"*?\\").replace(/\\.|\*|\?/g,r)+"$",c.ignoreCase?"mi":"m"),x[b].toString=function(a){return function(){return a}}(g))}}var a=this.objectStore.query(x,c);v.when(a.total,function(b){v.when(a,
function(a){c.onBegin&&c.onBegin.call(u,b||a.length,c);if(c.onItem)for(var f=0;f<a.length;f++)c.onItem.call(u,a[f],c);c.onComplete&&c.onComplete.call(u,c.onItem?null:a,c);return a},d)},d);c.abort=function(){a.cancel&&a.cancel()};a.observe&&(this.observing&&this.observing.cancel(),this.observing=a.observe(function(a,b,c){if(-1==t.indexOf(e._dirtyObjects,a))if(-1==b)e.onNew(a);else if(-1==c)e.onDelete(a);else for(var f in a)if(f!=e.objectStore.idProperty)e.onSet(a,f,null,a[f])},!0));this.onFetch(a);
c.store=this;return c},getFeatures:function(){return{"dojo.data.api.Read":!!this.objectStore.get,"dojo.data.api.Identity":!0,"dojo.data.api.Write":!!this.objectStore.put,"dojo.data.api.Notification":!0}},getLabel:function(c){if(this.isItem(c))return this.getValue(c,this.labelProperty)},getLabelAttributes:function(c){return[this.labelProperty]},getIdentity:function(c){return this.objectStore.getIdentity?this.objectStore.getIdentity(c):c[this.objectStore.idProperty||"id"]},getIdentityAttributes:function(c){return[this.objectStore.idProperty]},
fetchItemByIdentity:function(c){var d;v.when(this.objectStore.get(c.identity),function(h){d=h;c.onItem.call(c.scope,h)},function(d){c.onError.call(c.scope,d)});return d},newItem:function(c,d){if(d){var h=this.getValue(d.parent,d.attribute,[]),h=h.concat([c]);c.__parent=h;this.setValue(d.parent,d.attribute,h)}this._dirtyObjects.push({object:c,save:!0});this.onNew(c);return c},deleteItem:function(c){this.changing(c,!0);this.onDelete(c)},setValue:function(c,d,e){var h=c[d];this.changing(c);c[d]=e;this.onSet(c,
d,h,e)},setValues:function(c,d,e){if(!m.isArray(e))throw Error("setValues expects to be passed an Array object as its value");this.setValue(c,d,e)},unsetAttribute:function(c,d){this.changing(c);var h=c[d];delete c[d];this.onSet(c,d,h,void 0)},changing:function(c,d){c.__isDirty=!0;for(var h=0;h<this._dirtyObjects.length;h++){var e=this._dirtyObjects[h];if(c==e.object){d&&(e.object=!1,this._saveNotNeeded||(e.save=!0));return}}e=c instanceof Array?[]:{};for(h in c)c.hasOwnProperty(h)&&(e[h]=c[h]);this._dirtyObjects.push({object:!d&&
c,old:e,save:!this._saveNotNeeded})},save:function(c){c=c||{};var d,q=[],u=[],x=this,b=this._dirtyObjects,g=b.length;try{e.connect(c,"onError",function(){if(!1!==c.revertOnError){var a=b;b=u;x.revert();x._dirtyObjects=a}else x._dirtyObjects=b.concat(u)});if(this.objectStore.transaction)var a=this.objectStore.transaction();for(var f=0;f<b.length;f++){var l=b[f],k=l.object,r=l.old;delete k.__isDirty;k?d=this.objectStore.put(k,{overwrite:!!r}):"undefined"!=typeof r&&(d=this.objectStore.remove(this.getIdentity(r)));
u.push(l);b.splice(f--,1);v.when(d,function(a){--g||c.onComplete&&c.onComplete.call(c.scope,q)},function(a){g=-1;c.onError.call(c.scope,a)})}a&&a.commit()}catch(B){c.onError.call(c.scope,value)}},revert:function(){for(var c=this._dirtyObjects,d=c.length;0<d;){d--;var e=c[d],u=e.object,e=e.old;if(u&&e){for(var x in e)e.hasOwnProperty(x)&&u[x]!==e[x]&&(this.onSet(u,x,u[x],e[x]),u[x]=e[x]);for(x in u)e.hasOwnProperty(x)||(this.onSet(u,x,u[x]),delete u[x])}else if(e)this.onNew(e);else this.onDelete(u);
delete (u||e).__isDirty;c.splice(d,1)}},isDirty:function(c){return c?c.__isDirty:!!this._dirtyObjects.length},onSet:function(){},onNew:function(){},onDelete:function(){},onFetch:function(c){}})})},"esri/dijit/Search":function(){define("require dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/Evented dojo/Deferred dojo/keys dojo/on dojo/query dojo/uacss dojo/regexp dojo/dom dojo/dom-attr dojo/dom-class dojo/dom-style dojo/dom-construct dojo/date/locale dojo/i18n!../nls/jsapi dojo/text!./Search/templates/Search.html dijit/_WidgetBase dijit/_TemplatedMixin dijit/_FocusMixin dijit/a11yclick dijit/focus ../lang ../InfoTemplate ../kernel ../SpatialReference ../graphic ../promiseList ../symbols/PictureMarkerSymbol ../symbols/SimpleMarkerSymbol ../symbols/SimpleLineSymbol ../symbols/SimpleFillSymbol ../symbols/TextSymbol ../symbols/Font ../geometry/Point ../geometry/Extent ../geometry/normalizeUtils ../geometry/scaleUtils ../tasks/locator ../tasks/query ../Color ../styles/basic".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,a,f,l,y,F,B,A,z,w,D,C,E,O,J,K,I,X,P,N,L,H,Q,ja,V,ba,Z,T,R,Y){function da(a,b){a&&b&&(a._layer=b,a._sourceLayer=b)}n=n([F,B,A,t],{declaredClass:"esri.dijit.Search",templateString:y,reHostedFS:/https?:\/\/services.*\.arcgis\.com/i,constructor:function(a,b){this.css={searchGroup:"searchGroup",searchInput:"searchInput",searchInputGroup:"searchInputGroup",searchBtn:"searchBtn",searchSubmit:"searchSubmit",searchIcon:"searchIcon esri-icon-search",searchButtonText:"searchButtonText",
searchToggle:"searchToggle",searchToggleIcon:"searchIcon esri-icon-down-arrow",searchMenu:"searchMenu",searchMenuHeader:"menuHeader",searchClear:"searchClear",searchClearIcon:"searchIcon esri-icon-close searchClose",searchSpinner:"searchIcon esri-icon-loading-indicator searchSpinner",searchSourceName:"sourceName",suggestionsMenu:"suggestionsMenu",sourcesMenu:"sourcesMenu",activeSource:"active",hasValue:"hasValue",hasButtonMode:"hasButtonMode",hasMultipleSources:"hasMultipleSources",showSuggestions:"showSuggestions",
showSources:"showSources",showNoResults:"showNoResults",searchLoading:"searchLoading",latLonHeader:"searchLatLongHeader",searchMoreResults:"moreResults",searchMoreResultsList:"resultsList",searchMoreResultsHeader:"moreHeader",searchMoreResultsItem:"moreItem",searchMoreResultsListHeader:"popupHeader",searchShowMoreResults:"showMoreResults",searchNoResultsMenu:"noResultsMenu",searchNoResultsBody:"noResultsBody",searchNoResultsHeader:"noResultsHeader",searchNoValueIcon:"noValueIcon esri-icon-notice-triangle",
searchNoValueText:"noValueText",searchNoResultsText:"noResultsText",searchExpandContainer:"searchExpandContainer",searchAnimateContainer:"searchAnimate",searchExpanded:"searchExpanded",searchCollapsed:"searchCollapsed",searchClearFloat:"searchClearFloat"};this._allIndex="all";this._objectIdIdentifier="_objectId";this._deferreds=[];this._sourceNames=[];this.defaultSource={locator:new Z("//geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"),singleLineFieldName:"SingleLine",outFields:["Addr_type",
"Match_addr","StAddr","City"],name:l.widgets.Search.main.esriLocatorName,localSearchOptions:{minScale:3E5,distance:5E4},placeholder:l.widgets.Search.main.placeholder,highlightSymbol:(new I(m.toUrl("./Search/images/search-pointer.png"),36,36)).setOffset(9,18)};this.options={map:null,theme:"arcgisSearch",visible:!0,value:"",allPlaceholder:"",sources:[this.defaultSource],activeSourceIndex:0,suggestionDelay:150,enableSourcesMenu:!0,enableSuggestionsMenu:!0,enableInfoWindow:!0,showInfoWindowOnSelect:!0,
enableSuggestions:!0,enableButtonMode:!1,autoNavigate:!0,autoSelect:!0,addLayersFromMap:!1,zoomScale:1E3,graphicsLayer:null,enableHighlight:!0,highlightGraphic:null,enableLabel:!1,labelSymbol:(new L).setColor(new R([181,56,46,.9])).setFont(new H("14px",H.STYLE_NORMAL,H.VARIANT_NORMAL,H.WEIGHT_BOLD,"Arial")),labelGraphic:null,infoTemplate:new C(l.widgets.Search.main.searchResult,'\x3cdiv class\x3d"${searchTheme}"\x3e\x3cdiv id\x3d"${searchMoreResultsId}" class\x3d"${searchMoreResults}"\x3e\x3cdiv class\x3d"${searchMoreResultsItem}"\x3e${searchResult}\x3c/div\x3e\x3cdiv\x3e${searchMoreResultsHtml}\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e'),
searchResults:null,suggestResults:null,selectedResult:null,magicKey:null,selectedFeatureId:null,expanded:!1,maxLength:128,maxResults:6,maxSuggestions:6,locationToAddressDistance:1500,minCharacters:1,enableSearchingAll:!0};var c=d.mixin({},this.options,a);this.set(c);this._updateActiveSource();this._i18n=l;this._defaultSR=new O(4326);this.domNode=b},startup:function(){this.inherited(arguments);this.sources||(this.sources=[]);this._mapLoaded().then(d.hitch(this,this._init))},postCreate:function(){var a=
this;this.inherited(arguments);this._moreResultsId=this.id+"_more_results";this.own(r(this.submitNode,z,d.hitch(this,this._searchButton)));this.own(r(this.sourcesBtnNode,z,d.hitch(this,this._toggleSourcesMenu)));this.own(r(this.inputNode,z,d.hitch(this,this._inputClick)));this.own(r(this.clearNode,z,d.hitch(this,this._clearButton)));this.own(r(this.formNode,"submit",d.hitch(this,function(a){a.preventDefault();this._cancelSuggest();this.search()})));this.own(r(this.inputNode,"keyup",d.hitch(this,function(a){this._inputKey(a)})));
this.own(r(this.sourcesBtnNode,"keyup",d.hitch(this,function(a){this._sourceBtnKey(a)})));this.own(r(this.suggestionsNode,"li:click, li:keyup",function(b){a._suggestionsEvent(b,this)}));this.own(r(this.sourcesNode,"li:click, li:keyup",function(b){a._sourcesEvent(b,this)}));this.own(r(this.inputNode,"input, paste",d.hitch(this,function(){this._suggestDelay()})));this.map&&this.map.infoWindow&&this.map.infoWindow.domNode&&this.enableInfoWindow&&(this.own(r(this.map.infoWindow.domNode,"#"+this._moreResultsId+
"_show:click",d.hitch(this,function(a){this._showMoreResultsClick(a)}))),this.own(r(this.map.infoWindow.domNode,"#"+this._moreResultsId+"_list li a:click",d.hitch(this,function(a){this._moreResultsClick(a)}))),this.own(r(this.map.infoWindow.domNode,"#"+this._moreResultsId+" [data-switch-coordinates]:click",d.hitch(this,function(a){this._switchCoordinatesClick(a)}))));this.value&&this._checkStatus();this._hideMenus();this._updateVisible();this._insertSources(this.sources);this._setPlaceholder(this.activeSourceIndex);
this._updateButtonMode(this.enableButtonMode);this.toggle(this.expanded)},destroy:function(){this.clear();a.empty(this.domNode);this.inherited(arguments)},clear:function(){this.clearGraphics();x.get(this.inputNode,"value")&&x.set(this.inputNode,"value","");this._changeAttrValue("value","");this.set("searchResults",null);this.set("suggestResults",null);this.set("selectedResult",null);this.set("magicKey",null);this.set("selectedFeatureId",null);b.remove(this.containerNode,this.css.hasValue);x.set(this.clearNode,
"title","");this._hideMenus();this._closePopup();this._hideLoading();this.emit("clear-search")},show:function(){g.set(this.domNode,"display","block")},hide:function(){g.set(this.domNode,"display","none")},expand:function(){this.enableButtonMode&&(b.add(this.containerNode,this.css.searchExpanded),b.remove(this.containerNode,this.css.searchCollapsed),this._hideMenus(),this.set("expanded",!0))},collapse:function(){this.enableButtonMode&&(b.remove(this.containerNode,this.css.searchExpanded),b.add(this.containerNode,
this.css.searchCollapsed),this._hideMenus(),this.set("expanded",!1))},toggle:function(a){this.enableButtonMode&&("undefined"===typeof a&&(a=!this.expanded),a?this.expand():this.collapse())},search:function(a){var b=new e;this._mapLoaded().then(d.hitch(this,function(){this._searchDeferred(a).then(d.hitch(this,function(a){var c=a.results;this.set("searchResults",c);0===a.numResults&&(this._noResults(a.value),this._showNoResultsMenu());this._hideLoading();this.emit("search-results",a);this._selectFirstResult(c,
a.activeSourceIndex);b.resolve(c)}),d.hitch(this,function(a){b.reject(a)}))}));return b.promise},suggest:function(a){var b=new e;this._mapLoaded().then(d.hitch(this,function(){this._suggestDeferred(a).then(d.hitch(this,function(a){if(a){var c=a.results;this.set("suggestResults",c);this._insertSuggestions(c,a.value);this.emit("suggest-results",a);b.resolve(c)}}),d.hitch(this,function(a){b.reject(a)}))}));return b.promise},select:function(a){var b=this._getDefaultSymbol(a),c=this.labelSymbol,f,g=this.sources,
l=this.activeSourceIndex,w=this.enableHighlight,h=this.enableLabel,e=this.autoNavigate,u=this.showInfoWindowOnSelect,x=this.enableInfoWindow,q=this.infoTemplate,k=a.feature?new J(a.feature.toJson()):null,r=k?a.feature._sourceLayer:null;da(k,r);if(l===this._allIndex){var y=this._getSourceIndexOfResult(a);null!==y&&(f=g[y],l=y)}else f=g[l];f&&(f.hasOwnProperty("highlightSymbol")&&(b=f.highlightSymbol),f.hasOwnProperty("labelSymbol")&&(c=f.labelSymbol),f.hasOwnProperty("enableHighlight")&&(w=f.enableHighlight),
f.hasOwnProperty("enableLabel")&&(h=f.enableLabel),f.hasOwnProperty("autoNavigate")&&(e=f.autoNavigate),f.hasOwnProperty("showInfoWindowOnSelect")&&(u=f.showInfoWindowOnSelect),f.hasOwnProperty("enableInfoWindow")&&(x=f.enableInfoWindow),f.hasOwnProperty("infoTemplate")?q=f.infoTemplate:f.featureLayer&&f.featureLayer.infoTemplate&&(q=f.featureLayer.infoTemplate));this._hideMenus();this._hideLoading();if(k){var g=this.highlightGraphic,D=this.graphicsLayer,y=this.labelGraphic,E=d.mixin({},k.attributes,
{searchTheme:this.theme,searchResult:this._searchResultHTML(a),searchMoreResults:this.css.searchMoreResults,searchMoreResultsItem:this.css.searchMoreResultsItem,searchMoreResultsId:this._moreResultsId,searchMoreResultsHtml:this._moreResultsHTML(a)}),z=null;x&&(z=q);y?(y.setGeometry(k.geometry),y.setAttributes(E),y.setSymbol(c),c&&"textsymbol"===c.type&&y.symbol.setText(a.name)):(y=new J(k.geometry,c,E),da(y,r),c&&"textsymbol"===c.type&&y.symbol.setText(a.name),h&&(D?D.add(y):this.map&&this.map.graphics&&
this.map.graphics.add(y)));g?(g.setGeometry(k.geometry),g.setAttributes(E),g.setInfoTemplate(z),g.setSymbol(b)):(g=new J(k.geometry,b,E,z),da(g,r),w&&(D?D.add(g):this.map&&this.map.graphics&&this.map.graphics.add(g)));g&&g.symbol&&"textsymbol"===g.symbol.type&&g.symbol.setText(a.name);this.map&&this.map.infoWindow&&x&&u&&(this.map.infoWindow.setFeatures([g]),b=this._getPointFromGeometry(g.geometry),this.map.infoWindow.show(b));this.map&&e&&a&&a.hasOwnProperty("extent")&&"function"===typeof this.map.setExtent&&
this.map.setExtent(a.extent,!0);this.set("highlightGraphic",g);this.set("labelGraphic",y)}this.set("selectedResult",a);this.emit("select-result",{result:a,source:f,sourceIndex:l})},focus:function(){w.focus(this.inputNode)},blur:function(){this.inputNode.blur();w.curNode&&w.curNode.blur()},clearGraphics:function(){var a=this.highlightGraphic,b=this.graphicsLayer,c=this.labelGraphic;a&&(b?b.remove(a):this.map&&this.map.graphics&&this.map.graphics.remove(a));c&&(b?b.remove(c):this.map&&this.map.graphics&&
this.map.graphics.remove(c));this.set("labelGraphic",null);this.set("highlightGraphic",null)},_mapLoaded:function(){var a=new e;if(this.map)if(this.map.loaded)a.resolve();else r.once(this.map,"load",d.hitch(this,function(){a.resolve()}));else a.resolve();return a.promise},_init:function(){this._getMapLayers().then(d.hitch(this,function(){this.set("loaded",!0);this.emit("load")}))},_clearButton:function(){this.clear();w.focus(this.inputNode)},_error:function(a){return Error(this.declaredClass+" "+
a)},_searchDeferred:function(a){var b=new e,c=this.value,f=this.activeSourceIndex;a&&a.hasOwnProperty("index")&&(f=a.index);this._showLoading();this._hideMenus();this._closePopup();this.clearGraphics();var g={magicKey:this.magicKey,text:c};a?"string"===typeof a?(g.text=a,a=this._searchQueries(g)):a="object"===typeof a&&a.hasOwnProperty("magicKey")?this._searchQueries(a):"object"===typeof a&&a.hasOwnProperty("geometry")?this._searchQueries({geometry:a}):"object"===typeof a&&a.hasOwnProperty(this._objectIdIdentifier)?
this._searchQueries(a):"object"===typeof a&&"point"===a.type?this._searchQueries({point:a}):a instanceof Array&&2===a.length?this._searchQueries({latlon:a}):this._searchQueries(g):a=this._searchQueries(g);a.always(d.hitch(this,function(a){a=this._formatResults(a,f,c);b.resolve(a)}));return b.promise},_suggestDeferred:function(a){var b=new e;this._deferreds.push(b);a||(a=this.value);var c=this.activeSourceIndex;this._suggestQueries({text:a}).always(d.hitch(this,function(f){var d;if(f)for(var g=0;g<
f.length;g++)f[g]&&(d=!0);d?(f=this._formatResults(f,c,a),b.resolve(f)):b.resolve()}));return b.promise},_getDefaultSymbol:function(a){var b,c,f,d;this.map&&(d=this.map.getBasemap());d||(d="topo");a&&a.feature&&a.feature.geometry&&(f=a.feature.geometry.type);"polyline"===f?f="line":"circle"===f||"extent"===f?f="polygon":"multipoint"===f&&(f="point");if(f){if(a=Y.getSchemes({theme:"default",basemap:d,geometryType:f}))c=a.primaryScheme;if(c){c.color&&c.hasOwnProperty("opacity")&&(c.color.a=c.opacity);
b=c;a=c.color;c=c.size;var g;switch(f){case "point":g=new X;g.setColor(a);g.setSize(null!==c?c:b.size);f=new P;f.setColor(b.outline.color);f.setWidth(b.outline.width);g.setOutline(f);break;case "line":g=new P;g.setColor(a);g.setWidth(null!==c?c:b.width);break;case "polygon":g=new N,g.setColor(a),f=new P,f.setColor(b.outline.color),f.setWidth(b.outline.width),g.setOutline(f)}b=g}}return b},_selectFirstResult:function(a,b){if(this.autoSelect&&a){var c;b===this._allIndex?c=this._getFirstResult(a):a[b]&&
a[b][0]&&(c=a[b][0]);c&&this.select(c)}},_getSourceIndexOfResult:function(a){var b=this.searchResults;if(b)for(var c in b)if(b[c]&&b[c].length)for(var f=0;f<b[c].length;f++)if(b[c][f]===a)return parseInt(c,10);return null},_getFirstResult:function(a){if(a)for(var b in a)if(a[b]&&a[b][0])return a[b][0];return!1},_onFocus:function(){this.map&&"function"===typeof this.map.disableKeyboardNavigation&&this.map.disableKeyboardNavigation();this.emit("focus");this.inherited(arguments)},_onBlur:function(){this._hideMenus();
this.map&&"function"===typeof this.map.enableKeyboardNavigation&&this.map.enableKeyboardNavigation();this.enableButtonMode&&this.loaded&&this.collapse();this.emit("blur");this.inherited(arguments)},_getMapLayers:function(){var a=new e;if(this.addLayersFromMap&&this.map){var b=[],c=this.map.graphicsLayerIds;if(c&&c.length){for(var f=0;f<c.length;f++){var g=this.map.getLayer(c[f]);g&&b.push(this._featureLayerLoaded(g))}K(b).always(d.hitch(this,function(b){for(var c,f=this.sources,d=0;d<b.length;d++)b[d]&&
b[d].loaded&&"Feature Layer"===b[d].type&&(f.push({featureLayer:b[d],enableSuggestions:!0}),c=!0);c&&this.set("sources",f);a.resolve()}))}else a.resolve()}else a.resolve();return a.promise},_switchCoordinatesClick:function(a){a.preventDefault();if(a=x.get(a.target,"data-switch-coordinates"))this._cancelSuggest(),this.set("value",a),this.search()},_moreResultsClick:function(a){a.preventDefault();var b=a.target;a=parseInt(x.get(b,"data-source-index"),10);var b=parseInt(x.get(b,"data-index"),10),c=this.searchResults;
c&&c[a]&&(a=c[a][b])&&this.select(a)},_showMoreResultsClick:function(a){a.preventDefault();if(a=u.byId(this._moreResultsId)){b.toggle(a,this.css.searchShowMoreResults);var c=u.byId(this._moreResultsId+"_show");c&&(b.contains(a,this.css.searchShowMoreResults)?x.set(c,"textContent",l.widgets.Search.main.hideMoreResults):x.set(c,"textContent",l.widgets.Search.main.showMoreResults))}},_featureLayerLoaded:function(a){var b=new e;if(a.loaded)b.resolve(a);else if(a.loadError)b.reject(this._error("Layer failed to load."));
else{var c,f;c=r.once(a,"load",d.hitch(this,function(){f.remove();b.resolve(a)}));f=r.once(a,"error",d.hitch(this,function(){c.remove();b.reject(this._error("Layer could not be loaded."))}))}return b.promise},_getObjectSize:function(a){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b},_sourcesEvent:function(a,b){var f=x.get(b,"data-index"),d=c("li",this.sourcesNode),g=v.indexOf(d,b);f!==this._allIndex&&(f=parseInt(f,10));"click"===a.type||a.keyCode===k.ENTER?(this.set("activeSourceIndex",f),
w.focus(this.inputNode),this._hideSourcesMenu()):a.keyCode===k.UP_ARROW?(a.stopPropagation(),a.preventDefault(),f=g-1,0>f?w.focus(this.sourcesBtnNode):w.focus(d[f])):a.keyCode===k.DOWN_ARROW?(a.stopPropagation(),a.preventDefault(),f=g+1,f>=d.length?w.focus(this.sourcesBtnNode):w.focus(d[f])):a.keyCode===k.ESCAPE&&(this._hideSourcesMenu(),w.focus(this.inputNode))},_suggestionsEvent:function(a,b){var f=x.get(b,"data-source-index"),d=parseInt(x.get(b,"data-index"),10),g=c("li",this.suggestionsNode),
l=this.sources,h=v.indexOf(g,b);f!==this._allIndex&&(f=parseInt(f,10));var e;this._clearQueryTimeout();"click"===a.type||a.keyCode===k.ENTER?((g=this.suggestResults)&&g[f]&&g[f][d]&&(e=g[f][d]),e&&(e.index=f,l[f].featureLayer?(f=l[f].featureLayer.objectIdField,e[this._objectIdIdentifier]=e.feature.attributes[f],this.set("value",this._getSuggestionName(e)),this.set("selectedFeatureId",e.feature.attributes[f])):e.magicKey&&e.text&&(this.set("value",e.text),this.set("magicKey",e.magicKey)),this.search(e),
w.focus(this.inputNode))):a.keyCode===k.BACKSPACE||a.keyCode===k.DELETE?w.focus(this.inputNode):a.keyCode===k.UP_ARROW?(a.stopPropagation(),a.preventDefault(),e=h-1,0>e?w.focus(this.inputNode):w.focus(g[e])):a.keyCode===k.DOWN_ARROW?(a.stopPropagation(),a.preventDefault(),e=h+1,e>=g.length?w.focus(this.inputNode):w.focus(g[e])):a.keyCode===k.ESCAPE&&(this._hideMenus(),w.focus(this.inputNode))},_getResultName:function(a){var b;a.hasOwnProperty("name")&&null!==a.name&&(b=a.name.toString());b||(b=l.widgets.Search.main.untitledResult);
return b},_getSuggestionName:function(a){var b;a.hasOwnProperty("name")&&null!==a.name&&(b=a.name.toString());a=a.text||b;a||(a=l.widgets.Search.main.untitledResult);return a},_searchResultHTML:function(a){var b="";if(a.feature&&a.feature.attributes&&a.feature.attributes.Addr_type&&"LatLong"===a.feature.attributes.Addr_type){var c=a.name.split(" "),f,d;2===c.length&&(f=c[0],d=c[1]);d&&f?(a=parseFloat(f),d=parseFloat(d),c=d+", "+a,b+='\x3cdiv class\x3d"'+this.css.searchMoreResultsItem+'"\x3e',b+='\x3cdiv class\x3d"'+
this.css.latLonHeader+'"\x3e'+l.widgets.Search.main.lonlat+"\x3c/div\x3e",b=b+(a+", "+d)+"\x3c/div\x3e"+('\x3cdiv class\x3d"'+this.css.searchMoreResultsItem+'"\x3e'),a===d||90<a||-90>a||180<d||-180>d||(b+='\x3cdiv class\x3d"'+this.css.latLonHeader+'"\x3e'+l.widgets.Search.main.reverseLonLatHeader+"\x3c/div\x3e",b=b+('\x3ca data-switch-coordinates\x3d"'+c+'" tabindex\x3d"0" href\x3d"#"\x3e'+c+"\x3c/a\x3e")+"\x3c/div\x3e")):b=a.name}else b=a.name;return b},_moreResultsHTML:function(a){var b="",c="",
f=this.searchResults,d=this.sources,g=0;if(f){var c=c+('\x3cdiv class\x3d"'+this.css.searchMoreResultsItem+'"\x3e'),c=c+('\x3ca href\x3d"#" id\x3d"'+this._moreResultsId+'_show"\x3e'+l.widgets.Search.main.showMoreResults+"\x3c/a\x3e"),c=c+"\x3c/div\x3e"+('\x3cdiv class\x3d"'+this.css.searchMoreResultsList+'"\x3e'),c=c+('\x3cdiv id\x3d"'+this._moreResultsId+'_list"\x3e'),w;for(w in f)if(f[w]){var h=f[w].length;if(h){var e=1===h&&f[w][0]===a;if(1<this._getObjectSize(f)&&!e)var u=this._getSourceName(w),
c=c+('\x3cdiv class\x3d"'+this.css.searchMoreResultsListHeader+'"\x3e'+u+"\x3c/div\x3e");if(h&&!e){c+="\x3cul\x3e";u=d[w].maxResults||this.maxResults;for(e=0;e<h&&e<u;++e)if(f[w][e]!==a){var x=this._getResultName(f[w][e]),c=c+('\x3cli\x3e\x3ca tabindex\x3d"0" data-index\x3d"'+e+'" data-source-index\x3d"'+w+'" href\x3d"#"\x3e'+x+"\x3c/a\x3e\x3c/li\x3e");g++}c+="\x3c/ul\x3e"}}}c+="\x3c/div\x3e\x3c/div\x3e"}g&&(b+=c);return b},_validField:function(a,b){return a.getField(b)},_validFields:function(a,b){if(a&&
b&&b.length){for(var c=0;c<b.length;c++)if(!this._validField(a,b[c]))return!1;return!0}return!1},_getCodedName:function(a,b){if(a&&a.length)for(var c=0,f=a.length;c<f;c++){var d=a[c];if(d.code===b)return d.name}},_getCodedValue:function(a,b,c){if(a&&a.length)for(var f=0,d=a.length;f<d;f++){var g=a[f],l=g.name,w=b;c||(l=l.toLowerCase(),w=w.toLowerCase());if(l===w)return g.code}return!1},_whereClause:function(a,b,c,f){var d=null;if(a){var g="";this.reHostedFS.test(b.url)&&this._containsNonLatinCharacter(a)&&
(g="N");if(c&&c.length)for(var l=0,w=c.length;l<w;l++){var h="",e=a.replace(/\'/g,"''"),h=c[l],u=b.getField(h),x=b.getDomain(h);x&&"codedValue"===x.type&&(e=this._getCodedValue(x.codedValues,e,f));!1!==e&&(u=u.type,"esriFieldTypeString"===u||"esriFieldTypeDate"===u?h=f?h+" \x3d "+g+"'"+e+"'":"UPPER("+h+") LIKE "+g+"'%"+e.toUpperCase()+"%'":"esriFieldTypeOID"===u||"esriFieldTypeSmallInteger"===u||"esriFieldTypeInteger"===u||"esriFieldTypeSingle"===u||"esriFieldTypeDouble"===u?(e=parseFloat(e),h=isNaN(e)?
!1:h+" \x3d "+e):h=h+" \x3d "+e,h&&(d=d?d+" or ":"",d+=h))}}return d},_suggest:function(a){a||(a={index:this.activeSourceIndex,text:this.value});var b=new e,c=a.index,f=this.sources[c],g=this.enableSuggestions;f.hasOwnProperty("enableSuggestions")&&(g=f.enableSuggestions);var l=0,w;a.hasOwnProperty("text")&&a.text&&(w=d.trim(a.text),l=a.text.length);a=f.minCharacters||this.minCharacters;if(g&&w&&l>=a&&this._supportsPagination(f)){var h="";f.prefix&&(h+=f.prefix);h+=w;f.suffix&&(h+=f.suffix);var u=
this._defaultSR;this.map&&(u=this.map.spatialReference);g={};f.locator?(f.categories&&(g.categories=f.categories),f.locator.outSpatialReference=u,this.map&&f.localSearchOptions&&f.localSearchOptions.hasOwnProperty("distance")&&f.localSearchOptions.hasOwnProperty("minScale")&&(l=this._getScale(),!f.localSearchOptions.minScale||l&&l<=parseFloat(f.localSearchOptions.minScale))&&(g.location=this.map.extent.getCenter(),g.distance=f.localSearchOptions.distance),g.text=h,f.useMapExtent&&this.map&&this.map.extent&&
(g.searchExtent=this.map.extent),f.searchExtent&&(g.searchExtent=f.searchExtent),g.maxSuggestions=f.maxSuggestions||this.maxSuggestions,f.sourceCountry&&(g.countryCode=f.sourceCountry),f.countryCode&&(g.countryCode=f.countryCode),f.locator.suggestLocations(g).then(d.hitch(this,function(a){b.resolve(a)}),d.hitch(this,function(a){a||(a=this._error("Locator suggestLocations could not be performed."));b.reject(a)}))):f.featureLayer?this._featureLayerLoaded(f.featureLayer).then(d.hitch(this,function(){var a=
this._getDisplayField(f),g=f.searchFields||[a],l=[];f.suggestionTemplate?f.suggestionTemplate.replace(/(?:\$\{([^}]+)\})/g,function(a,b){l.push(b)}):l=[a];-1===v.indexOf(l,f.featureLayer.objectIdField)&&l.push(f.featureLayer.objectIdField);var a=this._validField(f.featureLayer,a),w=this._validFields(f.featureLayer,l),e=this._validFields(f.featureLayer,g);if(a&&w&&e){a=new T;f.hasOwnProperty("suggestQueryParams")&&d.mixin(a,f.suggestQueryParams);a.outSpatialReference=u;a.returnGeometry=!1;a.num=f.maxSuggestions||
this.maxSuggestions;a.outFields=l;f.useMapExtent&&this.map&&this.map.extent&&(a.geometry=this.map.extent);f.searchExtent&&(a.geometry=f.searchExtent);var x;if(g=this._whereClause(h,f.featureLayer,g,!1))a.where=g,x=!0;x?f.featureLayer.queryFeatures(a,d.hitch(this,function(a){var f;(a=a.features)&&(f=this._hydrateResults(a,c,!0));b.resolve(f)}),d.hitch(this,function(a){a||(a=this._error("FeatureLayer queryFeatures errored with suggestions"));b.reject(a)})):b.resolve()}else b.reject(this._error("Invalid FeatureLayer field"))})):
b.reject(this._error("Invalid source"))}else b.resolve();return b.promise},_supportsPagination:function(a){var b;a.locator?b=!0:a.featureLayer&&a.featureLayer.advancedQueryCapabilities&&a.featureLayer.advancedQueryCapabilities.supportsPagination&&(b=!0);return b},_suggestQueries:function(a){var b=this.sources,c=this.activeSourceIndex,f=[],d;if(c===this._allIndex)for(c=0;c<b.length;c++)d=a,d.index=c,d=this._suggest(d),f.push(d);else a.index=c,d=this._suggest(a),f.push(d);return K(f)},_getPointFromGeometry:function(a){var b;
switch(a.type){case "extent":b=a.getCenter();break;case "multipoint":b=a.getPoint(0);break;case "point":b=a;break;case "polygon":b=a.getCentroid();break;case "polyline":b=a.getPoint(0,0)}return b},_searchQueries:function(a){a.hasOwnProperty("index")||(a.index=this.activeSourceIndex);var b=[],c;if(a.index===this._allIndex)for(var f=this.sources,d=0;d<f.length;d++)c=a,c.index=d,c=this._search(c),b.push(c);else a=this._search(a),b.push(a);return K(b)},_searchButton:function(){this.enableButtonMode&&
!this.expanded?(this.expand(),w.focus(this.inputNode)):(this._cancelSuggest(),this.search())},_search:function(a){a||(a={text:this.value,magicKey:null,geometry:null,point:null,index:this.activeSourceIndex,latlon:null});this.selectedFeatureId&&(a.text=null,a[this._objectIdIdentifier]=this.selectedFeatureId);var b,c=new e,f=a.index,g=this.sources[f],l;a.hasOwnProperty("text")&&a.text&&(l=d.trim(a.text));if(g){var w="";g.prefix&&!a.magicKey&&(w+=g.prefix);w+=l;g.suffix&&!a.magicKey&&(w+=g.suffix);var h=
this._defaultSR;this.map&&(h=this.map.spatialReference);if(g.locator)if(a.hasOwnProperty("text")&&l){var u={};g.categories&&(u.categories=g.categories);h&&(g.locator.outSpatialReference=h);if(this.map&&g.localSearchOptions&&g.localSearchOptions.hasOwnProperty("distance")&&g.localSearchOptions.hasOwnProperty("minScale")){var x=this._getScale();if(!g.localSearchOptions.minScale||x&&x<=parseFloat(g.localSearchOptions.minScale))u.location=this.map.extent.getCenter(),u.distance=g.localSearchOptions.distance}u.address=
{};u.maxLocations=g.maxResults||this.maxResults;g.useMapExtent&&this.map&&this.map.extent&&(u.searchExtent=this.map.extent);g.searchExtent&&(u.searchExtent=g.searchExtent);g.sourceCountry&&(u.countryCode=g.sourceCountry);g.countryCode&&(u.countryCode=g.countryCode);a.magicKey&&(u.magicKey=a.magicKey);g.singleLineFieldName?u.address[g.singleLineFieldName]=w:u.address["Single Line Input"]=w;g.outFields&&(u.outFields=g.outFields);g.locator.addressToLocations(u).then(d.hitch(this,function(a){a=this._hydrateResults(a,
f,!1);c.resolve(a)}),d.hitch(this,function(a){a||(a=this._error("Locator addressToLocations could not be performed"));c.reject(a)}))}else a.geometry?(b=this._getPointFromGeometry(a.geometry.geometry))?this._reverseGeocodePoint(f,b).then(function(a){c.resolve(a)},function(a){c.reject(a)}):c.reject(this._error("Invalid point to reverse geocode")):a.point?this._reverseGeocodePoint(f,a.point).then(function(a){c.resolve(a)},function(a){c.reject(a)}):a.latlon?(u=new Q(a.latlon,this._defaultSR),this._reverseGeocodePoint(f,
u).then(function(a){c.resolve(a)},function(a){c.reject(a)})):a.hasOwnProperty("text")&&!l?c.resolve([]):c.reject(this._error("Invalid query type for Locator"));else g.featureLayer?this._featureLayerLoaded(g.featureLayer).then(d.hitch(this,function(){var e=this._getDisplayField(g),u=g.searchFields||[e],e=this._validField(g.featureLayer,e),x=this._validFields(g.featureLayer,u);if(e&&x){e=new T;g.hasOwnProperty("searchQueryParams")&&d.mixin(e,g.searchQueryParams);h&&(e.outSpatialReference=h,x=this.map&&
this.map.getMaxResolution()||1/ba.getUnitValueForSR(h))&&(e.maxAllowableOffset=x);e.returnGeometry=!0;g.outFields&&(e.outFields=g.outFields);var q;a.hasOwnProperty(this._objectIdIdentifier)||(this._supportsPagination(g)&&(e.num=g.maxResults||this.maxResults),g.useMapExtent&&this.map&&this.map.extent&&(e.geometry=this.map.extent),g.searchExtent&&(e.geometry=g.searchExtent),q=g.exactMatch);a.hasOwnProperty("text")&&l?(u=this._whereClause(w,g.featureLayer,u,q))?(e.where=u,u=!0):u=!1:a.hasOwnProperty(this._objectIdIdentifier)?
(e.objectIds=[a[this._objectIdIdentifier]],u=!0):a.geometry?(e.geometry=a.geometry,u=!0):a.point?(e.geometry=a.point,u=!0):a.latlon?(b=new Q(a.latlon,this._defaultSR),e.geometry=b,u=!0):(a.hasOwnProperty("text")&&!l?c.resolve([]):c.reject(this._error("Invalid query type for FeatureLayer")),u=!1);u?g.featureLayer.queryFeatures(e,d.hitch(this,function(a){a=a.features;var b;a&&(b=this._hydrateResults(a,f,!1));c.resolve(b)}),d.hitch(this,function(a){a||(a=this._error("FeatureLayer queryFeatures could not be performed"));
c.reject(a)})):c.resolve()}else c.reject(this._error("Invalid FeatureLayer field"))})):c.reject(this._error("Invalid source"))}else c.reject(this._error("Source is undefined"));return c.promise},_clearQueryTimeout:function(){this._queryTimer&&clearTimeout(this._queryTimer)},_formatResults:function(a,b,c){c={activeSourceIndex:b,value:c,numResults:0,numErrors:0,errors:null,results:null};var f={},g={};if(a)if(b===this._allIndex)for(b=0;b<a.length;b++)a[b]&&(a[b]instanceof Error?(f[b]=a[b],c.numErrors++):
(g[b]=a[b],c.numResults+=a[b].length));else a[0]&&(a[0]instanceof Error?(f[b]=a[0],c.numErrors++):(g[b]=a[0],c.numResults+=a[0].length));c.numErrors&&(c.errors=f);c.numResults&&(c.results=g);return c},_reverseGeocodePoint:function(a,b){var c=new e,f=this.sources[a];if(b&&f){var g=f.locationToAddressDistance||this.locationToAddressDistance;f.locator.outSpatialReference=this._defaultSR;this.map&&(f.locator.outSpatialReference=this.map.spatialReference);f.locator.locationToAddress(b,g,d.hitch(this,function(b){b=
this._hydrateResults([b],a,!1);c.resolve(b)}),d.hitch(this,function(a){a||(a=this._error("Locator locationToAddress could not be performed"));c.reject(a)}))}else c.reject(this._error("No point or source defined for reverse geocoding"));return c.promise},_cancelDeferreds:function(){if(this._deferreds&&this._deferreds.length)for(var a=0;a<this._deferreds.length;a++)this._deferreds[a].cancel(this.declaredClass+" cancelling request");this._deferreds=[]},_sourceBtnKey:function(a){if(a){var b=c("li",this.sourcesNode);
a.keyCode===k.UP_ARROW?(a.stopPropagation(),a.preventDefault(),this._showSourcesMenu(),(a=b.length)&&w.focus(b[a-1])):a.keyCode===k.DOWN_ARROW&&(a.stopPropagation(),a.preventDefault(),this._showSourcesMenu(),b[0]&&w.focus(b[0]))}},_inputKey:function(a){if(a){var b=c("li",this.suggestionsNode),f=this.suggestResults;if(a.keyCode===k.TAB||a.keyCode===k.ESCAPE)this._cancelSuggest(),this._hideMenus();else if(a.keyCode===k.UP_ARROW)a.stopPropagation(),a.preventDefault(),this._cancelSuggest(),f&&this._showSuggestionsMenu(),
(a=b.length)&&w.focus(b[a-1]);else if(a.keyCode===k.DOWN_ARROW)a.stopPropagation(),a.preventDefault(),this._cancelSuggest(),f&&this._showSuggestionsMenu(),b[0]&&w.focus(b[0]);else{if(a.ctrlKey||a.metaKey||a.keyCode===k.copyKey||a.keyCode===k.LEFT_ARROW||a.keyCode===k.RIGHT_ARROW||a.keyCode===k.ENTER)return a;this._suggestDelay()}}},_cancelSuggest:function(){this._cancelDeferreds();this._clearQueryTimeout()},_suggestDelay:function(){this._cancelSuggest();this._changeValue();this._queryTimer=setTimeout(d.hitch(this,
function(){this.suggest()}),this.suggestionDelay)},_changeValue:function(){this.set("magicKey",null);this.set("selectedFeatureId",null);this._changeAttrValue("value",this.inputNode.value);this._checkStatus()},_inputClick:function(){this._hideSourcesMenu();this._hideNoResultsMenu()},_getSourceName:function(a){return this._sourceNames[a]},_loadSources:function(a){a=v.filter(a,function(a){return!!a.featureLayer});a=v.map(a,function(a){return this._featureLayerLoaded(a.featureLayer)},this);return K(a)},
_createSourceNameMap:function(a){return this._loadSources(a).then(d.hitch(this,function(){var b=v.map(a,function(a){return a.name||a.featureLayer&&a.featureLayer.name||l.widgets.Search.main.untitledSource});this._preventDuplicateSourceNames(a,b);return b}))},_getDuplicateSourceNameIndexes:function(a){var b={},c=[];v.forEach(a,function(f,g){b.hasOwnProperty(f)?(-1===c.indexOf(b[f])&&c.push(b[f]),c.push(g)):a.lastIndexOf(f)!==g&&(b[f]=g)});return c},_preventDuplicateSourceNames:function(a,b){if(b&&
1<b.length){var c=this._getDuplicateSourceNameIndexes(b);v.forEach(c,function(c){b[c]+=this._getFieldsString(a[c])},this)}},_getFieldsString:function(a){var b="",c=a.featureLayer;if(c){a=a.searchFields||[this._getDisplayField(a)];for(var f=0;f<a.length;f++)var b=0===f?b+": ":b+", ",g=a[f],d=c.getFieldLabel(g),b=b+(d||g)}return b},_splitResult:function(a,b){var c=q.escapeString(b);return a.replace(new RegExp("(^|)("+c+")(|$)","ig"),"$1|$2|$3").split("|")},_insertSuggestions:function(b,c){if(this.enableSuggestionsMenu&&
this.suggestionsNode){this._hideSourcesMenu();this._hideNoResultsMenu();var f,g=this.sources;if(b){f=a.create("div");for(var d in b)if(b[d]&&b[d].length){var l=this._getSourceName(d);1<g.length&&this.activeSourceIndex===this._allIndex&&a.create("div",{className:this.css.searchMenuHeader,textContent:l},f);for(var l=a.create("ul",{role:"menu"},f),w=g[d].maxSuggestions||this.maxSuggestions,e=0;e<b[d].length&&e<w;++e)for(var h=a.create("li",{"data-index":e,"data-source-index":d,role:"menuitem",tabindex:0},
l),u=this._getSuggestionName(b[d][e]),u=this._splitResult(u,c),x=u.length,q=0;q<x;q++){var k=u[q];k.toLowerCase()===c.toLowerCase()?a.create("strong",{textContent:k},h):(k=document.createTextNode(k),a.place(k,h))}}}f?(a.place(f,this.suggestionsNode,"only"),this._showSuggestionsMenu()):(a.empty(this.suggestionsNode),this._hideSuggestionsMenu())}},_insertSources:function(c){if(this.enableSourcesMenu&&c&&1<c.length){var f,g,d=this.activeSourceIndex,w=a.create("ul",{role:"menu"});this.enableSearchingAll&&
(f="",d===this._allIndex&&(f="active"),a.create("li",{"data-index":this._allIndex,role:"menuitem",className:f,tabIndex:0,textContent:l.widgets.Search.main.all},w));for(g=0;g<c.length;g++){f="";g===d&&(f=this.css.activeSource);var e=this._getSourceName(g);a.create("li",{"data-index":g,role:"menuitem",className:f,tabIndex:0,textContent:e},w)}b.add(this.containerNode,this.css.hasMultipleSources);a.place(w,this.sourcesNode,"only")}else b.remove(this.containerNode,this.css.hasMultipleSources),a.empty(this.sourcesNode)},
_showLoading:function(){b.add(this.containerNode,this.css.searchLoading)},_hideLoading:function(){b.remove(this.containerNode,this.css.searchLoading)},_checkStatus:function(){this.value?(b.add(this.containerNode,this.css.hasValue),x.set(this.clearNode,"title",l.widgets.Search.main.clearButtonTitle)):this.clear()},_closePopup:function(){this.enableInfoWindow&&this.map&&this.map.infoWindow&&this.map.infoWindow.hide()},_noResults:function(b){var c;b&&(c=d.trim(b));var f=a.create("div",{className:this.css.searchNoResultsBody});
b&&c?(a.create("div",{className:this.css.searchNoResultsHeader,textContent:l.widgets.Search.main.noResults},f),a.create("div",{className:this.css.searchNoResultsText,textContent:D.substitute({value:'"'+b+'"'},l.widgets.Search.main.noResultsFound)},f)):(b=a.create("div",{},f),a.create("span",{"aria-hidden":"true",className:this.css.searchNoValueIcon},b),a.create("span",{className:this.css.searchNoValueText,textContent:l.widgets.Search.main.emptyValue},b));a.place(f,this.noResultsMenuNode,"only")},
_hideMenus:function(){this._hideSourcesMenu();this._hideSuggestionsMenu();this._hideNoResultsMenu()},_hideNoResultsMenu:function(){b.remove(this.containerNode,this.css.showNoResults)},_showNoResultsMenu:function(){this._hideSourcesMenu();this._hideSuggestionsMenu();b.add(this.containerNode,this.css.showNoResults)},_hideSourcesMenu:function(){b.remove(this.containerNode,this.css.showSources)},_hideSuggestionsMenu:function(){b.remove(this.containerNode,this.css.showSuggestions)},_showSourcesMenu:function(){this._hideSuggestionsMenu();
this._hideNoResultsMenu();b.add(this.containerNode,this.css.showSources)},_showSuggestionsMenu:function(){this._hideSourcesMenu();this._hideNoResultsMenu();b.add(this.containerNode,this.css.showSuggestions)},_toggleSourcesMenu:function(){this._hideSuggestionsMenu();this._hideNoResultsMenu();b.toggle(this.containerNode,this.css.showSources)},_getFirstStringField:function(a){if(a&&(a=a.fields)&&a.length)for(var b=0;b<a.length;b++){var c=a[b];if("esriFieldTypeString"===c.type)return c.name}return""},
_getDisplayField:function(a){return a.displayField||a.featureLayer.displayField||this._getFirstStringField(a.featureLayer)},_validLocation:function(a){return a&&a.x&&"NaN"!==a.x&&a.y&&"NaN"!==a.y},_validExtent:function(a){return a&&a.xmin&&"NaN"!==a.xmin&&a.ymin&&"NaN"!==a.ymin&&a.xmax&&"NaN"!==a.xmax&&a.ymax&&"NaN"!==a.ymax},_hydrateResult:function(a,b,c){var g={},d=this._defaultSR,l;b=this.sources[b];this.map&&(d=this.map.spatialReference);if(a.hasOwnProperty("text")&&a.hasOwnProperty("magicKey"))return a;
if(a.hasOwnProperty("geometry"))l=new J(a.toJson()),g.feature=l,(l=g.feature.geometry)&&l.setSpatialReference(d);else if(a.hasOwnProperty("location")&&this._validLocation(a.location)){var w=new Q(a.location.x,a.location.y,d);l={};a.hasOwnProperty("attributes")&&(l=a.attributes);a.hasOwnProperty("score")&&(l.score=a.score);g.feature=new J(w,null,l,null)}else g.feature=null;if(g.feature){if(a.hasOwnProperty("extent")&&this._validExtent(a.extent))g.extent=new ja(a.extent),g.extent.setSpatialReference(d);
else if(g.feature&&g.feature.geometry)switch(g.feature.geometry.type){case "extent":g.extent=g.feature.geometry;break;case "multipoint":g.extent=V.getDenormalizedExtent(g.feature.geometry);break;case "polygon":g.extent=V.getDenormalizedExtent(g.feature.geometry);break;case "polyline":g.extent=V.getDenormalizedExtent(g.feature.geometry);break;case "point":this.map?(d=this.zoomScale,b&&b.zoomScale&&(d=b.zoomScale),this._getScale()>d?g.extent=ba.getExtentForScale(this.map,d).centerAt(g.feature.geometry):
g.extent=this.map.extent.centerAt(g.feature.geometry)):g.extent=new ja({xmin:g.feature.geometry.x-.25,ymin:g.feature.geometry.y-.25,xmax:g.feature.geometry.x+.25,ymax:g.feature.geometry.y+.25,spatialReference:this._defaultSR})}else g.extent=null;g.name="";b.featureLayer?b.suggestionTemplate&&c?g.name=D.substitute(a.attributes,b.suggestionTemplate):b.searchTemplate?g.name=D.substitute(a.attributes,b.searchTemplate):(l=this._getDisplayField(b),c=b.featureLayer.getField(l),d=b.featureLayer.getDomain(l),
l&&a.hasOwnProperty("attributes")&&a.attributes.hasOwnProperty(l)&&(a=a.attributes[l],d&&"codedValue"===d.type?g.name=this._getCodedName(d.codedValues,a):c&&"esriFieldTypeDate"===c.type&&!isNaN(a)?g.name=f.format(new Date(a)):g.name=a)):a.address&&b.searchTemplate?g.name=D.substitute(a.address,b.searchTemplate):a.hasOwnProperty("name")?g.name=a.name:a.hasOwnProperty("attributes")&&"object"===typeof a.attributes&&a.attributes.Match_addr?(g.name=a.attributes.Match_addr,a.attributes.Addr_type&&"POI"===
a.attributes.Addr_type&&a.attributes.StAddr&&a.attributes.City&&(g.name+=" - "+a.attributes.StAddr+", "+a.attributes.City)):a.hasOwnProperty("address")&&"string"===typeof a.address?g.name=a.address:a.hasOwnProperty("address")&&"object"===typeof a.address&&a.address.hasOwnProperty("Address")?a.address.hasOwnProperty("Match_addr")?g.name=a.address.Match_addr:a.address.hasOwnProperty("Address")&&(g.name=a.address.Address):g.feature&&g.feature.geometry&&(g.name=g.feature.geometry.x+","+g.feature.geometry.y);
b.featureLayer&&g.feature&&da(g.feature,b.featureLayer);return g}},_getScale:function(){var a;this.map&&"function"===typeof this.map.getScale&&(a=this.map.getScale());return a},_hydrateResults:function(a,b,c,f){f=[];var g=0;if(a&&a.length)for(g;g<a.length;g++){var d=this._hydrateResult(a[g],b,c);d&&f.push(d)}return f},_containsNonLatinCharacter:function(a){for(var b=0;b<a.length;b++)if(255<a.charCodeAt(b))return!0;return!1},_setPlaceholder:function(a){var b="",c=this.sources[a];a===this._allIndex?
b=this.allPlaceholder||l.widgets.Search.main.allPlaceholder:c&&c.placeholder&&(b=c.placeholder);var f=l.widgets.Search.main.all;c&&(f=this._getSourceName(a));x.set(this.sourceNameNode,"textContent",f);x.set(this.inputNode,"placeholder",b);x.set(this.inputNode,"title",b)},_updateActiveSource:function(){var a=this.sources,b=this.activeSourceIndex,c;a&&a[b]&&(c=a[b]);c?this.set("activeSource",c):this.set("activeSource",null)},_updateVisible:function(){this.visible?this.show():this.hide()},_updateButtonMode:function(a){a?
(b.toggle(this.containerNode,this.css.searchExpanded,this.expanded),b.toggle(this.containerNode,this.css.searchCollapsed,!this.expanded),b.add(this.containerNode,this.css.hasButtonMode)):(b.remove(this.containerNode,this.css.searchExpanded),b.remove(this.containerNode,this.css.searchCollapsed),b.remove(this.containerNode,this.css.hasButtonMode))},_setDefaultActiveSourceIndex:function(a){a&&1===a.length||!this.enableSearchingAll?this.set("activeSourceIndex",0):this.set("activeSourceIndex",this._allIndex)},
_setEnableSourcesMenuAttr:function(a){this._set("enableSourcesMenu",a);this._created&&this._insertSources(this.sources)},_setEnableSearchingAllAttr:function(a){this._set("enableSearchingAll",a);this._created&&(this._setDefaultActiveSourceIndex(this.sources),this._hideMenus(),this._insertSources(this.sources))},_setSourcesAttr:function(a){this._createSourceNameMap(a).then(d.hitch(this,function(b){this._sourceNames=b;this._created&&(this._setDefaultActiveSourceIndex(a),this._hideMenus(),this._insertSources(a))}));
this._set("sources",a)},_setAllPlaceholderAttr:function(a){this._set("allPlaceholder",a);this._created&&this._setPlaceholder(this.activeSourceIndex)},_setActiveSourceIndexAttr:function(a){this._set("activeSourceIndex",a);this._updateActiveSource();this._created&&(this._setPlaceholder(a),this._hideMenus(),this._insertSources(this.sources))},_setMaxLengthAttr:function(a){this._set("maxLength",a);this._created&&x.set(this.inputNode,"maxLength",a)},_setValueAttr:function(a){this.set("magicKey",null);
this.set("selectedFeatureId",null);this._set("value",a);this._created&&(x.set(this.inputNode,"value",a),this._checkStatus())},_setVisibleAttr:function(a){this._set("visible",a);this._created&&this._updateVisible()},_setEnableButtonModeAttr:function(a){this._set("enableButtonMode",a);this._created&&this._updateButtonMode(a)},_setThemeAttr:function(a){this._created&&(b.remove(this.domNode,this.theme),b.add(this.domNode,a));this._set("theme",a)}});h("extend-esri")&&d.setObject("dijit.Search",n,E);return n})},
"esri/promiseList":function(){define(["dojo/_base/array","dojo/Deferred","dojo/when"],function(m,n,d){var v=m.forEach;return function(t){function e(b,g){c[g]=b;u.progress([b,g]);0===--x&&u.resolve(c)}var k,r;t instanceof Array?r=t:t&&"object"===typeof t&&(k=t);var c,h=[];if(k){r=[];for(var q in k)Object.hasOwnProperty.call(k,q)&&(h.push(q),r.push(k[q]));c={}}else r&&(c=[]);if(!r||!r.length)return(new n).resolve(c);var u=new n;u.promise.always(function(){c=h=null});var x=r.length;v(r,function(b,c){k||
h.push(c);d(b,function(a){u.isFulfilled()||e(a,h[c])},function(a){u.isFulfilled()||e(a,h[c])})});return u.promise}})},"esri/tasks/locator":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/Deferred dojo/_base/json dojo/has ../kernel ../request ../deferredUtils ./Task ./AddressCandidate".split(" "),function(m,n,d,v,t,e,k,r,c,h,q){m=m(h,{declaredClass:"esri.tasks.Locator",_eventMap:{"address-to-locations-complete":["addresses"],"addresses-to-locations-complete":["addresses"],
"location-to-address-complete":["address"],"suggest-locations-complete":["suggestions"]},constructor:function(c){this._geocodeHandler=n.hitch(this,this._geocodeHandler);this._geocodeAddressesHandler=n.hitch(this,this._geocodeAddressesHandler);this._reverseGeocodeHandler=n.hitch(this,this._reverseGeocodeHandler);this.registerConnectEvents()},outSpatialReference:null,setOutSpatialReference:function(c){this.outSpatialReference=c},_geocodeHandler:function(c,d,b,g,a){try{var f=c.candidates,l;d=[];var e,
h=f.length,u=c.spatialReference,x;for(e=0;e<h;e++){l=f[e];if(x=l.location)x.spatialReference=u;d[e]=new q(l)}this._successHandler([d],"onAddressToLocationsComplete",b,a)}catch(z){this._errorHandler(z,g,a)}},_geocodeAddressesHandler:function(c,d,b,g,a){try{var f=c.locations;d=[];var l,e=f.length,h=c.spatialReference,u;for(l=0;l<e;l++){if(u=f[l].location)u.spatialReference=h;d[l]=new q(f[l])}this._successHandler([d],"onAddressesToLocationsComplete",b,a)}catch(A){this._errorHandler(A,g,a)}},addressToLocations:function(d,
e,b,g,a){var f,l,h,u,x,q,k;d.address&&(g=b,b=e,e=d.outFields,a=d.searchExtent,k=d.countryCode,f=d.magicKey,l=d.distance,q=d.categories,d.location&&this.normalization&&(h=d.location.normalize()),u=d.maxLocations,x=d.forStorage,d=d.address);a&&(a=a.shiftCentralMeridian());var w=this.outSpatialReference;d=this._encode(n.mixin({},this._url.query,d,{f:"json",outSR:w&&t.toJson(w.toJson()),outFields:e&&e.join(",")||null,searchExtent:a&&t.toJson(a.toJson()),category:q&&q.join(",")||null,countryCode:k||null,
magicKey:f||null,distance:l||null,location:h||null,maxLocations:u||null,forStorage:x||null}));var D=this._geocodeHandler,C=this._errorHandler,E=new v(c._dfdCanceller);E._pendingDfd=r({url:this._url.path+"/findAddressCandidates",content:d,callbackParamName:"callback",load:function(a,c){D(a,c,b,g,E)},error:function(a){C(a,g,E)}});return E},suggestLocations:function(d){var e;e=new v(c._dfdCanceller);d.hasOwnProperty("location")&&this.normalization&&(d.location=d.location.normalize());d.searchExtent&&
(d.searchExtent=d.searchExtent.shiftCentralMeridian());d=this._encode(n.mixin({},this._url.query,{f:"json",text:d.text,maxSuggestions:d.maxSuggestions,searchExtent:d.searchExtent&&t.toJson(d.searchExtent.toJson()),category:d.categories&&d.categories.join(",")||null,countryCode:d.countryCode||null,location:d.location||null,distance:d.distance||null},{f:"json"}));d=r({url:this._url.path+"/suggest",content:d,callbackParamName:"callback"});e._pendingDfd=d;d.then(n.hitch(this,function(b){b=b.suggestions||
[];this.onSuggestLocationsComplete(b);e.resolve(b)}),n.hitch(this,function(b){this._errorHandler(b);e.reject(b)}));return e},addressesToLocations:function(e,h,b){var g=this.outSpatialReference,a=[],f=e.categories,l=e.countryCode;d.forEach(e.addresses,function(b,c){a.push({attributes:b})});e=this._encode(n.mixin({},this._url.query,{category:f&&f.join(",")||null,sourceCountry:l||null},{addresses:t.toJson({records:a})},{f:"json",outSR:g&&t.toJson(g.toJson())}));var u=this._geocodeAddressesHandler,x=
this._errorHandler,q=new v(c._dfdCanceller);q._pendingDfd=r({url:this._url.path+"/geocodeAddresses",content:e,callbackParamName:"callback",load:function(a,c){u(a,c,h,b,q)},error:function(a){x(a,b,q)}});return q},_reverseGeocodeHandler:function(c,d,b,g,a){try{var f=new q({address:c.address,location:c.location,score:100});this._successHandler([f],"onLocationToAddressComplete",b,a)}catch(l){this._errorHandler(l,g,a)}},locationToAddress:function(d,e,b,g){d&&this.normalization&&(d=d.normalize());var a=
this.outSpatialReference;d=this._encode(n.mixin({},this._url.query,{outSR:a&&t.toJson(a.toJson()),location:d&&t.toJson(d.toJson()),distance:e,f:"json"}));var f=this._reverseGeocodeHandler,l=this._errorHandler,h=new v(c._dfdCanceller);h._pendingDfd=r({url:this._url.path+"/reverseGeocode",content:d,callbackParamName:"callback",load:function(a,c){f(a,c,b,g,h)},error:function(a){l(a,g,h)}});return h},onSuggestLocationsComplete:function(){},onAddressToLocationsComplete:function(){},onAddressesToLocationsComplete:function(){},
onLocationToAddressComplete:function(){}});e("extend-esri")&&n.setObject("tasks.Locator",m,k);return m})},"esri/tasks/Task":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/json dojo/has ../kernel ../deferredUtils ../urlUtils ../Evented".split(" "),function(m,n,d,v,t,e,k,r){m=m(r,{declaredClass:"esri.tasks._Task",_eventMap:{error:["error"],complete:["result"]},constructor:function(c,d){c&&n.isString(c)&&(this._url=k.urlToObject(this.url=c));d&&d.requestOptions&&(this.requestOptions=
d.requestOptions);this.normalization=!0;this._errorHandler=n.hitch(this,this._errorHandler);this.registerConnectEvents()},_useSSL:function(){var c=this._url,d=/^http:/i;this.url&&(this.url=this.url.replace(d,"https:"));c&&c.path&&(c.path=c.path.replace(d,"https:"))},_encode:function(c,e,q){var h,x,b={},g,a;for(g in c)if("declaredClass"!==g&&(h=c[g],x=typeof h,null!==h&&void 0!==h&&"function"!==x))if(n.isArray(h))for(b[g]=[],a=h.length,x=0;x<a;x++)b[g][x]=this._encode(h[x]);else"object"===x?h.toJson&&
(x=h.toJson(q&&q[g]),"esri.tasks.FeatureSet"===h.declaredClass&&x.spatialReference&&(x.sr=x.spatialReference,delete x.spatialReference),b[g]=e?x:d.toJson(x)):b[g]=h;return b},_successHandler:function(c,d,q,u){d&&this[d].apply(this,c);q&&q.apply(null,c);u&&e._resDfd(u,c)},_errorHandler:function(c,d,e){this.onError(c);d&&d(c);e&&e.errback(c)},setNormalization:function(c){this.normalization=c},onError:function(){}});v("extend-esri")&&(t.Task=m);return m})},"esri/tasks/AddressCandidate":function(){define(["dojo/_base/declare",
"dojo/_base/lang","dojo/has","../kernel","../geometry/Point"],function(m,n,d,v,t){m=m(null,{declaredClass:"esri.tasks.AddressCandidate",constructor:function(d){n.mixin(this,d);this.location=new t(this.location)}});d("extend-esri")&&n.setObject("tasks.AddressCandidate",m,v);return m})},"esri/styles/basic":function(){define(["dojo/_base/array","dojo/_base/lang","dojo/has","../kernel","../Color"],function(m,n,d,v,t){function e(c,d){var e;if(c)switch(e={},e.color=new t(c.color),e.opacity=c.opacity||1,
d){case "point":e.outline={color:new t(c.outline.color),width:c.outline.width};e.size=c.size;break;case "line":e.width=c.width;break;case "polygon":e.outline={color:new t(c.outline.color),width:c.outline.width}}return e}function k(c){if("esriGeometryPoint"===c||"esriGeometryMultipoint"===c)c="point";else if("esriGeometryPolyline"===c)c="line";else if("esriGeometryPolygon"===c||"esriGeometryMultiPatch"===c)c="polygon";return c}var r={"default":{name:"default",label:"Default",description:"Default theme for basic visualization of features.",
basemapGroups:{light:"streets gray topo terrain national-geographic oceans osm gray-vector streets-vector topo-vector streets-relief-vector streets-navigation-vector".split(" "),dark:["satellite","hybrid","dark-gray","dark-gray-vector","streets-night-vector"]},pointSchemes:{light:{primary:{color:[77,77,77,1],outline:{color:[255,255,255,1],width:1},size:8},secondary:[{color:[226,119,40,1],outline:{color:[255,255,255,1],width:1},size:8},{color:[255,255,255,1],outline:{color:[51,51,51,1],width:1},size:8}]},
dark:{primary:{color:[255,255,255,1],outline:{color:[26,26,26,1],width:1},size:8},secondary:[{color:[226,119,40,1],outline:{color:[255,255,255,1],width:1},size:8},{color:[26,26,26,1],outline:{color:[178,178,178,1],width:1},size:8}]}},lineSchemes:{light:{primary:{color:[77,77,77,1],width:2},secondary:[{color:[226,119,40,1],width:2},{color:[255,255,255,1],width:2}]},dark:{primary:{color:[255,255,255,1],width:2},secondary:[{color:[226,119,40,1],width:2},{color:[26,26,26,1],width:2}]}},polygonSchemes:{light:{primary:{color:[227,
139,79,1],outline:{color:[255,255,255,1],width:1},opacity:.8},secondary:[{color:[128,128,128,1],outline:{color:[255,255,255,1],width:1},opacity:.8},{color:[255,255,255,1],outline:{color:[128,128,128,1],width:1},opacity:.8}]},dark:{primary:{color:[227,139,79,1],outline:{color:[51,51,51,1],width:1},opacity:.8},secondary:[{color:[178,178,178,1],outline:{color:[51,51,51,1],width:1},opacity:.8},{color:[26,26,26,1],outline:{color:[128,128,128,1],width:1},opacity:.8}]}}}},c={};(function(){var d,e,h,b,g,
a,f,l;for(d in r)for(b in e=r[d],h=e.basemapGroups,g=c[d]={basemaps:[].concat(h.light).concat(h.dark),point:{},line:{},polygon:{}},h)for(a=h[b],f=0;f<a.length;f++)l=a[f],e.pointSchemes&&(g.point[l]=e.pointSchemes[b]),e.lineSchemes&&(g.line[l]=e.lineSchemes[b]),e.polygonSchemes&&(g.polygon[l]=e.polygonSchemes[b])})();var h={getAvailableThemes:function(d){var e=[],h,b,g;for(h in r)b=r[h],g=c[h],d&&-1===m.indexOf(g.basemaps,d)||e.push({name:b.name,label:b.label,description:b.description,basemaps:g.basemaps.slice(0)});
return e},getSchemes:function(d){var h=d.theme,x=d.basemap,b=k(d.geometryType);d=c[h];var g;(d=(d=d&&d[b])&&d[x])&&(g={primaryScheme:e(d.primary,b),secondarySchemes:m.map(d.secondary,function(a){return e(a,b)})});return g},cloneScheme:function(c){var d;c&&(d=n.mixin({},c),d.color&&(d.color=new t(d.color)),d.outline&&(d.outline={color:d.outline.color&&new t(d.outline.color),width:d.outline.width}));return d}};d("extend-esri")&&n.setObject("styles.basic",h,v);return h})},"dojo/dnd/Source":function(){define("../_base/array ../_base/declare ../_base/kernel ../_base/lang ../dom-class ../dom-geometry ../mouse ../ready ../topic ./common ./Selector ./Manager".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u){d.isAsync||r(0,function(){require(["dojo/dnd/AutoSource","dojo/dnd/Target"])});var x=n("dojo.dnd.Source",q,{isSource:!0,horizontal:!1,copyOnly:!1,selfCopy:!1,selfAccept:!0,skipForm:!1,withHandles:!1,autoSync:!1,delay:0,accept:["text"],generateText:!0,constructor:function(b,d){v.mixin(this,v.mixin({},d));var a=this.accept;if(a.length){this.accept={};for(var f=0;f<a.length;++f)this.accept[a[f]]=1}this.mouseDown=this.isDragging=!1;this.targetBox=this.targetAnchor=null;
this.before=!0;this._lastY=this._lastX=0;this.sourceState="";this.isSource&&t.add(this.node,"dojoDndSource");this.targetState="";this.accept&&t.add(this.node,"dojoDndTarget");this.horizontal&&t.add(this.node,"dojoDndHorizontal");this.topics=[c.subscribe("/dnd/source/over",v.hitch(this,"onDndSourceOver")),c.subscribe("/dnd/start",v.hitch(this,"onDndStart")),c.subscribe("/dnd/drop",v.hitch(this,"onDndDrop")),c.subscribe("/dnd/cancel",v.hitch(this,"onDndCancel"))]},checkAcceptance:function(b,c){if(this==
b)return!this.copyOnly||this.selfAccept;for(var a=0;a<c.length;++a){for(var f=b.getItem(c[a].id).type,d=!1,g=0;g<f.length;++g)if(f[g]in this.accept){d=!0;break}if(!d)return!1}return!0},copyState:function(b,c){if(b)return!0;2>arguments.length&&(c=this==u.manager().target);if(c){if(this.copyOnly)return this.selfCopy}else return this.copyOnly;return!1},destroy:function(){x.superclass.destroy.call(this);m.forEach(this.topics,function(b){b.remove()});this.targetAnchor=null},onMouseMove:function(b){if(!this.isDragging||
"Disabled"!=this.targetState){x.superclass.onMouseMove.call(this,b);var c=u.manager();if(!this.isDragging&&this.mouseDown&&this.isSource&&(Math.abs(b.pageX-this._lastX)>this.delay||Math.abs(b.pageY-this._lastY)>this.delay)){var a=this.getSelectedNodes();a.length&&c.startDrag(this,a,this.copyState(h.getCopyKeyState(b),!0))}this.isDragging&&(a=!1,this.current&&(this.targetBox&&this.targetAnchor==this.current||(this.targetBox=e.position(this.current,!0)),a=this.horizontal?b.pageX-this.targetBox.x<this.targetBox.w/
2==e.isBodyLtr(this.current.ownerDocument):b.pageY-this.targetBox.y<this.targetBox.h/2),this.current!=this.targetAnchor||a!=this.before)&&(this._markTargetAnchor(a),c.canDrop(!this.current||c.source!=this||!(this.current.id in this.selection)))}},onMouseDown:function(b){this.mouseDown||!this._legalMouseDown(b)||this.skipForm&&h.isFormElement(b)||(this.mouseDown=!0,this._lastX=b.pageX,this._lastY=b.pageY,x.superclass.onMouseDown.call(this,b))},onMouseUp:function(b){this.mouseDown&&(this.mouseDown=
!1,x.superclass.onMouseUp.call(this,b))},onDndSourceOver:function(b){this!==b?(this.mouseDown=!1,this.targetAnchor&&this._unmarkTargetAnchor()):this.isDragging&&(b=u.manager(),b.canDrop("Disabled"!=this.targetState&&(!this.current||b.source!=this||!(this.current.id in this.selection))))},onDndStart:function(b,c,a){this.autoSync&&this.sync();this.isSource&&this._changeState("Source",this==b?a?"Copied":"Moved":"");c=this.accept&&this.checkAcceptance(b,c);this._changeState("Target",c?"":"Disabled");
this==b&&u.manager().overSource(this);this.isDragging=!0},onDndDrop:function(b,c,a,f){if(this==f)this.onDrop(b,c,a);this.onDndCancel()},onDndCancel:function(){this.targetAnchor&&(this._unmarkTargetAnchor(),this.targetAnchor=null);this.before=!0;this.mouseDown=this.isDragging=!1;this._changeState("Source","");this._changeState("Target","")},onDrop:function(b,c,a){if(this!=b)this.onDropExternal(b,c,a);else this.onDropInternal(c,a)},onDropExternal:function(b,c,a){var f=this._normalizedCreator;this._normalizedCreator=
this.creator?function(a,c){return f.call(this,b.getItem(a.id).data,c)}:a?function(a){var c=b.getItem(a.id);a=a.cloneNode(!0);a.id=h.getUniqueId();return{node:a,data:c.data,type:c.type}}:function(a){var c=b.getItem(a.id);b.delItem(a.id);return{node:a,data:c.data,type:c.type}};this.selectNone();a||this.creator||b.selectNone();this.insertNodes(!0,c,this.before,this.current);!a&&this.creator&&b.deleteSelectedNodes();this._normalizedCreator=f},onDropInternal:function(b,c){var a=this._normalizedCreator;
if(!(this.current&&this.current.id in this.selection)){if(c)this._normalizedCreator=this.creator?function(b,c){return a.call(this,this.getItem(b.id).data,c)}:function(a){var b=this.getItem(a.id);a=a.cloneNode(!0);a.id=h.getUniqueId();return{node:a,data:b.data,type:b.type}};else{if(!this.current)return;this._normalizedCreator=function(a){var b=this.getItem(a.id);return{node:a,data:b.data,type:b.type}}}this._removeSelection();this.insertNodes(!0,b,this.before,this.current);this._normalizedCreator=a}},
onDraggingOver:function(){},onDraggingOut:function(){},onOverEvent:function(){x.superclass.onOverEvent.call(this);u.manager().overSource(this);if(this.isDragging&&"Disabled"!=this.targetState)this.onDraggingOver()},onOutEvent:function(){x.superclass.onOutEvent.call(this);u.manager().outSource(this);if(this.isDragging&&"Disabled"!=this.targetState)this.onDraggingOut()},_markTargetAnchor:function(b){if(this.current!=this.targetAnchor||this.before!=b)this.targetAnchor&&this._removeItemClass(this.targetAnchor,
this.before?"Before":"After"),this.targetAnchor=this.current,this.targetBox=null,this.before=b,this.targetAnchor&&this._addItemClass(this.targetAnchor,this.before?"Before":"After")},_unmarkTargetAnchor:function(){this.targetAnchor&&(this._removeItemClass(this.targetAnchor,this.before?"Before":"After"),this.targetBox=this.targetAnchor=null,this.before=!0)},_markDndStatus:function(b){this._changeState("Source",b?"Copied":"Moved")},_legalMouseDown:function(b){if("touchstart"!=b.type&&!k.isLeft(b))return!1;
if(!this.withHandles)return!0;for(b=b.target;b&&b!==this.node;b=b.parentNode){if(t.contains(b,"dojoDndHandle"))return!0;if(t.contains(b,"dojoDndItem")||t.contains(b,"dojoDndIgnore"))break}return!1}});return x})},"dojo/dnd/common":function(){define(["../sniff","../_base/kernel","../_base/lang","../dom"],function(m,n,d,v){var t=d.getObject("dojo.dnd",!0);t.getCopyKeyState=function(d){return d[m("mac")?"metaKey":"ctrlKey"]};t._uniqueId=0;t.getUniqueId=function(){var d;do d=n._scopeName+"Unique"+ ++t._uniqueId;
while(v.byId(d));return d};t._empty={};t.isFormElement=function(d){d=d.target;3==d.nodeType&&(d=d.parentNode);return 0<=" a button textarea input select option ".indexOf(" "+d.tagName.toLowerCase()+" ")};return t})},"dojo/dnd/Selector":function(){define("../_base/array ../_base/declare ../_base/kernel ../_base/lang ../dom ../dom-construct ../mouse ../_base/NodeList ../on ../touch ./common ./Container".split(" "),function(m,n,d,v,t,e,k,r,c,h,q,u){var x=n("dojo.dnd.Selector",u,{constructor:function(b,
d){d||(d={});this.singular=d.singular;this.autoSync=d.autoSync;this.selection={};this.anchor=null;this.simpleSelection=!1;this.events.push(c(this.node,h.press,v.hitch(this,"onMouseDown")),c(this.node,h.release,v.hitch(this,"onMouseUp")))},singular:!1,getSelectedNodes:function(){var b=new r,c=q._empty,a;for(a in this.selection)a in c||b.push(t.byId(a));return b},selectNone:function(){return this._removeSelection()._removeAnchor()},selectAll:function(){this.forInItems(function(b,c){this._addItemClass(t.byId(c),
"Selected");this.selection[c]=1},this);return this._removeAnchor()},deleteSelectedNodes:function(){var b=q._empty,c;for(c in this.selection)if(!(c in b)){var a=t.byId(c);this.delItem(c);e.destroy(a)}this.anchor=null;this.selection={};return this},forInSelectedItems:function(b,c){c=c||d.global;var a=this.selection,f=q._empty,g;for(g in a)g in f||b.call(c,this.getItem(g),g,this)},sync:function(){x.superclass.sync.call(this);this.anchor&&!this.getItem(this.anchor.id)&&(this.anchor=null);var b=[],c=q._empty,
a;for(a in this.selection)a in c||this.getItem(a)||b.push(a);m.forEach(b,function(a){delete this.selection[a]},this);return this},insertNodes:function(b,c,a,f){var d=this._normalizedCreator;this._normalizedCreator=function(a,c){var f=d.call(this,a,c);b?(this.anchor?this.anchor!=f.node&&(this._removeItemClass(f.node,"Anchor"),this._addItemClass(f.node,"Selected")):(this.anchor=f.node,this._removeItemClass(f.node,"Selected"),this._addItemClass(this.anchor,"Anchor")),this.selection[f.node.id]=1):(this._removeItemClass(f.node,
"Selected"),this._removeItemClass(f.node,"Anchor"));return f};x.superclass.insertNodes.call(this,c,a,f);this._normalizedCreator=d;return this},destroy:function(){x.superclass.destroy.call(this);this.selection=this.anchor=null},onMouseDown:function(b){this.autoSync&&this.sync();if(this.current)if(!this.singular&&!q.getCopyKeyState(b)&&!b.shiftKey&&this.current.id in this.selection)this.simpleSelection=!0,k.isLeft(b)&&(b.stopPropagation(),b.preventDefault());else{if(!this.singular&&b.shiftKey){q.getCopyKeyState(b)||
this._removeSelection();var c=this.getAllNodes();if(c.length&&(this.anchor||(this.anchor=c[0],this._addItemClass(this.anchor,"Anchor")),this.selection[this.anchor.id]=1,this.anchor!=this.current)){for(var a=0,f;a<c.length&&(f=c[a],f!=this.anchor&&f!=this.current);++a);for(++a;a<c.length;++a){f=c[a];if(f==this.anchor||f==this.current)break;this._addItemClass(f,"Selected");this.selection[f.id]=1}this._addItemClass(this.current,"Selected");this.selection[this.current.id]=1}}else this.singular?this.anchor==
this.current?q.getCopyKeyState(b)&&this.selectNone():(this.selectNone(),this.anchor=this.current,this._addItemClass(this.anchor,"Anchor"),this.selection[this.current.id]=1):q.getCopyKeyState(b)?this.anchor==this.current?(delete this.selection[this.anchor.id],this._removeAnchor()):this.current.id in this.selection?(this._removeItemClass(this.current,"Selected"),delete this.selection[this.current.id]):(this.anchor&&(this._removeItemClass(this.anchor,"Anchor"),this._addItemClass(this.anchor,"Selected")),
this.anchor=this.current,this._addItemClass(this.current,"Anchor"),this.selection[this.current.id]=1):this.current.id in this.selection||(this.selectNone(),this.anchor=this.current,this._addItemClass(this.current,"Anchor"),this.selection[this.current.id]=1);b.stopPropagation();b.preventDefault()}},onMouseUp:function(){this.simpleSelection&&(this.simpleSelection=!1,this.selectNone(),this.current&&(this.anchor=this.current,this._addItemClass(this.anchor,"Anchor"),this.selection[this.current.id]=1))},
onMouseMove:function(){this.simpleSelection=!1},onOverEvent:function(){this.onmousemoveEvent=c(this.node,h.move,v.hitch(this,"onMouseMove"))},onOutEvent:function(){this.onmousemoveEvent&&(this.onmousemoveEvent.remove(),delete this.onmousemoveEvent)},_removeSelection:function(){var b=q._empty,c;for(c in this.selection)if(!(c in b)){var a=t.byId(c);a&&this._removeItemClass(a,"Selected")}this.selection={};return this},_removeAnchor:function(){this.anchor&&(this._removeItemClass(this.anchor,"Anchor"),
this.anchor=null);return this}});return x})},"dojo/dnd/Container":function(){define("../_base/array ../_base/declare ../_base/kernel ../_base/lang ../_base/window ../dom ../dom-class ../dom-construct ../Evented ../has ../on ../query ../touch ./common".split(" "),function(m,n,d,v,t,e,k,r,c,h,q,u,x,b){n=n("dojo.dnd.Container",c,{skipForm:!1,allowNested:!1,constructor:function(b,a){this.node=e.byId(b);a||(a={});this.creator=a.creator||null;this.skipForm=a.skipForm;this.parent=a.dropParent&&e.byId(a.dropParent);
this.map={};this.current=null;this.containerState="";k.add(this.node,"dojoDndContainer");a&&a._skipStartup||this.startup();this.events=[q(this.node,x.over,v.hitch(this,"onMouseOver")),q(this.node,x.out,v.hitch(this,"onMouseOut")),q(this.node,"dragstart",v.hitch(this,"onSelectStart")),q(this.node,"selectstart",v.hitch(this,"onSelectStart"))]},creator:function(){},getItem:function(b){return this.map[b]},setItem:function(b,a){this.map[b]=a},delItem:function(b){delete this.map[b]},forInItems:function(c,
a){a=a||d.global;var f=this.map,g=b._empty,e;for(e in f)e in g||c.call(a,f[e],e,this);return a},clearItems:function(){this.map={}},getAllNodes:function(){return u((this.allowNested?"":"\x3e ")+".dojoDndItem",this.parent)},sync:function(){var c={};this.getAllNodes().forEach(function(a){if(a.id){var f=this.getItem(a.id);if(f){c[a.id]=f;return}}else a.id=b.getUniqueId();var f=a.getAttribute("dndType"),d=a.getAttribute("dndData");c[a.id]={data:d||a.innerHTML,type:f?f.split(/\s*,\s*/):["text"]}},this);
this.map=c;return this},insertNodes:function(b,a,c){this.parent.firstChild?a?c||(c=this.parent.firstChild):c&&(c=c.nextSibling):c=null;var f;if(c)for(a=0;a<b.length;++a)f=this._normalizedCreator(b[a]),this.setItem(f.node.id,{data:f.data,type:f.type}),c.parentNode.insertBefore(f.node,c);else for(a=0;a<b.length;++a)f=this._normalizedCreator(b[a]),this.setItem(f.node.id,{data:f.data,type:f.type}),this.parent.appendChild(f.node);return this},destroy:function(){m.forEach(this.events,function(b){b.remove()});
this.clearItems();this.node=this.parent=this.current=null},markupFactory:function(b,a,c){b._skipStartup=!0;return new c(a,b)},startup:function(){if(!this.parent&&(this.parent=this.node,"table"==this.parent.tagName.toLowerCase())){var c=this.parent.getElementsByTagName("tbody");c&&c.length&&(this.parent=c[0])}this.defaultCreator=b._defaultCreator(this.parent);this.sync()},onMouseOver:function(b){for(var a=b.relatedTarget;a&&a!=this.node;)try{a=a.parentNode}catch(f){a=null}a||(this._changeState("Container",
"Over"),this.onOverEvent());a=this._getChildByEvent(b);this.current!=a&&(this.current&&this._removeItemClass(this.current,"Over"),a&&this._addItemClass(a,"Over"),this.current=a)},onMouseOut:function(b){for(b=b.relatedTarget;b;){if(b==this.node)return;try{b=b.parentNode}catch(a){b=null}}this.current&&(this._removeItemClass(this.current,"Over"),this.current=null);this._changeState("Container","");this.onOutEvent()},onSelectStart:function(c){this.withHandles||this.skipForm&&b.isFormElement(c)||(c.stopPropagation(),
c.preventDefault())},onOverEvent:function(){},onOutEvent:function(){},_changeState:function(b,a){var c="dojoDnd"+b,d=b.toLowerCase()+"State";k.replace(this.node,c+a,c+this[d]);this[d]=a},_addItemClass:function(b,a){k.add(b,"dojoDndItem"+a)},_removeItemClass:function(b,a){k.remove(b,"dojoDndItem"+a)},_getChildByEvent:function(b){if(b=b.target)for(var a=b.parentNode;a;b=a,a=b.parentNode)if((a==this.parent||this.allowNested)&&k.contains(b,"dojoDndItem"))return b;return null},_normalizedCreator:function(c,
a){var f=(this.creator||this.defaultCreator).call(this,c,a);v.isArray(f.type)||(f.type=["text"]);f.node.id||(f.node.id=b.getUniqueId());k.add(f.node,"dojoDndItem");return f}});b._createNode=function(c){return c?function(a){return r.create(c,{innerHTML:a})}:b._createSpan};b._createTrTd=function(b){var a=r.create("tr");r.create("td",{innerHTML:b},a);return a};b._createSpan=function(b){return r.create("span",{innerHTML:b})};b._defaultCreatorNodes={ul:"li",ol:"li",div:"div",p:"div"};b._defaultCreator=
function(c){c=c.tagName.toLowerCase();var a="tbody"==c||"thead"==c?b._createTrTd:b._createNode(b._defaultCreatorNodes[c]);return function(c,d){var f=c&&v.isObject(c),g,l;f&&c.tagName&&c.nodeType&&c.getAttribute?(g=c.getAttribute("dndData")||c.innerHTML,f=(f=c.getAttribute("dndType"))?f.split(/\s*,\s*/):["text"],l=c):(g=f&&c.data?c.data:c,f=f&&c.type?c.type:["text"],l=("avatar"==d?b._createSpan:a)(String(g)));l.id||(l.id=b.getUniqueId());return{node:l,data:g,type:f}}};return n})},"dojo/dnd/Manager":function(){define("../_base/array ../_base/declare ../_base/lang ../_base/window ../dom-class ../Evented ../has ../keys ../on ../topic ../touch ./common ./autoscroll ./Avatar".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x,b){var g=n("dojo.dnd.Manager",[e],{constructor:function(){this.source=this.avatar=null;this.nodes=[];this.copy=!0;this.target=null;this.canDropFlag=!1;this.events=[]},OFFSET_X:k("touch")?4:16,OFFSET_Y:k("touch")?4:16,overSource:function(a){this.avatar&&(this.target=a&&"Disabled"!=a.targetState?a:null,this.canDropFlag=!!this.target,this.avatar.update());h.publish("/dnd/source/over",a)},outSource:function(a){this.avatar?this.target==a&&(this.target=null,this.canDropFlag=
!1,this.avatar.update(),h.publish("/dnd/source/over",null)):h.publish("/dnd/source/over",null)},startDrag:function(a,b,g){function f(a){a.preventDefault();a.stopPropagation()}x.autoScrollStart(v.doc);this.source=a;this.nodes=b;this.copy=!!g;this.avatar=this.makeAvatar();v.body().appendChild(this.avatar.node);h.publish("/dnd/start",a,b,this.copy);this.events=[c(v.doc,q.move,d.hitch(this,"onMouseMove")),c(v.doc,q.release,d.hitch(this,"onMouseUp")),c(v.doc,"keydown",d.hitch(this,"onKeyDown")),c(v.doc,
"keyup",d.hitch(this,"onKeyUp")),c(v.doc,"dragstart",f),c(v.body(),"selectstart",f)];a="dojoDnd"+(g?"Copy":"Move");t.add(v.body(),a)},canDrop:function(a){a=!(!this.target||!a);this.canDropFlag!=a&&(this.canDropFlag=a,this.avatar.update())},stopDrag:function(){t.remove(v.body(),["dojoDndCopy","dojoDndMove"]);m.forEach(this.events,function(a){a.remove()});this.events=[];this.avatar.destroy();this.source=this.target=this.avatar=null;this.nodes=[]},makeAvatar:function(){return new b(this)},updateAvatar:function(){this.avatar.update()},
onMouseMove:function(a){var b=this.avatar;b&&(x.autoScrollNodes(a),b=b.node.style,b.left=a.pageX+this.OFFSET_X+"px",b.top=a.pageY+this.OFFSET_Y+"px",b=!!this.source.copyState(u.getCopyKeyState(a)),this.copy!=b&&this._setCopyStatus(b));k("touch")&&a.preventDefault()},onMouseUp:function(a){if(this.avatar){if(this.target&&this.canDropFlag){var b=!!this.source.copyState(u.getCopyKeyState(a));h.publish("/dnd/drop/before",this.source,this.nodes,b,this.target,a);h.publish("/dnd/drop",this.source,this.nodes,
b,this.target,a)}else h.publish("/dnd/cancel");this.stopDrag()}},onKeyDown:function(a){if(this.avatar)switch(a.keyCode){case r.CTRL:a=!!this.source.copyState(!0);this.copy!=a&&this._setCopyStatus(a);break;case r.ESCAPE:h.publish("/dnd/cancel"),this.stopDrag()}},onKeyUp:function(a){this.avatar&&a.keyCode==r.CTRL&&(a=!!this.source.copyState(!1),this.copy!=a&&this._setCopyStatus(a))},_setCopyStatus:function(a){this.copy=a;this.source._markDndStatus(this.copy);this.updateAvatar();t.replace(v.body(),"dojoDnd"+
(this.copy?"Copy":"Move"),"dojoDnd"+(this.copy?"Move":"Copy"))}});u._manager=null;g.manager=u.manager=function(){u._manager||(u._manager=new g);return u._manager};return g})},"dojo/dnd/autoscroll":function(){define("../_base/lang ../sniff ../_base/window ../dom-geometry ../dom-style ../window".split(" "),function(m,n,d,v,t,e){var k={};m.setObject("dojo.dnd.autoscroll",k);k.getViewport=e.getBox;k.V_TRIGGER_AUTOSCROLL=32;k.H_TRIGGER_AUTOSCROLL=32;k.V_AUTOSCROLL_VALUE=16;k.H_AUTOSCROLL_VALUE=16;var r,
c=d.doc,h=Infinity,q=Infinity;k.autoScrollStart=function(u){c=u;r=e.getBox(c);u=d.body(c).parentNode;h=Math.max(u.scrollHeight-r.h,0);q=Math.max(u.scrollWidth-r.w,0)};k.autoScroll=function(u){var x=r||e.getBox(c),b=d.body(c).parentNode,g=0,a=0;u.clientX<k.H_TRIGGER_AUTOSCROLL?g=-k.H_AUTOSCROLL_VALUE:u.clientX>x.w-k.H_TRIGGER_AUTOSCROLL&&(g=Math.min(k.H_AUTOSCROLL_VALUE,q-b.scrollLeft));u.clientY<k.V_TRIGGER_AUTOSCROLL?a=-k.V_AUTOSCROLL_VALUE:u.clientY>x.h-k.V_TRIGGER_AUTOSCROLL&&(a=Math.min(k.V_AUTOSCROLL_VALUE,
h-b.scrollTop));window.scrollBy(g,a)};k._validNodes={div:1,p:1,td:1};k._validOverflow={auto:1,scroll:1};k.autoScrollNodes=function(c){for(var e,b,g,a,f,l=0,h=0,u=c.target;u;){if(1==u.nodeType&&u.tagName.toLowerCase()in k._validNodes){g=t.getComputedStyle(u);f=g.overflowX.toLowerCase()in k._validOverflow;a=g.overflowY.toLowerCase()in k._validOverflow;if(f||a)e=v.getContentBox(u,g),b=v.position(u,!0);if(f){g=Math.min(k.H_TRIGGER_AUTOSCROLL,e.w/2);f=c.pageX-b.x;if(n("webkit")||n("opera"))f+=d.body().scrollLeft;
l=0;0<f&&f<e.w&&(f<g?l=-g:f>e.w-g&&(l=g),u.scrollLeft+=l)}if(a){a=Math.min(k.V_TRIGGER_AUTOSCROLL,e.h/2);g=c.pageY-b.y;if(n("webkit")||n("opera"))g+=d.body().scrollTop;h=0;0<g&&g<e.h&&(g<a?h=-a:g>e.h-a&&(h=a),u.scrollTop+=h)}if(l||h)return}try{u=u.parentNode}catch(B){u=null}}k.autoScroll(c)};return k})},"dojo/dnd/Avatar":function(){define("../_base/declare ../_base/window ../dom ../dom-attr ../dom-class ../dom-construct ../hccss ../query".split(" "),function(m,n,d,v,t,e,k,r){return m("dojo.dnd.Avatar",
null,{constructor:function(c){this.manager=c;this.construct()},construct:function(){var c=e.create("table",{"class":"dojoDndAvatar",style:{position:"absolute",zIndex:"1999",margin:"0px"}}),d=this.manager.source,q,u=e.create("tbody",null,c),x=e.create("tr",null,u),b=e.create("td",null,x),g=Math.min(5,this.manager.nodes.length),a=0;k("highcontrast")&&e.create("span",{id:"a11yIcon",innerHTML:this.manager.copy?"+":"\x3c"},b);e.create("span",{innerHTML:d.generateText?this._generateText():""},b);for(v.set(x,
{"class":"dojoDndAvatarHeader",style:{opacity:.9}});a<g;++a)d.creator?q=d._normalizedCreator(d.getItem(this.manager.nodes[a].id).data,"avatar").node:(q=this.manager.nodes[a].cloneNode(!0),"tr"==q.tagName.toLowerCase()&&(x=e.create("table"),e.create("tbody",null,x).appendChild(q),q=x)),q.id="",x=e.create("tr",null,u),b=e.create("td",null,x),b.appendChild(q),v.set(x,{"class":"dojoDndAvatarItem",style:{opacity:(9-a)/10}});this.node=c},destroy:function(){e.destroy(this.node);this.node=!1},update:function(){t.toggle(this.node,
"dojoDndAvatarCanDrop",this.manager.canDropFlag);if(k("highcontrast")){var c=d.byId("a11yIcon"),e="+";this.manager.canDropFlag&&!this.manager.copy?e="\x3c ":this.manager.canDropFlag||this.manager.copy?this.manager.canDropFlag||(e="x"):e="o";c.innerHTML=e}r("tr.dojoDndAvatarHeader td span"+(k("highcontrast")?" span":""),this.node).forEach(function(c){c.innerHTML=this.manager.source.generateText?this._generateText():""},this)},_generateText:function(){return this.manager.nodes.length.toString()}})})},
"esri/arcgis/utils":function(){define("require dojo/_base/lang dojo/_base/array dojo/_base/connect dojo/_base/Deferred dojo/_base/json dojo/_base/url dojo/on dojo/DeferredList dojo/dom-construct dojo/sniff dojox/gfx/_base ../kernel ../config ../Color ../lang ../request ../SpatialReference ../map ../urlUtils ../geometry/ScreenPoint ../geometry/Extent ../geometry/webMercatorUtils ../symbols/jsonUtils ../renderers/jsonUtils ../dijit/PopupTemplate ../dijit/Popup ../tasks/query ../tasks/GeometryService ../layers/ArcGISTiledMapServiceLayer ../layers/FeatureLayer dojo/i18n!../nls/jsapi".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,a,f,l,y,F,B,A,z,w,D,C,E,O,J,K,I,X){function P(a){return f({url:W.arcgisUrl+"/"+a.itemId+"/data",content:{f:"json"},callbackParamName:"callback"},{disableIdentityLookup:!0,_preLookup:!0})}function N(a,b){var c={f:"json"};b&&(c.token=b);return f({url:a,content:c,callbackParamName:"callback"},{disableIdentityLookup:!0})}function L(b){!b.layerDefinition||b.layerDefinition.drawingInfo&&b.layerDefinition.drawingInfo.labelingInfo||(b.showLabels=!1);b.itemProperties.layerDefinition&&
(b.layerDefinition?(b.layerDefinition.drawingInfo||(b.layerDefinition.drawingInfo=b.itemProperties.layerDefinition.drawingInfo),a.isDefined(b.layerDefinition.definitionExpression)||(b.layerDefinition.definitionExpression=b.itemProperties.layerDefinition.definitionExpression),a.isDefined(b.layerDefinition.minScale)||(b.layerDefinition.minScale=b.itemProperties.layerDefinition.minScale),a.isDefined(b.layerDefinition.maxScale)||(b.layerDefinition.maxScale=b.itemProperties.layerDefinition.maxScale)):
b.layerDefinition=b.itemProperties.layerDefinition);!b.itemProperties.popupInfo||b.popupInfo||b.disablePopup||(b.popupInfo=b.itemProperties.popupInfo);a.isDefined(b.itemProperties.showLabels)&&!a.isDefined(b.showLabels)&&(b.showLabels=b.itemProperties.showLabels);a.isDefined(b.itemProperties.showLegend)&&!a.isDefined(b.showLegend)&&(b.showLegend=b.itemProperties.showLegend);a.isDefined(b.itemProperties.refreshInterval)&&!a.isDefined(b.refreshInterval)&&(b.refreshInterval=b.itemProperties.refreshInterval)}
function H(b){L(b);b.itemProperties.layerDefinition&&b.layerDefinition&&(!a.isDefined(b.layerDefinition.maximumTrackPoints)&&a.isDefined(b.itemProperties.layerDefinition.maximumTrackPoints)&&(b.layerDefinition.maximumTrackPoints=b.itemProperties.layerDefinition.maximumTrackPoints),!b.layerDefinition.definitionGeometry&&b.itemProperties.layerDefinition.definitionGeometry&&(b.layerDefinition.definitionGeometry=b.itemProperties.layerDefinition.definitionGeometry));b.itemProperties.purgeOptions&&!b.purgeOptions&&
(b.purgeOptions=b.itemProperties.purgeOptions)}function Q(b,f){var g=new t,l=b.itemData,w=[],e=[];d.forEach(l.operationalLayers,function(b){if(b.itemId&&!b.type){var c=b.url.toLowerCase();-1<c.indexOf("/featureserver")||-1<c.indexOf("/mapserver/")?(e.push(b),w.push(P(b))):-1<c.indexOf("/mapserver")&&-1===c.indexOf("/mapserver/")&&(!b.layers||!a.isDefined(b.minScale)&&!a.isDefined(b.maxScale))?(e.push(b),w.push(P(b))):-1<c.indexOf("/imageserver")&&!a.isDefined(b.minScale)&&!a.isDefined(b.maxScale)?
(e.push(b),w.push(P(b))):-1<c.indexOf("/streamserver")&&(e.push(b),w.push(P(b)))}});l.baseMap&&l.baseMap.baseMapLayers&&d.forEach(l.baseMap.baseMapLayers,function(a){a.itemId&&"VectorTileLayer"!==a.layerType&&(e.push(a),w.push(P(a)))});if(0<w.length){var h={};(new c(w)).addCallback(function(c){d.forEach(e,function(b,f){var g=c[f][1];if(g&&!(g instanceof Error)&&(h[b.itemId]=g,!b.type)){var l=b.url.toLowerCase();(-1<l.indexOf("/featureserver")||-1<l.indexOf("/mapserver/"))&&g.layers?d.forEach(g.layers,
function(a){var c="/featureserver/"+a.id;(c=l.match(c+"$")==c)||(c="/mapserver/"+a.id,c=l.match(c+"$")==c);c&&(b.itemProperties=a,L(b))}):-1<l.indexOf("/streamserver")?(b.itemProperties=g,H(b)):-1<l.indexOf("/mapserver")?(g.layers&&!b.layers&&(b.layers=g.layers),a.isDefined(g.minScale)&&!a.isDefined(b.minScale)&&(b.minScale=g.minScale),a.isDefined(g.maxScale)&&!a.isDefined(b.maxScale)&&(b.maxScale=g.maxScale),a.isDefined(g.refreshInterval)&&!a.isDefined(b.refreshInterval)&&(b.refreshInterval=g.refreshInterval),
g.visibleLayers&&!b.visibleLayers&&(b.visibleLayers=g.visibleLayers)):-1<l.indexOf("/imageserver")&&(a.isDefined(g.minScale)&&!a.isDefined(b.minScale)&&(b.minScale=g.minScale),a.isDefined(g.maxScale)&&!a.isDefined(b.maxScale)&&(b.maxScale=g.maxScale),a.isDefined(g.refreshInterval)&&!a.isDefined(b.refreshInterval)&&(b.refreshInterval=g.refreshInterval),!g.popupInfo||b.popupInfo||b.disablePopup||(b.popupInfo=g.popupInfo),g.renderingRule&&!b.renderingRule&&(b.renderingRule=g.renderingRule,g.renderingRule.functionName&&
(b.renderingRule.rasterFunction=g.renderingRule.functionName)),g.bandIds&&!b.bandIds&&(b.bandIds=g.bandIds),g.mosaicRule&&!b.mosaicRule&&(b.mosaicRule=g.mosaicRule),g.format&&!b.format&&(b.format=g.format),a.isDefined(g.compressionQuality)&&!a.isDefined(b.compressionQuality)&&(b.compressionQuality=g.compressionQuality),!g.layerDefinition||!g.layerDefinition.definitionExpression||a.isDefined(b.layerDefinition)&&a.isDefined(b.layerDefinition.definitionExpression)||(b.layerDefinition=b.layerDefinition||
{},b.layerDefinition.definitionExpression=g.layerDefinition.definitionExpression))}});b.relatedItemsData=h;g.callback(b)})}else g.callback(b);return g}function ja(a,b){var c=new t,d=a.itemData,f=d.baseMap.baseMapLayers[0];if("BingMapsAerial"===f.type||"BingMapsRoad"===f.type||"BingMapsHybrid"===f.type)if(f.portalUrl&&x.id)delete b.bingMapsKey,x.id.checkSignInStatus(F.urlToObject(W.arcgisUrl).path).then(n.hitch(null,function(a,b,c,d,g){N(f.portalUrl,g.token).then(n.hitch(null,ba,a,b,c,d),n.hitch(null,
Z,a,b,c,d))},a,b,d,c),n.hitch(null,function(a,b,c,d,g){N(f.portalUrl).then(n.hitch(null,ba,a,b,c,d),n.hitch(null,Z,a,b,c,d))},a,b,d,c));else if(b.bingMapsKey){var g=new ha({bingMapsKey:b.bingMapsKey,mapStyle:ha.MAP_STYLE_AERIAL});v.connect(g,"onLoad",n.hitch(this,function(){c.callback([a,b])}));v.connect(g,"onError",function(g){delete b.bingMapsKey;a.itemData=T(d);f=a.itemData.baseMap.baseMapLayers[0];f.errors=[];f.errors.push({message:"The owner of the application has not provided a valid Bing Key for the Bing Map it includes. Switching to Esri layers."});
c.callback([a,b])})}else a.itemData=T(d),f=a.itemData.baseMap.baseMapLayers[0],f.errors=[],f.errors.push({message:"The owner of the application has not provided a Bing Key for the Bing Map it includes. Switching to Esri layers."}),c.callback([a,b]);else c.callback([a,b]);return c}function V(a){var b=new t,c,d;a=a.itemData;var f=a.baseMap&&a.baseMap.baseMapLayers;if(Aa&&!Aa.supported())for(a=0;a<f.length;a++){var g=f[a];if(!g.isReference){"VectorTileLayer"===g.layerType&&(c=g.itemId,d=a);break}}c?
Ea(c,!1).addBoth(function(a){var c=/^https?:\/\/basemaps(dev)?\.arcgis\.com\/arcgis\/rest\/services\/World_Basemap\/VectorTileServer/i;a&&a.item&&c.test(a.item.url)&&(f[d]={id:"FB_"+g.id,layerType:"ArcGISTiledMapServiceLayer",opacity:"opacity"in g?g.opacity:1,visibility:"visibility"in g?g.visibility:!0,url:"https://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer"});b.resolve()}):b.resolve();return b}function ba(a,b,c,d,f){f.bingKey?(b.bingMapsKey=f.bingKey,f=new ha({bingMapsKey:b.bingMapsKey,
mapStyle:ha.MAP_STYLE_AERIAL}),v.connect(f,"onLoad",n.hitch(this,function(){d.callback([a,b])})),v.connect(f,"onError",function(f){delete b.bingMapsKey;a.itemData=T(c);f=a.itemData.baseMap.baseMapLayers[0];f.errors=[];f.errors.push({message:"The owner of the map has not provided a valid Bing Key for the Bing Map it includes. Switching to Esri layers."});d.callback([a,b])})):Z(a,b,c,d)}function Z(a,b,c,f){delete b.bingMapsKey;a.itemData=T(c);c=a.itemData.baseMap.baseMapLayers[0];c.errors=[];c.errors.push({message:"The owner of the map has not provided a Bing Key for the Bing Map it includes. Switching to Esri layers."});
f.callback([a,b])}function T(a){a.baseMap="BingMapsAerial"===a.baseMap.baseMapLayers[0].type?{title:"Imagery",baseMapLayers:[{id:"World_Imagery_2017",visibility:!0,opacity:1,url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"}]}:"BingMapsRoad"===a.baseMap.baseMapLayers[0].type?{title:"Streets",baseMapLayers:[{id:"World_Street_Map_8421",opacity:1,visibility:!0,url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"}]}:{title:"Imagery with Labels",
baseMapLayers:[{id:"World_Imagery_6611",opacity:1,visibility:!0,url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"},{id:"World_Boundaries_and_Places_1145",isReference:!0,opacity:1,visibility:!0,url:"https://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer"}]};return a}function R(b,c,f,g){var l=b.dynamicLayerInfos||b.layerInfos,w=c.layers;if(w&&l)if(g.usePopupManager){var e;d.forEach(l,function(a){var b=a.id;if(!a.subLayerIds)for(a=
0;a<w.length;a++){var c=w[a];if(c.id===b&&c.popupInfo){e||(e={});e[b]={infoTemplate:new f(c.popupInfo),layerUrl:c.layerUrl};break}}});e&&b.setInfoTemplates(e)}else{var h=[],G=[],u=[],k=[],x=[],q=[];d.forEach(l,function(c){var f=c.id;if(!c.subLayerIds&&-1!==d.indexOf(b.visibleLayers,f))for(c=0;c<w.length;c++){var g=w[c];if(g.id===f){G.push(f);h.push(g.popupInfo);u.push(g.layerUrl||"");g.layerDefinition&&g.layerDefinition.definitionExpression?k.push(g.layerDefinition.definitionExpression):k.push("");
x.push(a.isDefined(g.minScale)?g.minScale:null);q.push(a.isDefined(g.maxScale)?g.maxScale:null);break}}});h.length&&(b.__popups=h,b.__popupIds=G,b.__popupUrls=u,b.__popupWhereClauses=k,b.__popupMinScales=x,b.__popupMaxScales=q,b.__resourceInfo=c.resourceInfo)}}function Y(a){if(!a)return!1;var b=(new k(W.arcgisUrl)).authority;return-1!==a.indexOf(".arcgis.com/")||-1!==a.indexOf(b)}function da(a){return a?-1!==a.indexOf("/services.arcgisonline.com/")||-1!==a.indexOf("/server.arcgisonline.com/"):!1}
function U(a){"https:"===location.protocol&&(Y(a)||da(a))&&(a=a.replace("http:","https:"));return a}function ka(a,b,c){var f=[],g;a.displayLevels||(f=d.map(a.resourceInfo.tileInfo.lods,function(a){return a.level}));a.exclusionAreas&&(g=n.clone(a.exclusionAreas),g=d.map(g,function(a){a.geometry=new A(a.geometry);return a}));f=new K(U(a.url),{resourceInfo:a.resourceInfo,opacity:a.opacity,visible:a.visibility,displayLevels:a.displayLevels||f,id:a.id,minScale:a.minScale,maxScale:a.maxScale,refreshInterval:a.refreshInterval,
exclusionAreas:g});c.ignorePopups||R(f,a,b,c);return f}function fa(a,b){if(!a||!b||0===b.length)return[];var c=","+b+",",f=[],d,g=",";for(d=0;d<a.length;d++)if(null!==a[d].subLayerIds){if(-1===c.indexOf(","+a[d].id+",")||-1<g.indexOf(","+a[d].id+","))g+=a[d].subLayerIds.toString()+","}else-1<c.indexOf(","+a[d].id+",")&&-1===g.indexOf(","+a[d].id+",")&&f.push(a[d].id);return f}function sa(a,b,c){var f=new Fa;f.format="png24";a.resourceInfo&&a.resourceInfo.supportedImageFormatTypes&&-1<a.resourceInfo.supportedImageFormatTypes.indexOf("PNG32")&&
(f.format="png32");var f=new Ga(U(a.url),{resourceInfo:a.resourceInfo,opacity:a.opacity,visible:a.visibility,id:a.id,imageParameters:f,minScale:a.minScale,maxScale:a.maxScale,refreshInterval:a.refreshInterval}),g=a.visibleLayers;if(!a.visibleLayers){var l="";d.forEach(f.layerInfos,function(a){a.defaultVisibility&&(l+=(0<l.length?",":"")+a.id)});g=l}if(a.layers&&0<a.layers.length){var w=[],e=[],h,G=[],u,k;d.forEach(a.layers,function(b){var c=b.layerDefinition;c&&c.definitionExpression&&(w[b.id]=c.definitionExpression);
if(c&&c.source){h=null;k=c.source;if("mapLayer"===k.type){var f=d.filter(a.resourceInfo.layers,function(a){return a.id===k.mapLayerId});f.length&&(h=n.mixin(f[0],b))}else h=n.mixin({},b);h&&(h.source=k,delete h.popupInfo,h=new Ha(h),a.visibleLayers&&(f="string"==typeof a.visibleLayers?a.visibleLayers.split(","):a.visibleLayers,-1<d.indexOf(f,b.id)?h.defaultVisibility=!0:h.defaultVisibility=!1),e.push(h))}c&&null!=c.transparency&&(f=c.drawingInfo||{},null==f.transparency&&(f.transparency=c.transparency,
c.drawingInfo=f));c&&c.source&&c.drawingInfo&&(u=new Ia(c.drawingInfo),G[b.id]=u)},this);0<w.length&&f.setLayerDefinitions(w);0<e.length?(f.setDynamicLayerInfos(e,!0),0<G.length&&f.setLayerDrawingOptions(G,!0)):(g=fa(f.layerInfos,g),f.setVisibleLayers(g))}else g=fa(f.layerInfos,g),f.setVisibleLayers(g);c.ignorePopups||R(f,a,b,c);return f}function ma(b,c,f){var d=new Ja;d.bandIds=b.bandIds;null!=b.format&&(d.format=b.format,null!=b.compressionQuality&&(d.compressionQuality=b.compressionQuality));if(b.renderingRule&&
b.renderingRule.rasterFunction){var g=new Ka(b.renderingRule);d.renderingRule=g}b.mosaicRule&&(g=new La(b.mosaicRule),d.mosaicRule=g);a.isDefined(b.noData)&&(d.noData=b.noData);a.isDefined(b.noDataInterpretation)&&(d.noDataInterpretation=b.noDataInterpretation);a.isDefined(b.interpolation)&&(d.interpolation=b.interpolation);g=b.layerType?"ArcGISImageServiceVectorLayer"===b.layerType:!1;a.isDefined(b.layerType)||(g=b.resourceInfo.hasMultidimensions&&("esriImageServiceDataTypeVector-UV"===b.resourceInfo.serviceDataType||
"esriImageServiceDataTypeVector-MagDir"===b.resourceInfo.serviceDataType));d={resourceInfo:b.resourceInfo,opacity:b.opacity,visible:b.visibility,id:b.id,imageServiceParameters:d,minScale:b.minScale,maxScale:b.maxScale,refreshInterval:b.refreshInterval};d=g?new Ma(U(b.url),d):new Na(U(b.url),d);b.layerDefinition&&(b.layerDefinition.drawingInfo&&b.layerDefinition.drawingInfo.renderer&&(g=D.fromJson(b.layerDefinition.drawingInfo.renderer),d.setRenderer(g)),b.layerDefinition.definitionExpression&&d.setDefinitionExpression(b.layerDefinition.definitionExpression,
!0));!f.ignorePopups&&b.popupInfo&&d.setInfoTemplate(new c(b.popupInfo));return d}function aa(b,c,f){var g=[102113,102100,3857],w=f||new l(c[0].layerObject.fullExtent.spatialReference),e=new l(b.resourceInfo.fullExtent.spatialReference);return w.wkt==e.wkt&&(w.wkid==e.wkid||a.isDefined(w.latestWkid)&&w.latestWkid==e.wkid||a.isDefined(e.latestWkid)&&w.wkid==e.latestWkid||a.isDefined(w.latestWkid)&&w.latestWkid==e.latestWkid)||w.wkid&&e.wkid&&d.some(g,function(a){return a===e.wkid})&&d.some(g,function(a){return a===
w.wkid})?!0:!1}function ca(a,b,c){if(!b[0].layerObject.tileInfo)return!1;a=a.resourceInfo.tileInfo;b=b[0].layerObject.tileInfo;c=c.width>c.height?c.width:c.height;for(var f=!1,d=!1,g=0;g<a.lods.length;g++){for(var l=a.lods[g].scale/a.dpi,w=0;w<b.lods.length;w++){var e=b.lods[w].scale/b.dpi;if(Math.abs(e-l)/e<1/c)if(f){d=!0;break}else f=!0}if(d)break}return d||f&&(1===a.lods.length||1===b.lods.length)?!0:!1}function oa(b,c,f,g,h,G){var k,q,E=f._clazz;if("OpenStreetMap"===b.type)k=new Oa({id:b.id,opacity:b.opacity,
visible:null!==b.visibility&&void 0!==b.visibility?b.visibility:!0});else if("WFS"===b.type)g={customParameters:b.wfsInfo.customParameters,geometryType:b.layerDefinition.geometryType,id:b.id,labelingInfo:b.layerDefinition.drawingInfo.labelingInfo,maxFeatures:b.wfsInfo.maxFeatures,mode:b.mode,name:b.wfsInfo.name,showLabels:!0,swapXY:b.wfsInfo.swapXY,title:b.title,url:b.url,version:b.wfsInfo.version,visible:b.visibility,wkid:b.layerDefinition.spatialReference.wkid},k=new Pa,k.fromJson(g,function(){a.isDefined(b.opacity)&&
k.setOpacity(b.opacity);a.isDefined(b.visibility)&&k.setVisibility(b.visibility);(b.minScale||b.maxScale)&&k.setScaleRange(b.minScale,b.maxScale);k.renderer=D.fromJson(b.layerDefinition.drawingInfo.renderer);!f.ignorePopups&&b.popupInfo&&k.setInfoTemplate(new E(b.popupInfo));k.emit("fromJsonComplete")});else if("WMS"===b.type){var z=[],S=[];d.forEach(b.layers,function(a){S.push(new Qa({name:a.name,title:a.title,legendURL:a.legendURL,queryable:a.queryable,showPopup:a.showPopup}));z.push(a.name)},this);
b.visibleLayers&&(z=b.visibleLayers);g=new A(b.extent[0][0],b.extent[0][1],b.extent[1][0],b.extent[1][1],new l({wkid:4326}));g={customLayerParameters:b.customLayerParameters,customParameters:b.customParameters,extent:g,layerInfos:S,version:b.version,maxWidth:b.maxWidth,maxHeight:b.maxHeight,featureInfoFormat:b.featureInfoFormat,getFeatureInfoURL:b.featureInfoUrl,getMapURL:b.mapUrl,spatialReferences:b.spatialReferences,title:b.title,copyright:b.copyright,minScale:b.minScale||0,maxScale:b.maxScale||
0,format:b.format};k=new Ra(b.url,{id:b.id,visibleLayers:z,format:"png",transparent:b.firstLayer?!1:!0,opacity:b.opacity,visible:null!==b.visibility?b.visibility:!0,resourceInfo:g,refreshInterval:b.refreshInterval});k.spatialReference.wkid=g.spatialReferences[0]}else if("KML"===b.type){q=b.url;if(x.id){var y=x.id.findCredential(F.urlToObject(W.arcgisUrl).path);y&&(c=W.arcgisUrl.substring(W.arcgisUrl.indexOf("//")+2,W.arcgisUrl.indexOf("/",W.arcgisUrl.indexOf("//")+3)),h=c.split("."),h=h[h.length-
2]+"."+h[h.length-1],G=q.indexOf(h),-1<G&&(q="https://"+c+q.substring(G+h.length),q+="?token\x3d"+y.token))}k=new Sa(q,{id:b.id,visible:null!==b.visibility?b.visibility:!0,outSR:g,refreshInterval:b.refreshInterval});v.connect(k,"onLoad",function(){(b.opacity||0===b.opacity)&&k.setOpacity(b.opacity);a.isDefined(b.minScale)&&a.isDefined(b.maxScale)&&k.setScaleRange(b.minScale,b.maxScale);b.visibleFolders&&d.forEach(k.folders,function(a){-1<d.indexOf(b.visibleFolders,a.id)?k.setFolderVisibility(a,!0):
k.setFolderVisibility(a,!1)},this)})}else if("WebTiledLayer"===b.type){if(k=new Ta(b.templateUrl,{id:b.id,visible:null!==b.visibility?b.visibility:!0,opacity:b.opacity,copyright:b.copyright,fullExtent:b.fullExtent&&new A(b.fullExtent),initialExtent:b.fullExtent&&new A(b.fullExtent),subDomains:b.subDomains,tileInfo:b.tileInfo?new Ua(b.tileInfo):null,refreshInterval:b.refreshInterval,wmtsInfo:b.wmtsInfo}),a.isDefined(b.minScale)||a.isDefined(b.maxScale))k.loaded?k.setScaleRange(b.minScale,b.maxScale):
v.connect(k,"onLoad",function(){k.setScaleRange(b.minScale,b.maxScale)})}else if("GeoRSS"===b.type)k=new Va(b.url,{id:b.id,opacity:b.opacity,outSpatialReference:g,refreshInterval:b.refreshInterval}),v.connect(k,"onLoad",function(){!1===b.visibility&&k.hide();a.isDefined(b.minScale)&&a.isDefined(b.maxScale)&&k.setScaleRange(b.minScale,b.maxScale);var c=k.getFeatureLayers();d.forEach(c,function(a){b.pointSymbol&&"esriGeometryPoint"===a.geometryType?(a.renderer.symbol=w.fromJson(b.pointSymbol),1===c.length&&
(k.pointSymbol=w.fromJson(b.pointSymbol))):b.lineSymbol&&"esriGeometryPolyline"===a.geometryType?(a.renderer.symbol=w.fromJson(b.lineSymbol),1===c.length&&(k.polylineSymbol=w.fromJson(b.lineSymbol))):b.polygonSymbol&&"esriGeometryPolygon"===a.geometryType&&(a.renderer.symbol=w.fromJson(b.polygonSymbol),1===c.length&&(k.polygonSymbol=w.fromJson(b.polygonSymbol)))})});else if("CSV"==b.type&&b.url)g={layerDefinition:b.layerDefinition,columnDelimiter:b.columnDelimiter,id:b.id?b.id:null,visible:null!==
b.visibility?b.visibility:!0,opacity:b.opacity,refreshInterval:b.refreshInterval},b.locationInfo&&(g.latitudeFieldName=b.locationInfo.latitudeFieldName,g.longitudeFieldName=b.locationInfo.longitudeFieldName),f.ignorePopups||(g.infoTemplate=new C(b.popupInfo?b.popupInfo:Wa.generateDefaultPopupInfo(b))),k=new Xa(b.url,g);else if("VectorTileLayer"===b.layerType&&b.styleUrl)k=new Aa(b.styleUrl,{id:b.id,minScale:b.minScale,maxScale:b.maxScale,opacity:b.opacity,visible:b.visibility});else if(b.layerDefinition&&
!b.url)g=e.fromJson(e.toJson(b)),delete g.id,delete g.opacity,delete g.visibility,k=new I(g,{id:b.id,opacity:b.opacity,visible:b.visibility,outFields:["*"],autoGeneralize:!0}),!f.ignorePopups&&g.popupInfo&&k.setInfoTemplate(new E(g.popupInfo)),ta(k);else if("BingMapsAerial"===b.type||"BingMapsRoad"===b.type||"BingMapsHybrid"===b.type)f.bingMapsKey?(g=ha.MAP_STYLE_AERIAL_WITH_LABELS,"BingMapsAerial"===b.type?g=ha.MAP_STYLE_AERIAL:"BingMapsRoad"===b.type&&(g=ha.MAP_STYLE_ROAD),k=new ha({bingMapsKey:f.bingMapsKey,
mapStyle:g,opacity:b.opacity,id:b.id}),v.connect(k,"onError",n.hitch(this,function(a){a.errors=a.errors||[];a.errors.push({message:"This application does not have a valid Bing Key for the Bing layer that is included in this map. [type:"+a.type+"]"})},b))):(b.errors=b.errors||[],b.errors.push({message:"This application does not provide a Bing Key for the Bing layer that is included in this map. [type:"+b.type+"]"}));else if(b.resourceInfo&&b.resourceInfo.mapName)k=!0===b.resourceInfo.singleFusedMapCache&&
(b.baseMapLayer||aa(b,c,g)&&ca(b,h,G))?ka(b,E,f):sa(b,E,f);else if(b.resourceInfo&&b.resourceInfo.pixelSizeX)k=!0===b.resourceInfo.singleFusedMapCache&&(b.baseMapLayer||aa(b,c,g)&&ca(b,h,G))?ka(b,E,f):ma(b,E,f);else if(b.resourceInfo&&"Feature Layer"===b.resourceInfo.type){b.capabilities&&(b.resourceInfo.capabilities=b.capabilities);var la;!1===f.editable?la=!1:f.privileges&&-1===d.indexOf(f.privileges,"features:user:edit")&&x.id&&x.id.findCredential(b.url)&&(la=!1);k=new I(U(b.url),{resourceInfo:b.resourceInfo,
opacity:b.opacity,visible:b.visibility,id:b.id,mode:b.mode===I.MODE_SELECTION?I.MODE_SELECTION:I.MODE_AUTO,editable:la,outFields:["*"],autoGeneralize:!0,refreshInterval:b.refreshInterval});!f.ignorePopups&&b.popupInfo&&k.setInfoTemplate(new E(b.popupInfo));b.layerDefinition&&(b.layerDefinition.drawingInfo&&b.layerDefinition.drawingInfo.renderer&&(g=D.fromJson(b.layerDefinition.drawingInfo.renderer),g.isMaxInclusive=!0,k.setRenderer(g)),b.layerDefinition.drawingInfo&&b.layerDefinition.drawingInfo.labelingInfo&&
(g=d.map(b.layerDefinition.drawingInfo.labelingInfo,function(a){return new Ya(a)}),k.setLabelingInfo(g)),b.layerDefinition.definitionExpression&&k.setDefinitionExpression(b.layerDefinition.definitionExpression),a.isDefined(b.layerDefinition.minScale)&&k.setMinScale(b.layerDefinition.minScale),a.isDefined(b.layerDefinition.maxScale)&&k.setMaxScale(b.layerDefinition.maxScale));ta(k)}else b.resourceInfo&&b.resourceInfo.streamUrls&&(g={resourceInfo:b.resourceInfo,opacity:b.opacity,visible:b.visibility,
id:b.id},b.layerDefinition&&(y=b.layerDefinition.drawingInfo,b.layerDefinition.definitionGeometry&&(q=q||{},q.geometry=b.layerDefinition.definitionGeometry),a.isDefined(b.layerDefinition.definitionExpression)&&(q=q||{},q.where=b.layerDefinition.definitionExpression),a.isDefined(b.layerDefinition.maximumTrackPoints)&&(g.maximumTrackPoints=b.layerDefinition.maximumTrackPoints)),q&&(g.filter=q),b.purgeOptions&&(g.purgeOptions=b.purgeOptions),k=new Za(U(b.url),g),y&&y.renderer&&(g=y.renderer,k.setRenderer(D.fromJson(g))),
!f.ignorePopups&&b.popupInfo&&k.setInfoTemplate(new E(b.popupInfo)),b.layerDefinition&&(a.isDefined(b.layerDefinition.minScale)&&k.setMinScale(b.layerDefinition.minScale),a.isDefined(b.layerDefinition.maxScale)&&k.setMaxScale(b.layerDefinition.maxScale)),r.once(k,"error",function(a){b.errors.push({message:"Error loading stream layer. Check websocket url"})}));k&&(k.arcgisProps={title:b.title},b.baseMapLayer&&(b.isReference?(k.attr("data-reference",!0),k._basemapGalleryLayerType="reference"):k._basemapGalleryLayerType=
"basemap"),k instanceof I&&b.layerDefinition&&b.layerDefinition.featureReduction&&"cluster"===b.layerDefinition.featureReduction.type&&(g=b.layerDefinition.featureReduction,g.clusterSize&&(g.clusterSize=u.pt2px(g.clusterSize)),g.clusterRadius&&(g.clusterRadius=u.pt2px(g.clusterRadius)),g.popupInfo&&(g.infoTemplate=new C(g.popupInfo),delete g.popupInfo),k.setFeatureReduction(g)));return k}function ga(a,b,c,f,g){d.forEach(a,function(d){d.layerObject=oa(d,a,b,c,f,g)});var l=d.filter(a,function(a){return!a.isReference}),
w=d.filter(a,function(a){return!!a.isReference});return a=l.concat(w)}function M(a){var b=null;a=a[0];a.url&&!a.type?a.resourceInfo.spatialReference&&(b=new l,a.resourceInfo.spatialReference.wkid&&(b.wkid=a.resourceInfo.spatialReference.wkid),a.resourceInfo.spatialReference.wkt&&(b.wkt=a.resourceInfo.spatialReference.wkt)):a.type&&(-1<a.type.indexOf("BingMaps")||"OpenStreetMap"==a.type?b=new l({wkid:102100}):"WMS"==a.type&&(b=new l({wkid:a.spatialReferences[0]})));return b}function S(a,b,c,f,g,l,
w,e){d.forEach(b,function(b){b.url&&!b.type&&(b.resourceInfo=a[b.deferredsPos][1],delete b.deferredsPos)});l=l||M(b);b=ga(b,c,l,w,e);g.callback(b);return g}function ta(a){!window.CanvasRenderingContext2D&&a.renderer&&"esri.renderer.HeatmapRenderer"===a.renderer.declaredClass&&a.setRenderer(D.fromJson({type:"simple",symbol:{color:[77,77,77,255],size:6,angle:0,xoffset:0,yoffset:0,type:"esriSMS",style:"esriSMSCircle",outline:{color:[255,255,255,255],width:.75,type:"esriSLS",style:"esriSLSSolid"}}}))}
function wa(a,c){var d=U(a);return f({url:d,content:{f:"json"},callbackParamName:"callback",error:function(a,f){a.message=a.message?a.message+(" [url:"+d+"]"):"[url:"+d+"]";c.push(a);b.defaults.io.errorHandler(a,f)}})}function xa(a){var c=W.arcgisUrl+"/"+a.itemId+"/data";return f({url:c,content:{f:"json"},callbackParamName:"callback",error:function(f,d){f.message=f.message?f.message+(" [url:"+c+"]"):"[url:"+c+"]";a.errors=a.errors||[];a.errors.push(f);b.defaults.io.errorHandler(f,d)}})}function pa(b,
c,f){var g=new t;if(!(f.featureCollection&&f.featureCollection.layers||f.layers))return console.log("Invalid Feature Collection item data [item id: "+b.itemId+"]: ",f),b.errors=b.errors||[],b.errors.push({message:"Invalid Feature Collection item data. [item id: "+b.itemId+"]"}),g.errback(),g;f.layers&&(f.featureCollection={layers:f.layers},delete f.layers,a.isDefined(f.showLegend)&&(f.featureCollection.showLegend=f.showLegend,delete f.showLegend));ya(b,f.featureCollection,c).then(function(c){f.featureCollection=
c;b.featureCollection&&b.featureCollection.layers?d.forEach(f.featureCollection.layers,function(c,f){var d=b.featureCollection.layers[f];d.popupInfo||d.layerDefinition?d.layerDefinition?(a.isDefined(d.layerDefinition.minScale)&&a.isDefined(d.layerDefinition.maxScale)&&(d.layerDefinition.minScale!==c.layerDefinition.minScale||d.layerDefinition.maxScale!==c.layerDefinition.maxScale)&&(delete c.layerDefinition.minScale,delete c.layerDefinition.maxScale),d.layerDefinition.drawingInfo&&e.toJson(d.layerDefinition.drawingInfo)!==
e.toJson(c.layerDefinition.drawingInfo)&&delete c.layerDefinition.drawingInfo,d.layerDefinition.showLegend!==c.layerDefinition.showLegend&&delete c.layerDefinition.showLegend,d.layerDefinition=n.mixin(d.layerDefinition,c.layerDefinition)):d.layerDefinition=c.layerDefinition:(d.popupInfo=c.popupInfo,d.layerDefinition=c.layerDefinition);d.featureSet=c.featureSet;d.nextObjectId=c.nextObjectId}):(b.featureCollection=b.featureCollection||{},b.featureCollection=n.mixin(b.featureCollection,f.featureCollection));
g.callback(b)});return g}function ya(b,f,g){var l=new t;m(["./csv"],function(w){var e=[];d.forEach(f.layers,function(a){a.featureSet&&a.featureSet.features&&a.featureSet.features.length&&a.featureSet.features[0].geometry&&a.featureSet.features[0].geometry.spatialReference&&(a.deferredsPos=e.length,e.push(w.projectFeatureCollection(a,g,a.featureSet.features[0].geometry.spatialReference)))});(new c(e)).addCallback(function(){d.forEach(f.layers,function(c){a.isDefined(c.deferredsPos)&&(e[c.deferredsPos].results&&
e[c.deferredsPos].results.length?c=e[c.deferredsPos].results[0]:(console.log("Errors projecting feature collection. ["+b.title+" - "+c.layerDefinition.name+"]"),c.errors=c.errors||[],c.errors.push({message:"Errors projecting feature collection. ["+b.title+" - "+c.layerDefinition.name+"]"})),delete c.deferredsPos)});l.callback(f)})});return l}function qa(a,b,f,g,l){var w=new t,e=new t,h=[],G;d.forEach(a.operationalLayers,function(a){a.itemId&&"Feature Collection"==a.type&&h.push(xa(a).then(n.hitch(null,
pa,a,f)))});0===h.length?za(a,b,f,g,e,l):(G=new c(h),G.addCallback(function(c){za(a,b,f,g,e,l)}));e.then(function(a){h=[];d.forEach(a,function(a){var b;a=a.layerObject;a instanceof I&&!a.loaded&&!a.loadError?(b=new t,r.once(a,"load, error",function(){b.callback(a)}),h.push(b)):a&&"esri.layers.WFSLayer"===a.declaredClass&&!a.loadError&&(b=new t,r.once(a,"fromJsonComplete, error",function(c){b.callback(a)}),h.push(b))});if(h.length){var b=new t;G=new c(h);G.addCallback(function(){b.callback(a)});return b.promise}return a}).then(function(a){var b=
[];d.forEach(a,function(a){var c=a.layerObject;c instanceof I?c.loaded&&c.labelingInfo&&(a.showLabels||c._collection)&&b.push(c):c&&"esri.layers.WFSLayer"===c.declaredClass&&c.loaded&&c.labelingInfo&&b.push(c)});b.length?m(["../layers/LabelLayer"],function(c){var f=new c;d.forEach(b,function(a){f.addFeatureLayer(a)});a.push({layerObject:f});w.callback(a)}):w.callback(a)});return w}function za(a,b,f,g,l,w){var e=[],h=[],G=[];d.forEach(a.operationalLayers,function(a,b){if(a.featureCollection&&a.featureCollection.layers){var c=
a.featureCollection.layers.length;d.forEach(a.featureCollection.layers,function(f,g){var l=!0;a.visibleLayers&&-1==d.indexOf(a.visibleLayers,g)&&(l=!1);f.visibility=a.visibility&&l;f.opacity=a.opacity;f.id=(a.id||"operational"+b)+"_"+g;a.title&&(f.title=1!==c&&f.layerDefinition.name&&a.title!==f.layerDefinition.name?a.title+" - "+f.layerDefinition.name:a.title);G.push(f)},this)}else G.push(a)});d.forEach(a.baseMap.baseMapLayers,function(a,b){a.baseMapLayer=!0;a.id=a.id||"base"+b;e.push(a)});d.forEach(G,
function(a,b){a.id=a.id||"operational"+b;e.push(a)});d.forEach(e,function(a){a.url&&!a.type&&(a.deferredsPos=h.length,a.errors=a.errors||[],h.push(wa(a.url,a.errors)))});0===h.length?(f=f||M(e),e=ga(e,b,f,g,w),l.callback(e)):(new c(h)).addCallback(function(a){S(a,e,b,h,l,f,g,w)});return l}function ra(a,b,c,f){var g=a.minScale,l=a.maxScale;if(10.1>=c.version&&b)for(a=b.length-1;0<=a;a--){if(b[a].id==f)if(0==g&&0<b[a].minScale?g=b[a].minScale:0<g&&0==b[a].minScale?g=c.minScale:0<g&&0<b[a].minScale&&
(g=Math.min(g,b[a].minScale)),l=Math.max(c.maxScale||0,b[a].maxScale||0),c.setScaleRange(g,l),-1<b[a].parentLayerId)f=b[a].parentLayerId;else break}else 10.1<c.version&&(d.forEach(a.layerInfos,function(a){a.id==f&&(0==g&&0<a.minScale?g=a.minScale:0<g&&0==a.minScale||0<g&&0<a.minScale&&(g=Math.min(g,a.minScale)),l=Math.max(l||0,a.maxScale||0))}),c.setScaleRange(g,l))}function na(b,c,f,g){var l=b.url,w=b.__popupIds,e=b.__popupUrls,h=b.__popupWhereClauses,G=b.__popupMinScales,u=b.__popupMaxScales,k=
b.__resourceInfo,x=[];d.forEach(b.__popups,function(g,q){if(g){var r,E=[];d.forEach(g.fieldInfos,function(a){"shape"!==a.fieldName.toLowerCase()&&E.push(a.fieldName)});if(b.dynamicLayerInfos&&0<b.dynamicLayerInfos.length){var D=d.filter(b.dynamicLayerInfos,function(a){return w[q]==a.id})[0].source;r=new I(l+"/dynamicLayer",{id:b.id+"_"+w[q],source:D,outFields:E,mode:I.MODE_SELECTION,infoTemplate:g&&new f(g),drawMode:!1,visible:b.visible,autoGeneralize:!0});var z=function(f,d){0<h[f].length&&d.setDefinitionExpression(h[f]);
if(a.isDefined(G[f])||a.isDefined(u[f]))if(a.isDefined(b.minScale)||a.isDefined(b.maxScale)){var g=b.minScale,l=b.maxScale;0==g&&0<G[f]?g=G[f]:0<g&&0==G[f]||0<g&&0<G[f]&&(g=Math.min(g,G[f]));l=Math.max(l||0,u[f]||0);d.setScaleRange(g,l)}else d.setScaleRange(G[f],u[f]);else ra(b,c||k.layers,d,w[f])};r.loaded?z(q,r):v.connect(r,"onLoad",function(a){z(q,r)})}else{var y=null,S=l+"/"+w[q];if(e[q].length)S=e[q];else if(c)for(D=0;D<c.length;D++)if(c[D].id===w[q]){y=c[D];break}r=new I(U(S),{id:b.id+"_"+w[q],
outFields:E,mode:I.MODE_SELECTION,infoTemplate:g&&new f(g),drawMode:!1,visible:b.visible,resourceInfo:y,autoGeneralize:!0});r.loaded?(0<h[q].length&&r.setDefinitionExpression(h[q]),ra(b,c||k.layers,r,w[q])):v.connect(r,"onLoad",function(a){0<h[q].length&&r.setDefinitionExpression(h[q]);ra(b,c||k.layers,a,w[q])})}x.push(r)}});0<x.length&&(v.connect(b,"onVisibilityChange",n.hitch(this,function(a,b){d.forEach(a,function(a){b?a.show():a.hide()})},x)),v.connect(g,"onLayerRemove",n.hitch(this,function(a,
b,c){a.id===c.id&&d.forEach(b,function(a){g.removeLayer(a)})},b,x)));delete b.__popups;delete b.__popupIds;delete b.__popupUrls;delete b.__popupWhereClauses;delete b.__popupMinScales;delete b.__popupMaxScales;delete b.__resourceInfo;return x}function ua(a){return f({url:U(a.url+"/layers"),content:{f:"json"},callbackParamName:"callback",error:function(){}})}function Ba(a,b,f){var g=[];d.forEach(a,function(a){var b=a.__popups;b&&1<b.length&&10<=a.version&&(a.__deferredsPos=g.length,g.push(ua(a)))});
var l=[];0<g.length?(new c(g)).addCallback(function(c){d.forEach(a,function(a){a.__popups&&0<a.__popups.length&&(a.__deferredsPos||0===a.__deferredsPos?(l=l.concat(na(a,c[a.__deferredsPos][1].layers,f,b)),delete a.__deferredsPos):l=l.concat(na(a,null,f,b)))});b.addLayers(l)}):(d.forEach(a,function(a){a.__popups&&0<a.__popups.length&&(l=l.concat(na(a,null,f,b)))}),b.addLayers(l))}function Ca(a){d.forEach(a,function(a){var b=a.layer;b.toJson&&(a=b.toJson(),a.featureSet&&b.name&&-1<b.name.indexOf("Text")&&
d.forEach(a.featureSet.features,function(a,c){if(a.attributes.TEXT){var f=b.graphics[c];f.symbol.setText(a.attributes.TEXT);a.symbol.horizontalAlignment&&(f.symbol.align=a.symbol.horizontalAlignment);f.setSymbol(f.symbol);f.setAttributes(a.attributes)}},this))})}function ia(a){var b=6;d.forEach(a,function(a){if(a=a.renderer)"esri.renderer.SimpleRenderer"===a.declaredClass?((a=a.symbol)&&a.xoffset&&(b=Math.max(b,Math.abs(a.xoffset))),a&&a.yoffset&&(b=Math.max(b,Math.abs(a.yoffset)))):"esri.renderer.UniqueValueRenderer"!==
a.declaredClass&&"esri.renderer.ClassBreaksRenderer"!==a.declaredClass||d.forEach(a.infos,function(a){(a=a.symbol)&&a.xoffset&&(b=Math.max(b,Math.abs(a.xoffset)));a&&a.yoffset&&(b=Math.max(b,Math.abs(a.yoffset)))})});return b}function G(a){var b=this,c=b.infoWindow,f=a.graphic;if(b.loaded){c.hide();c.clearFeatures();var g=[];d.forEach(b.graphicsLayerIds,function(a){(a=b.getLayer(a))&&a instanceof I&&a.loaded&&a.visible&&(a.clearSelection(),a.infoTemplate&&!a.suspended&&g.push(a))});d.forEach(b.layerIds,
function(a){(a=b.getLayer(a))&&-1!==a.declaredClass.indexOf("ArcGISImageServiceLayer")&&a.loaded&&a.visible&&a.infoTemplate&&g.push(a)});f=f&&f.getInfoTemplate()?f:null;if(g.length||f){var l=ia(g),w=a.screenPoint,e=b.toMap(new B(w.x-l,w.y+l)),l=b.toMap(new B(w.x+l,w.y-l)),h=new A(e.x,e.y,l.x,l.y,b.spatialReference),G=new O;G.geometry=h;G.timeExtent=b.timeExtent;var u=!0,e=d.map(g,function(b){b=b&&b.isFeatureReductionActive&&b.isFeatureReductionActive()?b.getFeatureReductionLayer():b;var c;if(-1!==
b.declaredClass.indexOf("ArcGISImageServiceLayer"))G.geometry=a.mapPoint,u=!1,c=b.queryVisibleRasters(G,{rasterAttributeTableFieldPrefix:"Raster.",returnDomainValues:!0}),c.addCallback(function(){return b.getVisibleRasters()});else if("function"===typeof b.selectFeatures)c=b.selectFeatures(G),c.addCallback(function(){return b.getSelectedFeatures()});else{c=new t;var f=d.filter(b.graphics,function(a){return a&&a.visible&&h.intersects(a.geometry)});c.resolve(f)}return c});f&&(l=new t,l.callback([f]),
e.splice(0,0,l));if(!d.some(e,function(a){return-1===a.fired})){var k=f?1:0;d.forEach(g,function(a){k=-1!==a.declaredClass.indexOf("ArcGISImageServiceLayer")?k+a.getVisibleRasters().length:k+a.getSelectedFeatures().length});if(!k)return}c.setFeatures(e);c.show(a.mapPoint,{closestFirst:u})}}}function la(b,c){var f=c.mapOptions||{},d;f.infoWindow||(d=new E({visibleWhenEmpty:!1},h.create("div")),f.infoWindow=d);a.isDefined(f.showInfoWindowOnClick)||c.usePopupManager||(f.showInfoWindowOnClick=!1);f=new y(b,
f);v.connect(f,"onLayersAddResult",Ca);return f}function ea(a,b,c,f,g,l){var w,e,h,u;f.map?(w=f.map,e=f.clickEventHandle,h=f.clickEventListener,u=f.errors):(w=la(f,g),g.ignorePopups||g.disableClickBehavior||g.usePopupManager||(e=v.connect(w,"onClick",G),h=G));w.addLayers(a);g.ignorePopups||g.usePopupManager||Ba(a,w,g._clazz);var k=u||[];d.forEach(b,function(a){a.errors&&(k=k.concat(a.errors))},this);w.loaded?l.callback({map:w,itemInfo:c,errors:k,clickEventHandle:e,clickEventListener:h}):v.connect(w,
"onLoad",function(){l.callback({map:w,itemInfo:c,errors:k,clickEventHandle:e,clickEventListener:h})})}function Da(a,b,c,f,g){var l=[];d.forEach(g,function(a){n.isArray(a.layerObject)?d.forEach(a.layerObject,function(a){l.push(a)}):l.push(a.layerObject)});if("BingMapsAerial"===g[0].type||"BingMapsRoad"===g[0].type||"BingMapsHybrid"===g[0].type)var w=setInterval(function(){if(g[0].layerObject&&g[0].layerObject.loaded)clearInterval(w),va(a,b,c,f,g,l);else if(g[0].errors){clearInterval(w);var d="";g[0].errors&&
g[0].errors.length&&(d=" ("+g[0].errors[0].message+")");f.errback(Error(X.arcgis.utils.baseLayerError+d))}},10);else if(!l[0]&&g[0].baseMapLayer){var e="";g[0].errors&&g[0].errors.length&&(e=" ("+g[0].errors[0].message+")");f.errback(Error(X.arcgis.utils.baseLayerError+e))}else va(a,b,c,f,g,l)}function va(c,f,w,e,h,G){try{var k=w.mapOptions||{};w.mapOptions=k;var u=c.item,q=c.itemData;!k.backgroundColor&&q.background&&q.background.color&&null!=q.background.color[0]&&(k.backgroundColor=g.toDojoColor(q.background.color));
G=d.filter(G,a.isDefined);if(u)if(u.extent&&u.extent.length)if(k.extent)ea(G,h,c,f,w,e);else{var x=new A(u.extent[0][0],u.extent[0][1],u.extent[1][0],u.extent[1][1],new l({wkid:4326})),r=G[0].spatialReference;4326===r.wkid?(k.extent=x,ea(G,h,c,f,w,e)):102100===r.wkid||102113===r.wkid||3857===r.wkid?(x.xmin=Math.max(x.xmin,-180),x.xmax=Math.min(x.xmax,180),x.ymin=Math.max(x.ymin,-89.99),x.ymax=Math.min(x.ymax,89.99),k.extent=z.geographicToWebMercator(x),ea(G,h,c,f,w,e)):w.geometryServiceURL||b.defaults.geometryService?
(w.geometryServiceURL?new J(w.geometryServiceURL):b.defaults.geometryService).project([x],r,function(a){a=a[0];k.extent=k.extent||a;ea(G,h,c,f,w,e)},function(){ea(G,h,c,f,w,e)}):e.errback(Error(X.arcgis.utils.geometryServiceError))}else ea(G,h,c,f,w,e);else ea(G,h,c,f,w,e)}catch(cb){e.errback(cb)}}function db(a){var b=[];d.forEach(a.operationalLayers,function(a){a.featureCollection?b.push({featureCollection:a.featureCollection,visibility:a.visibility,title:a.title}):a.layerObject&&b.push({layer:a.layerObject,
visibility:a.visibility,title:a.title})});return b}function $a(a){var b=[],c=a.baseMap.baseMapLayers;a.operationalLayers&&(c=c.concat(a.operationalLayers));d.forEach(c,function(a){var c={};if(a.featureCollection&&"CSV"!==a.type)!0===a.featureCollection.showLegend&&d.forEach(a.featureCollection.layers,function(f){if(!1!==f.showLegend){var d=f.layerObject.renderer;c={layer:f.layerObject,title:a.title,defaultSymbol:d&&d.defaultSymbol&&d.defaultLabel?!0:!1};1<a.featureCollection.layers.length&&(c.title+=
" - "+f.layerDefinition.name);b.push(c)}});else if(a.baseMapLayer&&!0===a.showLegend&&a.layerObject||!a.baseMapLayer&&!1!==a.showLegend&&a.layerObject&&!(a.layerObject instanceof I&&a.layerObject.mode===I.MODE_SELECTION)){var f=a.layerObject.renderer,g=a.layerObject.declaredClass,f=!f||f&&f.defaultSymbol&&f.defaultLabel?!0:!1;if(10.1>a.layerObject.version&&("esri.layers.ArcGISDynamicMapServiceLayer"===g||"esri.layers.ArcGISTiledMapServiceLayer"===g)||"esri.layers.ArcGISImageServiceLayer"===g)f=!0;
c={layer:a.layerObject,title:a.title,defaultSymbol:f};a.layers&&(g=d.map(d.filter(a.layers,function(a){return!1===a.showLegend}),function(a){return a.id}),g.length&&(c.hideLayers=g));b.push(c)}});return b}function eb(a,b){function c(a,b){d.forEach(a,function(a,c){switch(a){case "../layers/ArcGISDynamicMapServiceLayer":Ga=b[c];break;case "../layers/ArcGISImageServiceLayer":Na=b[c];break;case "../layers/ArcGISImageServiceVectorLayer":Ma=b[c];break;case "./csv":Wa=b[c];break;case "../layers/CSVLayer":Xa=
b[c];break;case "../layers/DynamicLayerInfo":Ha=b[c];break;case "../layers/GeoRSSLayer":Va=b[c];break;case "../layers/ImageParameters":Fa=b[c];break;case "../layers/ImageServiceParameters":Ja=b[c];break;case "../layers/KMLLayer":Sa=b[c];break;case "../layers/LabelClass":Ya=b[c];break;case "../layers/LayerDrawingOptions":Ia=b[c];break;case "../layers/MosaicRule":La=b[c];break;case "../layers/OpenStreetMapLayer":Oa=b[c];break;case "../layers/RasterFunction":Ka=b[c];break;case "../layers/StreamLayer":Za=
b[c];break;case "../layers/TileInfo":Ua=b[c];break;case "../layers/VectorTileLayer":Aa=b[c];break;case "../virtualearth/VETiledLayer":ha=b[c];break;case "../layers/WebTiledLayer":Ta=b[c];break;case "../layers/WFSLayer":Pa=b[c];break;case "../layers/WMSLayer":Ra=b[c];break;case "../layers/WMSLayerInfo":Qa=b[c]}})}var f=new t,g=a.itemData,l=[];g.baseMap&&g.baseMap.baseMapLayers&&(l=l.concat(g.baseMap.baseMapLayers));g.operationalLayers&&(l=l.concat(g.operationalLayers));for(var g=d.map(l,function(a){return a&&
a.layerType}),w=[],e=[],l=!1,h=0;h<g.length;h++){switch(g[h]){case "ArcGISFeatureLayer":-1===d.indexOf(w,"../layers/LabelClass")&&w.push("../layers/LabelClass");break;case "ArcGISImageServiceLayer":case "ArcGISTiledImageServiceLayer":-1===d.indexOf(w,"../layers/ArcGISImageServiceLayer")&&(w.push("../layers/ArcGISImageServiceLayer"),e.push("../layers/ImageServiceParameters"),e.push("../layers/MosaicRule"),e.push("../layers/RasterFunction"));break;case "ArcGISImageServiceVectorLayer":-1===d.indexOf(w,
"../layers/ArcGISImageServiceVectorLayer")&&(w.push("../layers/ArcGISImageServiceVectorLayer"),e.push("../layers/ImageServiceParameters"),e.push("../layers/MosaicRule"),e.push("../layers/RasterFunction"));break;case "ArcGISMapServiceLayer":case "ArcGISTiledMapServiceLayer":-1===d.indexOf(w,"../layers/ArcGISDynamicMapServiceLayer")&&(w.push("../layers/ArcGISDynamicMapServiceLayer"),e.push("../layers/DynamicLayerInfo"),e.push("../layers/ImageParameters"),e.push("../layers/LayerDrawingOptions"));break;
case "ArcGISStreamLayer":-1===d.indexOf(w,"../layers/StreamLayer")&&w.push("../layers/StreamLayer");break;case "BingMapsAerial":case "BingMapsHybrid":case "BingMapsRoad":-1===d.indexOf(w,"../virtualearth/VETiledLayer")&&w.push("../virtualearth/VETiledLayer");break;case "CSV":-1===d.indexOf(w,"../layers/CSVLayer")&&(w.push("../layers/CSVLayer"),e.push("./csv"));break;case "GeoRSS":-1===d.indexOf(w,"../layers/GeoRSSLayer")&&w.push("../layers/GeoRSSLayer");break;case "KML":-1===d.indexOf(w,"../layers/KMLLayer")&&
w.push("../layers/KMLLayer");break;case "OpenStreetMap":-1===d.indexOf(w,"../layers/OpenStreetMapLayer")&&w.push("../layers/OpenStreetMapLayer");break;case "VectorTileLayer":-1===d.indexOf(w,"../layers/VectorTileLayer")&&w.push("../layers/VectorTileLayer");break;case "WebTiledLayer":-1===d.indexOf(w,"../layers/WebTiledLayer")&&(w.push("../layers/WebTiledLayer"),e.push("../layers/TileInfo"));break;case "WFS":-1===d.indexOf(w,"../layers/WFSLayer")&&w.push("../layers/WFSLayer");break;case "WMS":-1===
d.indexOf(w,"../layers/WMSLayer")&&(w.push("../layers/WMSLayer"),e.push("../layers/WMSLayerInfo"));break;default:l=!0}if(l)break}l&&(w=ab,e=fb);w.length?m(w,function(){c(w,arguments);e.length?m(e,function(){c(e,arguments);f.resolve()}):f.resolve()}):f.resolve();return f}function bb(a,b,c,f){var g=f.itemData;g.baseMap&&g.baseMap.baseMapLayers&&g.baseMap.baseMapLayers.length&&(g.baseMap.baseMapLayers[0].firstLayer=!0);var w=b.layerMixins,l=w&&w.length;if(l){var e=function(a){for(var b=0;b<l;b++){var c=
w[b];if(c.mixin)if(c.hasOwnProperty("id")){if(a.id===c.id){n.mixin(a,c.mixin);break}}else if(a.url===c.url){n.mixin(a,c.mixin);break}}};d.forEach(g.baseMap&&g.baseMap.baseMapLayers,e);d.forEach(g.operationalLayers,e)}eb(f,b).then(function(){return V(f,b)}).then(function(){return ja(f,b)}).then(function(b){var f=b[0],g=b[1];if(f.itemData.operationalLayers&&0!==f.itemData.operationalLayers.length){var w=new t,l=f.itemData.baseMap.baseMapLayers.slice(),e=d.filter(f.itemData.baseMap.baseMapLayers,function(a){return!a.isReference});
b={item:f.item,itemData:{baseMap:{baseMapLayers:e}}};f.itemData.baseMap.baseMapLayers=d.filter(f.itemData.baseMap.baseMapLayers,function(a){return a.isReference});Q(b,g).addCallback(function(b){qa(b.itemData,g).addCallback(n.hitch(null,Da,b,a,g,w))});w.then(function(a){Q(f,g).addCallback(function(b){qa(b.itemData,g,a.map.spatialReference,e,a.map).addCallback(function(f){b.itemData.baseMap.baseMapLayers=l;Da(b,a,g,c,f)})})},n.hitch(c,c.errback))}else Q(f,g).addCallback(function(b){qa(b.itemData,g).addCallback(n.hitch(null,
Da,b,a,g,c))})})}function Ea(a,b){"undefined"===typeof b&&(b=!0);W._arcgisUrl&&0<W._arcgisUrl.length&&(W.arcgisUrl=W._arcgisUrl);var c=W.arcgisUrl+"/"+a,d={},g=new t;f({url:c,content:{f:"json"},callbackParamName:"callback",load:function(a){d.item=a;b?f({url:c+"/data",content:{f:"json"},callbackParamName:"callback",load:function(a){d.itemData=a;g.callback(d)},error:function(a){g.errback(a)}}):g.callback(d)},error:function(a){g.errback(a)}});return g}var W,Ga,Na,Ma,Wa,Xa,Ha,Va,Fa,Ja,Sa,Ya,Ia,La,Oa,
Ka,Za,Ua,Aa,ha,Ta,Pa,Ra,Qa,ab="../layers/ArcGISDynamicMapServiceLayer ../layers/ArcGISImageServiceLayer ../layers/ArcGISImageServiceVectorLayer ../layers/CSVLayer ../layers/GeoRSSLayer ../layers/KMLLayer ../layers/LabelClass ../layers/OpenStreetMapLayer ../layers/StreamLayer ../layers/VectorTileLayer ../virtualearth/VETiledLayer ../layers/WebTiledLayer ../layers/WFSLayer ../layers/WMSLayer".split(" "),fb="./csv ../layers/DynamicLayerInfo ../layers/ImageParameters ../layers/ImageServiceParameters ../layers/LayerDrawingOptions ../layers/MosaicRule ../layers/RasterFunction ../layers/TileInfo ../layers/WMSLayerInfo".split(" ");
W={arcgisUrl:F.getProtocolForWebResource()+"//www.arcgis.com/sharing/rest/content/items",getItem:Ea,createMap:function(a,b,c){var f=new t;c=c||{};var d=c.infoTemplateClass;c._clazz=d&&(n.isObject(d)?d:n.getObject(d))||C;n.isString(a)?Ea(a).addCallback(n.hitch(null,bb,b,c,f)).addErrback(n.hitch(f,f.errback)):bb(b,c,f,a);return f},getLayerList:function(a){return a&&a.itemInfo&&a.itemInfo.itemData?db(a.itemInfo.itemData):[]},getLegendLayers:function(a){return a&&a.itemInfo&&a.itemInfo.itemData?$a(a.itemInfo.itemData):
[]},_arcgisUrl:null,_getItemProps:Q,_getItemData:P,_getBingKey:N,_portalUrlResponse:ba,_portalUrlFailure:Z,_processFSItemProperties:L,_processSSItemProperties:H,_getLayers:qa,_preBuildLayerObjects:S,_buildLayerObjects:ga,_preCreateMap:Da,_getMapSR:M,_createMap:ea,_addSelectionLayers:Ba,_createSelectionFeatureLayers:na,_getServiceInfo:wa,_getFeatureCollectionItem:xa,_mergeFeatureCollectionItem:pa,_projectFeatureCollection:ya,_getLayersInfo:ua,_initLayer:oa,_loadAsCached:ka,_loadAsDynamic:sa,_processPopups:R,
_onLayersAddResult:Ca,_sameSpatialReferenceAsBasemap:aa,_sameTilingSchemeAsBasemap:ca,_showPopup:G,_calculateClickTolerance:ia,_getVisibleFeatureLayers:fa,_updateLayerScaleInfo:ra,_checkUrl:U,_isHostedService:Y,_isAgolService:da,_getLegendLayers:$a};n.setObject("arcgis.utils",W,x);return W})},"dojo/DeferredList":function(){define(["./_base/kernel","./_base/Deferred","./_base/array"],function(m,n,d){m.DeferredList=function(m,t,e,k,r){var c=[];n.call(this);var h=this;0!==m.length||t||this.resolve([0,
[]]);var q=0;d.forEach(m,function(d,x){function b(b,a){c[x]=[b,a];q++;q===m.length&&h.resolve(c)}d.then(function(c){t?h.resolve([x,c]):b(!0,c)},function(c){e?h.reject(c):b(!1,c);if(k)return null;throw c;})})};m.DeferredList.prototype=new n;m.DeferredList.prototype.gatherResults=function(n){n=new m.DeferredList(n,!1,!0,!1);n.addCallback(function(t){var e=[];d.forEach(t,function(d){e.push(d[1])});return e});return n};return m.DeferredList})},"esri/dijit/PopupTemplate":function(){define("dojo/_base/declare dojo/_base/lang dojo/has dojo/dom-construct ../kernel ../InfoTemplate ../PopupInfo ./PopupRenderer".split(" "),
function(m,n,d,v,t,e,k,r){m=m([e,k],{declaredClass:"esri.dijit.PopupTemplate","-chains-":{constructor:"manual"},chartTheme:null,constructor:function(c,d){n.mixin(this,d);this.initialize(c,d)},getTitle:function(c){var d;this.info&&(d=this.titleHasRelatedFields?"":this._getPopupValues(c,null,!0).title);return d||""},getContent:function(c){return this.info?(new r({template:this,graphic:c,chartTheme:this.chartTheme},v.create("div"))).domNode:""}});d("extend-esri")&&n.setObject("dijit.PopupTemplate",m,
t);return m})},"esri/PopupInfo":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/json dojo/i18n dojo/has dojo/Deferred dojo/sniff dojo/promise/all dojox/html/entities ./lang ./kernel ./request ./promiseList ./tasks/query ./tasks/QueryTask ./tasks/RelationshipQuery ./tasks/StatisticDefinition ./support/expressionUtils ./layers/support/attributeUtils dojo/i18n!dojo/cldr/nls/number".split(" "),function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,a,f,l,y,F,B){m=m(null,{declaredClass:"esri.PopupInfo",
_reExprField:/^\s*expression\//i,_exprPrefix:"expression/",_relatedFieldPrefix:"relationships/",initialize:function(a,b){if(a){n.mixin(this,b);this.info=a;this.title=this.getTitle;this.content=this.getContent;this._exprCache=this._compileExpressions(this.info.expressionInfos);var c=this._fieldLabels={},f=this._fieldsMap={};this.info.fieldInfos&&d.forEach(this.info.fieldInfos,function(a){var b=a.fieldName.toLowerCase(),d=this._isExpressionField(b)?this.getExpressionInfo(b):null;c[b]=d?d.title:a.label;
f[b]=a},this);this.titleHasRelatedFields=!(!this.info.title||-1===this.info.title.indexOf("{"+this._relatedFieldPrefix))}},toJson:function(){return v.fromJson(v.toJson(this.info))},getTitle:function(){},getContent:function(){},getFieldInfo:function(a){var b;d.some(this.info&&this.info.fieldInfos,function(c){c.fieldName===a&&(b=c);return!!b});return b},getExpressionInfo:function(a){if(this._isExpressionField(a)){a=a.replace(this._reExprField,"");a=a.toLowerCase();var b;d.some(this.info.expressionInfos,
function(c){c.name.toLowerCase()===a&&(b=c);return!!b});return b}},hasGeometryOperations:function(){return d.some(this.info.expressionInfos,function(a){return y.hasGeometryOperations(a.expression)})},getComponents:function(a){var c=this.info,f={};c.fieldInfos&&(c=d.filter(c.fieldInfos,function(a){return-1!==a.fieldName.indexOf(this._relatedFieldPrefix)},this))&&0<c.length&&(f.relatedInfo=this._getRelatedRecords({graphic:a,fieldsInfo:c}));this._needFullResolutionFeature(a)&&(f.fullResolutionFeature=
this._getFullResolutionFeature(a));return b(f).then(n.hitch(this,function(b){return this._getPopupValues(a,b.fullResolutionFeature)}))},getAttachments:function(a){var b=a.getSourceLayer();a=a.attributes;if(this.info.showAttachments&&b&&b.hasAttachments&&b.objectIdField&&(a=a&&a[b.objectIdField]))return b.queryAttachmentInfos(a)},_needFullResolutionFeature:function(a){return(a=a.getSourceLayer())?"esriGeometryPoint"!==a.geometryType&&"function"===typeof a.getMaxAllowableOffset&&0<a.getMaxAllowableOffset()&&
this.hasGeometryOperations():!1},_getFullResolutionFeature:function(a){var b=a.getSourceLayer(),c=b.objectIdField;a=(a=a.attributes)&&c&&a[c];if(null==a)return null;var f=new g;f.objectIds=[a];f.maxAllowableOffset=0;f.outFields=[c];return b.queryFeatures(f).then(function(a){return a.features&&a.features[0]})},_isExpressionField:function(a){return this._reExprField.test(a)},_compileExpressions:function(a){var b={};d.forEach(a,function(a){var c=a.returnType&&a.returnType.toLowerCase();b[a.name]=F.createAttributeCache({valueExpression:a.expression},
"number"!==c)});return b},_fetchAttributes:function(a,b){var c=n.clone(a.attributes)||{},f=b&&b.geometry,g=this._exprPrefix,l=this._exprCache;d.forEach(this.info.expressionInfos,function(b){var d=g+b.name;b=(b=l[b.name])?a._getDataValue(b.attributeInfo,b,y,null,f):null;"string"===typeof b&&(b=h.encode(b));c[d]=b});return c},_getPopupValues:function(a,b,c){var f=this.info,g=a.getSourceLayer(),l=this._fetchAttributes(a,b),w=n.clone(l);b=f.fieldInfos;var e="",h="",k,u,x,r,y,z=g&&g._getDateOpts&&g._getDateOpts().properties,
z=z&&z.slice(0),t={dateFormat:{properties:z,formatter:"DateFormat"+this._insertOffset(this._dateFormats.shortDateShortTime)}};if(this._relatedInfo)for(r in this._relatedInfo)if(this._relatedInfo.hasOwnProperty(r)){var m=this._relatedInfo[r],F=this._relatedLayersInfo[r];m&&(d.forEach(m.relatedFeatures,function(a){for(y in a.attributes)if(a.attributes.hasOwnProperty(y)&&"esriRelCardinalityOneToOne"===F.relation.cardinality){var b=this._toRelatedFieldName([F.relation.id,y]);l[b]=w[b]=a.attributes[y]}},
this),d.forEach(m.relatedStatsFeatures,function(a){for(y in a.attributes)if(a.attributes.hasOwnProperty(y)){var b=this._toRelatedFieldName([F.relation.id,y]);l[b]=w[b]=a.attributes[y]}},this))}b&&d.forEach(b,function(a){u=a.fieldName;var b=this._getLayerFieldInfo(g,u);b&&(u=a.fieldName=b.name);w[u]=this._formatValue(w[u],u,t);z&&a.format&&a.format.dateFormat&&(a=d.indexOf(z,u),-1<a&&z.splice(a,1))},this);if(g){r=g.types;var A=(m=g.typeIdField)&&l[m];for(u in l)if(l.hasOwnProperty(u)&&-1===u.indexOf(this._relatedFieldPrefix)&&
(x=l[u],q.isDefined(x))){var B=this._getDomainName(g,a,r,A,u,x);q.isDefined(B)?w[u]=B:u===m&&(B=this._getTypeName(g,a,x),q.isDefined(B)&&(w[u]=B))}}f.title&&(e=this._processFieldsInLinks(this._fixTokens(f.title,g),l),e=n.trim(q.substitute(w,e,t)||""));if(c)return{title:e};f.description&&(h=this._processFieldsInLinks(this._fixTokens(f.description,g),l),h=n.trim(q.substitute(w,h,t)||""));b&&(k=[],d.forEach(b,function(a){(u=a.fieldName)&&a.visible&&k.push([this._fieldLabels[u.toLowerCase()]||u,q.substitute(w,
"${"+u+"}",t)||""])},this));var v,R;f.mediaInfos&&(v=[],d.forEach(f.mediaInfos,function(a){R=0;x=a.value;switch(a.type){case "image":var b=x.sourceURL,b=b&&n.trim(q.substitute(l,this._fixTokens(b,g)));R=!!b;break;case "piechart":case "linechart":case "columnchart":case "barchart":var c,b=x.normalizeField;x.fields=d.map(x.fields,function(a){return(c=this._getLayerFieldInfo(g,a))?c.name:a},this);b&&(c=this._getLayerFieldInfo(g,b),x.normalizeField=c?c.name:b);R=d.some(x.fields,function(a){return q.isDefined(l[a])||
-1!==a.indexOf(this._relatedFieldPrefix)&&this._relatedInfo},this);break;default:return}if(R){a=n.clone(a);x=a.value;var b=a.title?this._processFieldsInLinks(this._fixTokens(a.title,g),l):"",f=a.caption?this._processFieldsInLinks(this._fixTokens(a.caption,g),l):"";a.title=b?n.trim(q.substitute(w,b,t)||""):"";a.caption=f?n.trim(q.substitute(w,f,t)||""):"";if("image"===a.type)x.sourceURL=q.substitute(l,this._fixTokens(x.sourceURL,g)),x.linkURL&&(x.linkURL=n.trim(q.substitute(l,this._fixTokens(x.linkURL,
g))||""));else{var e,h;d.forEach(x.fields,function(a,b){if(-1!==a.indexOf(this._relatedFieldPrefix))h=this._getRelatedChartInfos(a,x,l,t),h instanceof Array?x.fields=h:x.fields[b]=h;else{var c=l[a],c=void 0===c?null:c;e=l[x.normalizeField]||0;c&&e&&(c/=e);x.fields[b]={y:c,tooltip:(this._fieldLabels[a.toLowerCase()]||a)+":\x3cbr/\x3e"+this._formatValue(c,a,t,!!e)}}},this)}v.push(a)}},this));return{title:e,description:h,hasDescription:!!f.description,fields:k&&k.length?k:null,mediaInfos:v&&v.length?
v:null,formatted:w,editSummary:g&&g.getEditSummary?g.getEditSummary(a):""}},_getRelatedChartInfos:function(a,b,c,f){var g,l,w,e,h,u;g=[];u=this._fromRelatedFieldName(a);h=u[0];l=this._relatedInfo[h];h=this._relatedLayersInfo[h];l&&d.forEach(l.relatedFeatures,function(d){d=d.attributes;var l,h;for(h in d)if(d.hasOwnProperty(h)&&h===u[1]){l={};e=d[h];b.normalizeField&&(w=-1!==b.normalizeField.indexOf(this._relatedFieldPrefix)?d[this._fromRelatedFieldName(b.normalizeField)[1]]:c[b.normalizeField]);e&&
w&&(e/=w);if(b.tooltipField)if(-1!==b.tooltipField.indexOf(this._relatedFieldPrefix)){var k=this._fromRelatedFieldName(b.tooltipField)[1],x=q.isDefined(d[k])?d[k]:k;l.tooltip=x+":\x3cbr/\x3e"+this._formatValue(e,k,f,!!w)}else l.tooltip=(this._fieldLabels[a.toLowerCase()]||a)+":\x3cbr/\x3e"+this._formatValue(e,b.tooltipField,f,!!w);else l.tooltip=e;l.y=e;g.push(l)}},this);return"esriRelCardinalityOneToMany"===h.relation.cardinality||"esriRelCardinalityManyToMany"===h.relation.cardinality?g:g[0]},_dateFormats:{shortDate:"(datePattern: 'M/d/y', selector: 'date')",
shortDateLE:"(datePattern: 'd/M/y', selector: 'date')",longMonthDayYear:"(datePattern: 'MMMM d, y', selector: 'date')",dayShortMonthYear:"(datePattern: 'd MMM y', selector: 'date')",longDate:"(datePattern: 'EEEE, MMMM d, y', selector: 'date')",shortDateShortTime:"(datePattern: 'M/d/y', timePattern: 'h:mm a', selector: 'date and time')",shortDateLEShortTime:"(datePattern: 'd/M/y', timePattern: 'h:mm a', selector: 'date and time')",shortDateShortTime24:"(datePattern: 'M/d/y', timePattern: 'H:mm', selector: 'date and time')",
shortDateLEShortTime24:"(datePattern: 'd/M/y', timePattern: 'H:mm', selector: 'date and time')",shortDateLongTime:"(datePattern: 'M/d/y', timePattern: 'h:mm:ss a', selector: 'date and time')",shortDateLELongTime:"(datePattern: 'd/M/y', timePattern: 'h:mm:ss a', selector: 'date and time')",shortDateLongTime24:"(datePattern: 'M/d/y', timePattern: 'H:mm:ss', selector: 'date and time')",shortDateLELongTime24:"(datePattern: 'd/M/y', timePattern: 'H:mm:ss', selector: 'date and time')",longMonthYear:"(datePattern: 'MMMM y', selector: 'date')",
shortMonthYear:"(datePattern: 'MMM y', selector: 'date')",year:"(datePattern: 'y', selector: 'date')"},_reHref:/href\s*=\s*\"([^\"]+)\"/ig,_reHrefApos:/href\s*=\s*\'([^\']+)\'/ig,_reEmptyHref:/^href\s*=\s*"\s*"$/i,_reEmptyHrefApos:/^href\s*=\s*'\s*'$/i,_fixTokens:function(a,b){var c=this;return a.replace(/(\{([^\{\r\n]+)\})/g,function(a,f,d){a=c._getLayerFieldInfo(b,d);return"$"+(a?"{"+a.name+"}":f)})},_encodeAttributes:function(a){a=n.clone(a)||{};var b,c;for(b in a)(c=a[b])&&"string"===typeof c&&
(c=encodeURIComponent(c).replace(/\'/g,"\x26apos;"),a[b]=c);return a},_processFieldsInLinks:function(a,b){var c=this._encodeAttributes(b),c=n.hitch(this,this._addValuesToHref,b,c);a&&(a=a.replace(this._reHref,c).replace(this._reHrefApos,c));return a},_addValuesToHref:function(a,b,c,f){f=f&&n.trim(f);c=q.substitute(f&&0===f.indexOf("${")?a:b,c);this._reEmptyHref.test(c)?c='href\x3d"about:blank"':this._reEmptyHrefApos.test(c)&&(c="href\x3d'about:blank'");return c},_getLayerFieldInfo:function(a,b){return a&&
a.getField?a.getField(b):null},_formatValue:function(a,b,c,f){var g=this._fieldsMap[b.toLowerCase()],l=g&&g.format;b=-1!==d.indexOf(c.dateFormat.properties,b);var e="number"===typeof a&&!b&&(!l||!l.dateFormat);if(!q.isDefined(a)||!g||!q.isDefined(l))return e?this._forceLTR(a):a;var w="",g=[],h=l.hasOwnProperty("places")||l.hasOwnProperty("digitSeparator"),u=l.hasOwnProperty("digitSeparator")?l.digitSeparator:!0;if(h&&!b)w="NumberFormat",g.push("places: "+(q.isDefined(l.places)&&(!f||0<l.places)?Number(l.places):
"Infinity")),g.length&&(w+="("+g.join(",")+")");else if(l.dateFormat)w="DateFormat"+this._insertOffset(this._dateFormats[l.dateFormat]||this._dateFormats.shortDateShortTime);else return e?this._forceLTR(a):a;var k=this._applyFormatting(a,w,c);h&&-1<a.constructor.toString().indexOf("Array")&&(k="",d.forEach(a,n.hitch(this,function(a,b){b&&(k+=" ");k+=this._applyFormatting(a,w,c)})));h&&!u&&B.group&&(k=k.replace(new RegExp("\\"+B.group,"g"),""));b&&(k='\x3cspan class\x3d"esriDateValue"\x3e'+k+"\x3c/span\x3e");
return e?this._forceLTR(k):k},_applyFormatting:function(a,b,c){return q.substitute({myKey:a},"${myKey:"+b+"}",c)||""},_forceLTR:function(a){var b=r("ie");return b&&10>=b?a:"\x3cspan class\x3d'esriNumericValue'\x3e"+a+"\x3c/span\x3e"},_insertOffset:function(a){a&&(a=q.isDefined(this.utcOffset)?a.replace(/\)\s*$/,", utcOffset:"+this.utcOffset+")"):a);return a},_getDomainName:function(a,b,c,f,d,g){return(a=a.getDomain&&a.getDomain(d,{feature:b}))&&a.codedValues?a.getName(g):null},_getTypeName:function(a,
b,c){return(a=a.getType&&a.getType(b))&&a.name},_getRelatedRecords:function(a){var b=a.graphic,c;this._relatedLayersInfoPromise||(this._relatedLayersInfoPromise=this._getRelatedLayersInfo(a).then(n.hitch(this,function(a){for(c in a)a.hasOwnProperty(c)&&a[c]&&(this._relatedLayersInfo[c].relatedLayerInfo=a[c])})));return this._relatedLayersInfoPromise.then(n.hitch(this,function(){return this._queryRelatedLayers(b)})).then(n.hitch(this,function(a){this._setRelatedRecords(b,a);return a}))},_getRelatedLayersInfo:function(a){var b=
a.fieldsInfo,f,g,e={};f=a.graphic.getSourceLayer();this._relatedLayersInfo||(this._relatedLayersInfo={});d.forEach(b,function(a){var b,c,g,e;b=this._fromRelatedFieldName(a.fieldName);c=b[0];b=b[1];c&&(!this._relatedLayersInfo[c]&&f&&f.relationships&&(d.some(f.relationships,function(a){if(a.id==c)return e=a,!0}),e&&(this._relatedLayersInfo[c]={relation:e,relatedFields:[],outStatistics:[]})),this._relatedLayersInfo[c]&&(this._relatedLayersInfo[c].relatedFields.push(b),a.statisticType&&(g=new l,g.statisticType=
a.statisticType,g.onStatisticField=b,g.outStatisticFieldName=b,this._relatedLayersInfo[c].outStatistics.push(g))))},this);for(g in this._relatedLayersInfo)this._relatedLayersInfo.hasOwnProperty(g)&&this._relatedLayersInfo[g]&&(a=this._relatedLayersInfo[g].relation,a=f.url.replace(/[0-9]+$/,a.relatedTableId),this._relatedLayersInfo[g].relatedLayerUrl=a,e[g]=x({url:a,content:{f:"json"},callbackParamName:"callback"}));return c(e)},_queryRelatedLayers:function(a){var b={},f;for(f in this._relatedLayersInfo)this._relatedLayersInfo.hasOwnProperty(f)&&
(b[f]=this._queryRelatedLayer({graphic:a,relatedInfo:this._relatedLayersInfo[f]}));return c(b)},_queryRelatedLayer:function(b){var f,l,e,h,u,x,q,r,y,t,m,F,B;f=b.graphic;l=f.getSourceLayer();e=l.url.match(/[0-9]+$/g)[0];m=b.relatedInfo;t=m.relatedLayerInfo;F=m.relatedLayerUrl;b=m.relation;d.some(t.relationships,function(a){if(a.relatedTableId===parseInt(e,10))return h=a,!0},this);h&&(u=new g,d.some(t.fields,function(a){if(a.name===h.keyField)return r=-1!==d.indexOf(["esriFieldTypeSmallInteger","esriFieldTypeInteger",
"esriFieldTypeSingle","esriFieldTypeDouble"],a.type)?"number":"string",!0}),h.relationshipTableId&&h.keyFieldInRelationshipTable?(B=new k,this._queryRelatedRecords(f,h).then(n.hitch(this,function(b){var c;(c=b[f.attributes[l.objectIdField]])?(b=d.map(c.features,function(a){return a.attributes[t.objectIdField]},this),m.outStatistics&&0<m.outStatistics.length&&t.supportsStatistics&&(y=new g,y.objectIds=b,y.outFields=u.outFields,y.outStatistics=m.outStatistics),y&&(x=new a(F),x.execute(y).then(n.hitch(this,
function(a){var b=[];b.push(c);b.push(a);B.resolve(b)})))):B.resolve()}))):(q="string"===r?h.keyField+"\x3d'"+f.attributes[b.keyField]+"'":h.keyField+"\x3d"+f.attributes[b.keyField],u.where=q,u.outFields=m.relatedFields,m.outStatistics&&0<m.outStatistics.length&&t.supportsStatistics&&(y=new g,y.where=u.where,y.outFields=u.outFields,y.outStatistics=m.outStatistics),x=new a(F),q=[],q.push(x.execute(u)),y&&q.push(x.execute(y))));return q?c(q):B?B.promise:void 0},_setRelatedRecords:function(a,b){this._relatedInfo=
[];for(var c in b)if(b.hasOwnProperty(c)&&b[c]){var f=b[c];this._relatedInfo[c]={};this._relatedInfo[c].relatedFeatures=f[0].features;q.isDefined(f[1])&&(this._relatedInfo[c].relatedStatsFeatures=f[1].features)}},_handlerErrorResponse:function(a,b){a.reject(b)},_fromRelatedFieldName:function(a){var b=[];-1!==a.indexOf(this._relatedFieldPrefix)&&(a=a.split("/"),b=a.slice(1));return b},_toRelatedFieldName:function(a){var b="";a&&0<a.length&&(b=this._relatedFieldPrefix+a[0]+"/"+a[1]);return b},_queryRelatedRecords:function(a,
b){var c=a.getSourceLayer(),g=new f;g.outFields=["*"];g.relationshipId=b.id;g.objectIds=[a.attributes[c.objectIdField]];return c.queryRelatedFeatures(g)}});e("extend-esri")&&(u.PopupInfo=u.PopupInfoTemplate=m);return m})},"dojox/html/entities":function(){define(["dojo/_base/lang"],function(m){var n=m.getObject("dojox.html.entities",!0),d=function(d,e){var k,r;if(e._encCache&&e._encCache.regexp&&e._encCache.mapper&&e.length==e._encCache.length)k=e._encCache.mapper,r=e._encCache.regexp;else{k={};r=
["["];var c;for(c=0;c<e.length;c++)k[e[c][0]]="\x26"+e[c][1]+";",r.push(e[c][0]);r.push("]");r=new RegExp(r.join(""),"g");e._encCache={mapper:k,regexp:r,length:e.length}}return d=d.replace(r,function(c){return k[c]})},v=function(d,e){var k,r;if(e._decCache&&e._decCache.regexp&&e._decCache.mapper&&e.length==e._decCache.length)k=e._decCache.mapper,r=e._decCache.regexp;else{k={};r=["("];var c;for(c=0;c<e.length;c++){var h="\x26"+e[c][1]+";";c&&r.push("|");k[h]=e[c][0];r.push(h)}r.push(")");r=new RegExp(r.join(""),
"g");e._decCache={mapper:k,regexp:r,length:e.length}}return d=d.replace(r,function(c){return k[c]})};n.html=[["\x26","amp"],['"',"quot"],["\x3c","lt"],["\x3e","gt"],["\u00a0","nbsp"]];n.latin=[["\u00a1","iexcl"],["\u00a2","cent"],["\u00a3","pound"],["\u20ac","euro"],["\u00a4","curren"],["\u00a5","yen"],["\u00a6","brvbar"],["\u00a7","sect"],["\u00a8","uml"],["\u00a9","copy"],["\u00aa","ordf"],["\u00ab","laquo"],["\u00ac","not"],["\u00ad","shy"],["\u00ae","reg"],["\u00af","macr"],["\u00b0","deg"],["\u00b1",
"plusmn"],["\u00b2","sup2"],["\u00b3","sup3"],["\u00b4","acute"],["\u00b5","micro"],["\u00b6","para"],["\u00b7","middot"],["\u00b8","cedil"],["\u00b9","sup1"],["\u00ba","ordm"],["\u00bb","raquo"],["\u00bc","frac14"],["\u00bd","frac12"],["\u00be","frac34"],["\u00bf","iquest"],["\u00c0","Agrave"],["\u00c1","Aacute"],["\u00c2","Acirc"],["\u00c3","Atilde"],["\u00c4","Auml"],["\u00c5","Aring"],["\u00c6","AElig"],["\u00c7","Ccedil"],["\u00c8","Egrave"],["\u00c9","Eacute"],["\u00ca","Ecirc"],["\u00cb","Euml"],
["\u00cc","Igrave"],["\u00cd","Iacute"],["\u00ce","Icirc"],["\u00cf","Iuml"],["\u00d0","ETH"],["\u00d1","Ntilde"],["\u00d2","Ograve"],["\u00d3","Oacute"],["\u00d4","Ocirc"],["\u00d5","Otilde"],["\u00d6","Ouml"],["\u00d7","times"],["\u00d8","Oslash"],["\u00d9","Ugrave"],["\u00da","Uacute"],["\u00db","Ucirc"],["\u00dc","Uuml"],["\u00dd","Yacute"],["\u00de","THORN"],["\u00df","szlig"],["\u00e0","agrave"],["\u00e1","aacute"],["\u00e2","acirc"],["\u00e3","atilde"],["\u00e4","auml"],["\u00e5","aring"],
["\u00e6","aelig"],["\u00e7","ccedil"],["\u00e8","egrave"],["\u00e9","eacute"],["\u00ea","ecirc"],["\u00eb","euml"],["\u00ec","igrave"],["\u00ed","iacute"],["\u00ee","icirc"],["\u00ef","iuml"],["\u00f0","eth"],["\u00f1","ntilde"],["\u00f2","ograve"],["\u00f3","oacute"],["\u00f4","ocirc"],["\u00f5","otilde"],["\u00f6","ouml"],["\u00f7","divide"],["\u00f8","oslash"],["\u00f9","ugrave"],["\u00fa","uacute"],["\u00fb","ucirc"],["\u00fc","uuml"],["\u00fd","yacute"],["\u00fe","thorn"],["\u00ff","yuml"],
["\u0192","fnof"],["\u0391","Alpha"],["\u0392","Beta"],["\u0393","Gamma"],["\u0394","Delta"],["\u0395","Epsilon"],["\u0396","Zeta"],["\u0397","Eta"],["\u0398","Theta"],["\u0399","Iota"],["\u039a","Kappa"],["\u039b","Lambda"],["\u039c","Mu"],["\u039d","Nu"],["\u039e","Xi"],["\u039f","Omicron"],["\u03a0","Pi"],["\u03a1","Rho"],["\u03a3","Sigma"],["\u03a4","Tau"],["\u03a5","Upsilon"],["\u03a6","Phi"],["\u03a7","Chi"],["\u03a8","Psi"],["\u03a9","Omega"],["\u03b1","alpha"],["\u03b2","beta"],["\u03b3",
"gamma"],["\u03b4","delta"],["\u03b5","epsilon"],["\u03b6","zeta"],["\u03b7","eta"],["\u03b8","theta"],["\u03b9","iota"],["\u03ba","kappa"],["\u03bb","lambda"],["\u03bc","mu"],["\u03bd","nu"],["\u03be","xi"],["\u03bf","omicron"],["\u03c0","pi"],["\u03c1","rho"],["\u03c2","sigmaf"],["\u03c3","sigma"],["\u03c4","tau"],["\u03c5","upsilon"],["\u03c6","phi"],["\u03c7","chi"],["\u03c8","psi"],["\u03c9","omega"],["\u03d1","thetasym"],["\u03d2","upsih"],["\u03d6","piv"],["\u2022","bull"],["\u2026","hellip"],
["\u2032","prime"],["\u2033","Prime"],["\u203e","oline"],["\u2044","frasl"],["\u2118","weierp"],["\u2111","image"],["\u211c","real"],["\u2122","trade"],["\u2135","alefsym"],["\u2190","larr"],["\u2191","uarr"],["\u2192","rarr"],["\u2193","darr"],["\u2194","harr"],["\u21b5","crarr"],["\u21d0","lArr"],["\u21d1","uArr"],["\u21d2","rArr"],["\u21d3","dArr"],["\u21d4","hArr"],["\u2200","forall"],["\u2202","part"],["\u2203","exist"],["\u2205","empty"],["\u2207","nabla"],["\u2208","isin"],["\u2209","notin"],
["\u220b","ni"],["\u220f","prod"],["\u2211","sum"],["\u2212","minus"],["\u2217","lowast"],["\u221a","radic"],["\u221d","prop"],["\u221e","infin"],["\u2220","ang"],["\u2227","and"],["\u2228","or"],["\u2229","cap"],["\u222a","cup"],["\u222b","int"],["\u2234","there4"],["\u223c","sim"],["\u2245","cong"],["\u2248","asymp"],["\u2260","ne"],["\u2261","equiv"],["\u2264","le"],["\u2265","ge"],["\u2282","sub"],["\u2283","sup"],["\u2284","nsub"],["\u2286","sube"],["\u2287","supe"],["\u2295","oplus"],["\u2297",
"otimes"],["\u22a5","perp"],["\u22c5","sdot"],["\u2308","lceil"],["\u2309","rceil"],["\u230a","lfloor"],["\u230b","rfloor"],["\u2329","lang"],["\u232a","rang"],["\u25ca","loz"],["\u2660","spades"],["\u2663","clubs"],["\u2665","hearts"],["\u2666","diams"],["\u0152","OElig"],["\u0153","oelig"],["\u0160","Scaron"],["\u0161","scaron"],["\u0178","Yuml"],["\u02c6","circ"],["\u02dc","tilde"],["\u2002","ensp"],["\u2003","emsp"],["\u2009","thinsp"],["\u200c","zwnj"],["\u200d","zwj"],["\u200e","lrm"],["\u200f",
"rlm"],["\u2013","ndash"],["\u2014","mdash"],["\u2018","lsquo"],["\u2019","rsquo"],["\u201a","sbquo"],["\u201c","ldquo"],["\u201d","rdquo"],["\u201e","bdquo"],["\u2020","dagger"],["\u2021","Dagger"],["\u2030","permil"],["\u2039","lsaquo"],["\u203a","rsaquo"]];n.encode=function(t,e){t&&(e?t=d(t,e):(t=d(t,n.html),t=d(t,n.latin)));return t};n.decode=function(d,e){d&&(e?d=v(d,e):(d=v(d,n.html),d=v(d,n.latin)));return d};return n})},"esri/tasks/QueryTask":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/Deferred dojo/_base/json dojo/has ../kernel ../request ../deferredUtils ../geometry/Extent ../geometry/normalizeUtils ./Task ./FeatureSet".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x){m=m(u,{declaredClass:"esri.tasks.QueryTask",_eventMap:{complete:["featureSet"],"execute-for-count-complete":["count"],"execute-for-ids-complete":["objectIds"],"execute-relationship-query-complete":["featureSets"]},constructor:function(b,c){this._handler=n.hitch(this,this._handler);this._relationshipQueryHandler=n.hitch(this,this._relationshipQueryHandler);this._executeForIdsHandler=n.hitch(this,this._executeForIdsHandler);this._countHandler=n.hitch(this,this._countHandler);
this._extentHandler=n.hitch(this,this._extentHandler);this.source=c&&c.source;this.gdbVersion=c&&c.gdbVersion;this.registerConnectEvents()},__msigns:[{n:"execute",c:4,a:[{i:0,p:["geometry"]}],e:2},{n:"executeForIds",c:3,a:[{i:0,p:["geometry"]}],e:2},{n:"executeForCount",c:3,a:[{i:0,p:["geometry"]}],e:2},{n:"executeForExtent",c:3,a:[{i:0,p:["geometry"]}],e:2}],onComplete:function(){},onExecuteRelationshipQueryComplete:function(){},onExecuteForIdsComplete:function(){},onExecuteForCountComplete:function(){},
onExecuteForExtentComplete:function(){},execute:function(b,c,a,f,d){f=d.assembly;b=this._encode(n.mixin({},this._url.query,{f:"json"},b.toJson(f&&f[0])));var g=this._handler,l=this._errorHandler;this.source&&(f={source:this.source.toJson()},b.layer=t.toJson(f));this.gdbVersion&&(b.gdbVersion=this.gdbVersion);return r({url:this._url.path+"/query",content:b,callbackParamName:"callback",load:function(b,f){g(b,f,c,a,d.dfd)},error:function(b){l(b,a,d.dfd)}},this.requestOptions)},executeRelationshipQuery:function(b,
d,a){b=this._encode(n.mixin({},this._url.query,{f:"json"},b.toJson()));var f=this._relationshipQueryHandler,g=this._errorHandler;this.gdbVersion&&(b.gdbVersion=this.gdbVersion);var e=new v(c._dfdCanceller);e._pendingDfd=r({url:this._url.path+"/queryRelatedRecords",content:b,callbackParamName:"callback",load:function(b,c){f(b,c,d,a,e)},error:function(b){g(b,a,e)}},this.requestOptions);return e},executeForIds:function(b,c,a,f){var d=f.assembly;b=this._encode(n.mixin({},this._url.query,{f:"json",returnIdsOnly:!0},
b.toJson(d&&d[0])));var g=this._executeForIdsHandler,e=this._errorHandler;this.source&&(d={source:this.source.toJson()},b.layer=t.toJson(d));this.gdbVersion&&(b.gdbVersion=this.gdbVersion);return r({url:this._url.path+"/query",content:b,callbackParamName:"callback",load:function(b,d){g(b,d,c,a,f.dfd)},error:function(b){e(b,a,f.dfd)}},this.requestOptions)},executeForCount:function(b,c,a,f){var d=f.assembly;b=this._encode(n.mixin({},this._url.query,{f:"json",returnIdsOnly:!0,returnCountOnly:!0},b.toJson(d&&
d[0])));var g=this._countHandler,e=this._errorHandler;this.source&&(d={source:this.source.toJson()},b.layer=t.toJson(d));this.gdbVersion&&(b.gdbVersion=this.gdbVersion);return r({url:this._url.path+"/query",content:b,callbackParamName:"callback",load:function(b,d){g(b,d,c,a,f.dfd)},error:function(b){e(b,a,f.dfd)}},this.requestOptions)},executeForExtent:function(b,c,a,f){var d=f.assembly;b=this._encode(n.mixin({},this._url.query,{f:"json",returnExtentOnly:!0,returnCountOnly:!0},b.toJson(d&&d[0])));
var g=this._extentHandler,e=this._errorHandler;this.source&&(d={source:this.source.toJson()},b.layer=t.toJson(d));this.gdbVersion&&(b.gdbVersion=this.gdbVersion);return r({url:this._url.path+"/query",content:b,callbackParamName:"callback",load:function(b,d){g(b,d,c,a,f.dfd)},error:function(b){e(b,a,f.dfd)}},this.requestOptions)},_handler:function(b,c,a,f,d){try{var g=new x(b);this._successHandler([g],"onComplete",a,d)}catch(F){this._errorHandler(F,f,d)}},_relationshipQueryHandler:function(b,c,a,f,
l){try{var g=b.geometryType,e=b.spatialReference,h={};d.forEach(b.relatedRecordGroups,function(a){var b={};b.geometryType=g;b.spatialReference=e;b.features=a.relatedRecords;b=new x(b);if(null!=a.objectId)h[a.objectId]=b;else for(var c in a)a.hasOwnProperty(c)&&"relatedRecords"!==c&&(h[a[c]]=b)});this._successHandler([h],"onExecuteRelationshipQueryComplete",a,l)}catch(A){this._errorHandler(A,f,l)}},_executeForIdsHandler:function(b,c,a,f,d){try{this._successHandler([b.objectIds],"onExecuteForIdsComplete",
a,d)}catch(y){this._errorHandler(y,f,d)}},_countHandler:function(b,c,a,f,d){try{var g,l=b.features,e=b.objectIds;if(e)g=e.length;else{if(l)throw Error("Unable to perform query. Please check your parameters.");g=b.count}this._successHandler([g],"onExecuteForCountComplete",a,d)}catch(A){this._errorHandler(A,f,d)}},_extentHandler:function(b,c,a,f,d){try{b.extent&&(b.extent=new h(b.extent)),this._successHandler([b],"onExecuteForExtentComplete",a,d)}catch(y){this._errorHandler(y,f,d)}}});q._createWrappers(m);
e("extend-esri")&&n.setObject("tasks.QueryTask",m,k);return m})},"esri/tasks/FeatureSet":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has ../kernel ../lang ../graphic ../SpatialReference ../graphicsUtils ../geometry/jsonUtils ../symbols/jsonUtils".split(" "),function(m,n,d,v,t,e,k,r,c,h,q){m=m(null,{declaredClass:"esri.tasks.FeatureSet",constructor:function(c){if(c){n.mixin(this,c);var e=this.features,b=c.spatialReference,g=h.getGeometryType(c.geometryType),b=this.spatialReference=
new r(b);this.geometryType=c.geometryType;c.fields&&(this.fields=c.fields);d.forEach(e,function(a,c){var f=a.geometry&&a.geometry.spatialReference;e[c]=new k(g&&a.geometry?new g(a.geometry):null,a.symbol&&q.fromJson(a.symbol),a.attributes);e[c].geometry&&!f&&e[c].geometry.setSpatialReference(b)});this._hydrate()}else this.features=[]},displayFieldName:null,geometryType:null,spatialReference:null,fieldAliases:null,toJson:function(d){var u={};this.displayFieldName&&(u.displayFieldName=this.displayFieldName);
this.fields&&(u.fields=this.fields);this.spatialReference?u.spatialReference=this.spatialReference.toJson():this.features[0]&&this.features[0].geometry&&(u.spatialReference=this.features[0].geometry.spatialReference.toJson());this.features[0]&&(this.features[0].geometry&&(u.geometryType=h.getJsonType(this.features[0].geometry)),u.features=c._encodeGraphics(this.features,d));u.geometryType=u.geometryType||this.geometryType;u.exceededTransferLimit=this.exceededTransferLimit;u.transform=this.transform;
return e.fixJson(u)},_hydrate:function(){var c=this.transform,d=this.geometryType;if(c&&d)for(var b=this.features,g=c.translate[0],a=c.translate[1],f=c.scale[0],e=c.scale[1],h=function(a,b,c){if("esriGeometryPoint"===a)return function(a){a.x=b(a.x);a.y=c(a.y)};if("esriGeometryPolyline"===a||"esriGeometryPolygon"===a)return function(a){a=a.rings||a.paths;var f,d,g,e,l,h,u,k;f=0;for(d=a.length;f<d;f++)for(l=a[f],g=0,e=l.length;g<e;g++)h=l[g],0<g?(u+=h[0],k+=h[1]):(u=h[0],k=h[1]),h[0]=b(u),h[1]=c(k)};
if("esriGeometryEnvelope"===a)return function(a){a.xmin=b(a.xmin);a.ymin=c(a.ymin);a.xmax=b(a.xmax);a.ymax=c(a.ymax)};if("esriGeometryMultipoint"===a)return function(a){a=a.points;var f,d,g,e,l;f=0;for(d=a.length;f<d;f++)g=a[f],0<f?(e+=g[0],l+=g[1]):(e=g[0],l=g[1]),g[0]=b(e),g[1]=c(l)}}(d,function(a){return a*f+g},function(b){return a-b*e}),c=0,d=b.length;c<d;c++)b[c].geometry&&h(b[c].geometry);this.transform=null},quantize:function(c){if(!this.geometryType)return this.transform=null,this;var d=c.translate[0],
b=c.translate[1],g=c.scale[0],a=c.scale[1],f=this.features,e=function(a,b,c){var f,d,g,e,l,h,w=[];f=0;for(d=a.length;f<d;f++)if(g=a[f],0<f){if(h=b(g[0]),g=c(g[1]),h!==e||g!==l)w.push([h-e,g-l]),e=h,l=g}else e=b(g[0]),l=c(g[1]),w.push([e,l]);return 0<w.length?w:null},h=function(a,b,c){if("esriGeometryPoint"===a)return function(a){a.x=b(a.x);a.y=c(a.y);return a};if("esriGeometryPolyline"===a||"esriGeometryPolygon"===a)return function(a){var f,d,g,l,h;g=a.rings||a.paths;h=[];f=0;for(d=g.length;f<d;f++)l=
g[f],(l=e(l,b,c))&&h.push(l);return 0<h.length?(a.rings?a.rings=h:a.paths=h,a):null};if("esriGeometryMultipoint"===a)return function(a){var f;f=e(a.points,b,c);return 0<f.length?(a.points=f,a):null};if("esriGeometryEnvelope"===a)return function(a){return a}}(this.geometryType,function(a){return Math.round((a-d)/g)},function(c){return Math.round((b-c)/a)}),k,u;k=0;for(u=f.length;k<u;k++)f[k].geometry&&(h(f[k].geometry)||f[k].setGeometry(null));this.transform=c;return this}});v("extend-esri")&&n.setObject("tasks.FeatureSet",
m,t);return m})},"esri/tasks/RelationshipQuery":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/_base/json","dojo/has","../kernel"],function(m,n,d,v,t){m=m(null,{declaredClass:"esri.tasks.RelationshipQuery",definitionExpression:"",relationshipId:null,returnGeometry:!1,objectIds:null,outSpatialReference:null,outFields:null,toJson:function(){var e={definitionExpression:this.definitionExpression,relationshipId:this.relationshipId,returnGeometry:this.returnGeometry,maxAllowableOffset:this.maxAllowableOffset,
geometryPrecision:this.geometryPrecision},k=this.objectIds,r=this.outFields,c=this.outSpatialReference;k&&(e.objectIds=k.join(","));r&&(e.outFields=r.join(","));c&&(e.outSR=c.wkid||d.toJson(c.toJson()));e._ts=this._ts;return e}});v("extend-esri")&&n.setObject("tasks.RelationshipQuery",m,t);return m})},"esri/tasks/StatisticDefinition":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel"],function(m,n,d,v){m=m(null,{declaredClass:"esri.tasks.StatisticDefinition",toJson:function(){return{statisticType:this.statisticType,
onStatisticField:this.onStatisticField,outStatisticFieldName:this.outStatisticFieldName,maxPointCount:this.maxPointCount,maxRecordCount:this.maxRecordCount,maxVertexCount:this.maxVertexCount}}});d("extend-esri")&&n.setObject("tasks.StatisticDefinition",m,v);return m})},"esri/dijit/PopupRenderer":function(){define("require dojo/_base/declare dojo/_base/connect dojo/_base/lang dojo/_base/array dojo/_base/kernel dojo/sniff dojo/query dojo/dom dojo/dom-attr dojo/dom-class dojo/dom-construct dojo/dom-style dojox/html/entities dijit/_Widget dijit/_Templated ../kernel ../lang ../urlUtils ./_EventedWidget dojo/i18n!../nls/jsapi dojo/NodeList-dom".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,a,f,l,y,F,B){var A=0,z=B.widgets.popup,w=B.widgets.templatePicker;n=n([F,g,a],{declaredClass:"esri.dijit._PopupRenderer",constructor:function(){this._nls=v.mixin({},z)},templateString:"\x3cdiv class\x3d'esriViewPopup'\x3e\x3cdiv class\x3d'statusSection hidden' dojoAttachPoint\x3d'_status'\x3e\x3c/div\x3e\x3cdiv class\x3d'mainSection'\x3e\x3cdiv class\x3d'header' dojoAttachPoint\x3d'_title'\x3e\x3c/div\x3e\x3cdiv class\x3d'hzLine'\x3e\x3c/div\x3e\x3cdiv dojoAttachPoint\x3d'_description'\x3e\x3c/div\x3e\x3cdiv class\x3d'break'\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d'attachmentsSection hidden'\x3e\x3cdiv\x3e${_nls.NLS_attach}:\x3c/div\x3e\x3cul dojoAttachPoint\x3d'_attachmentsList'\x3e\x3c/ul\x3e\x3cdiv class\x3d'break'\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d'mediaSection hidden'\x3e\x3cdiv class\x3d'header' dojoAttachPoint\x3d'_mediaTitle'\x3e\x3c/div\x3e\x3cdiv class\x3d'hzLine'\x3e\x3c/div\x3e\x3cdiv class\x3d'caption' dojoAttachPoint\x3d'_mediaCaption'\x3e\x3c/div\x3e\x3cdiv class\x3d'gallery' dojoAttachPoint\x3d'_gallery'\x3e\x3cdiv class\x3d'mediaHandle prev' dojoAttachPoint\x3d'_prevMedia' dojoAttachEvent\x3d'onclick: _goToPrevMedia'\x3e\x3c/div\x3e\x3cdiv class\x3d'mediaHandle next' dojoAttachPoint\x3d'_nextMedia' dojoAttachEvent\x3d'onclick: _goToNextMedia'\x3e\x3c/div\x3e\x3cul class\x3d'summary'\x3e\x3cli class\x3d'image mediaCount hidden' dojoAttachPoint\x3d'_imageCount'\x3e0\x3c/li\x3e\x3cli class\x3d'image mediaIcon hidden'\x3e\x3c/li\x3e\x3cli class\x3d'chart mediaCount hidden' dojoAttachPoint\x3d'_chartCount'\x3e0\x3c/li\x3e\x3cli class\x3d'chart mediaIcon hidden'\x3e\x3c/li\x3e\x3c/ul\x3e\x3cdiv class\x3d'frame' dojoAttachPoint\x3d'_mediaFrame'\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d'editSummarySection hidden' dojoAttachPoint\x3d'_editSummarySection'\x3e\x3cdiv class\x3d'break'\x3e\x3c/div\x3e\x3cdiv class\x3d'break hidden' dojoAttachPoint\x3d'_mediaBreak'\x3e\x3c/div\x3e\x3cdiv class\x3d'editSummary' dojoAttachPoint\x3d'_editSummary'\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e",
showTitle:!0,startup:function(){this.inherited(arguments);this._showStatus(w.loading);this._contentDfd=this.template.getComponents(this.graphic).then(v.hitch(this,this._handleComponentsSuccess)).otherwise(v.hitch(this,this._handleComponentsError))},destroy:function(){this._contentDfd&&this._contentDfd.cancel();this._attachmentsDfd&&this._attachmentsDfd.cancel();this._destroyFrame();this.template=this.graphic=this._nls=this._mediaInfos=this._mediaPtr=this._contentDfd=this._attachmentsDfd=null;this.inherited(arguments)},
_goToPrevMedia:function(){0>this._mediaPtr-1||(this._mediaPtr--,this._updateUI(),this._displayMedia())},_goToNextMedia:function(){this._mediaPtr+1!==this._mediaInfos.length&&(this._mediaPtr++,this._updateUI(),this._displayMedia())},_updateUI:function(){var a=this._mediaInfos,b=a.length,c=this.domNode,f=this._prevMedia,d=this._nextMedia;if(1<b){var g=0,l=0;t.forEach(a,function(a){"image"===a.type?g++:-1!==a.type.indexOf("chart")&&l++});g&&(h.set(this._imageCount,"innerHTML",g),e.query(".summary .image",
c).removeClass("hidden"));l&&(h.set(this._chartCount,"innerHTML",l),e.query(".summary .chart",c).removeClass("hidden"))}else e.query(".summary",c).addClass("hidden"),q.add(f,"hidden"),q.add(d,"hidden");a=this._mediaPtr;0===a?q.add(f,"hidden"):q.remove(f,"hidden");a===b-1?q.add(d,"hidden"):q.remove(d,"hidden");this._destroyFrame()},_displayMedia:function(){var a=this._mediaInfos[this._mediaPtr],b=a.title,c=a.caption,f=e.query(".mediaSection .hzLine",this.domNode)[0];h.set(this._mediaTitle,"innerHTML",
b);q[b?"remove":"add"](this._mediaTitle,"hidden");h.set(this._mediaCaption,"innerHTML",c);q[c?"remove":"add"](this._mediaCaption,"hidden");q[b&&c?"remove":"add"](f,"hidden");this._rid=null;if("image"===a.type)this._showImage(a);else{var d=this,b=["dojox/charting/Chart2D","dojox/charting/action2d/Tooltip"],c=a.value.theme||this.chartTheme;v.isString(c)&&(c=c.replace(/\./gi,"/"),-1===c.indexOf("/")&&(c="dojox/charting/themes/"+c));c||(c="./Rainbow");b.push(c);try{var g=this._rid=A++;m(b,function(b,
c,f){g===d._rid&&(d._rid=null,d._showChart(a.type,a.value,b,c,f))})}catch(I){console.log("PopupRenderer: error loading modules")}}},_preventNewTab:function(a){return(a=a&&v.trim(a).toLowerCase())&&(0===a.indexOf("mailto:")||0===a.indexOf("tel:"))},_showImage:function(a){q.add(this._mediaFrame,"image");var b=x.get(this._gallery,"height"),c=a.value,f;c.linkURL&&(f=u.create("a",{href:c.linkURL,target:this._preventNewTab(c.linkURL)?"":"_blank"},this._mediaFrame));c=a.refreshInterval?this._addURLParameter(c.sourceURL,
"timestamp",Date.now()):c.sourceURL;u.create("img",{className:"esriPopupMediaImage",src:c},f||this._mediaFrame);var g=e.query(".esriPopupMediaImage",this._mediaFrame)[0];this._imageLoadHandle=d.connect(g,"onload",this,function(){this._clearImageHandles();this._imageLoaded(g,b);this._initImageRefresh(a)})},_addURLParameter:function(a,b,c){var f=-1===a.indexOf("?")?"?":"\x26";return a+f+b+"\x3d"+c},_initImageRefresh:function(a){if(a.refreshInterval){var b=6E4*a.refreshInterval;this._imageRefreshHandle=
setTimeout(v.hitch(this,function(){this._destroyFrame();this._showImage(a)}),b)}},_clearImageHandles:function(){d.disconnect(this._imageLoadHandle);this._imageLoadHandle=null;clearTimeout(this._imageRefreshHandle);this._imageRefreshHandle=null},_showChart:function(a,b,c,f,d){q.remove(this._mediaFrame,"image");c=this._chart=new c(u.create("div",{"class":"chart"},this._mediaFrame),{margins:{l:4,t:4,r:4,b:4}});d&&c.setTheme(d);switch(a){case "piechart":c.addPlot("default",{type:"Pie",labels:!1});c.addSeries("Series A",
b.fields);break;case "linechart":c.addPlot("default",{type:"Markers"});c.addAxis("x",{min:0,majorTicks:!1,minorTicks:!1,majorLabels:!1,minorLabels:!1});c.addAxis("y",{includeZero:!0,vertical:!0,fixUpper:"minor"});t.forEach(b.fields,function(a,b){a.x=b+1});c.addSeries("Series A",b.fields);break;case "columnchart":c.addPlot("default",{type:"Columns",gap:3});c.addAxis("y",{includeZero:!0,vertical:!0,fixUpper:"minor"});c.addSeries("Series A",b.fields);break;case "barchart":c.addPlot("default",{type:"Bars",
gap:3}),c.addAxis("x",{includeZero:!0,fixUpper:"minor",minorLabels:!1}),c.addAxis("y",{vertical:!0,majorTicks:!1,minorTicks:!1,majorLabels:!1,minorLabels:!1}),c.addSeries("Series A",b.fields)}this._action=new f(c);c.render()},_destroyFrame:function(){this._rid=null;this._clearImageHandles();this._chart&&(this._chart.destroy(),this._chart=null);this._action&&(this._action.destroy(),this._action=null);h.set(this._mediaFrame,"innerHTML","")},_imageLoaded:function(a,b){var c=a.height;c<b&&x.set(a,"marginTop",
Math.round((b-c)/2)+"px")},_attListHandler:function(a,b){if(a===this._attachmentsDfd){this._attachmentsDfd=null;var c="";b instanceof Error||!b||!b.length||t.forEach(b,function(a){c+="\x3cli\x3e";c+="\x3ca href\x3d'"+y.addProxy(a.url)+"' target\x3d'_blank'\x3e"+(a.name||"[No name]")+"\x3c/a\x3e";c+="\x3c/li\x3e"});h.set(this._attachmentsList,"innerHTML",c||"\x3cli\x3e"+this._nls.NLS_noAttach+"\x3c/li\x3e")}},_supportedURIInfos:[{pattern:/^\s*(https?:\/\/([^\s]+))\s*$/i,label:z.NLS_moreInfo},{pattern:/^\s*(tel:([^\s]+))\s*$/i,
label:"${hierPart}"},{pattern:/^\s*(mailto:([^\s]+))\s*$/i,label:"${hierPart}"},{pattern:/^\s*(arcgis-appstudio-player:\/\/([^\s]+))\s*$/i,appName:"App Studio Player",label:z.NLS_openLinkInApp},{pattern:/^\s*(arcgis-collector:\/\/([^\s]+))\s*$/i,appName:"Collector",label:z.NLS_openLinkInApp},{pattern:/^\s*(arcgis-explorer:\/\/([^\s]+))\s*$/i,appName:"Explorer",label:z.NLS_openLinkInApp},{pattern:/^\s*(arcgis-navigator:\/\/([^\s]+))\s*$/i,appName:"Navigator",label:z.NLS_openLinkInApp},{pattern:/^\s*(arcgis-survey123:\/\/([^\s]+))\s*$/i,
appName:"Survey123",label:z.NLS_openLinkInApp},{pattern:/^\s*(arcgis-trek2there:\/\/([^\s]+))\s*$/i,appName:"Trek2There",label:z.NLS_openLinkInApp},{pattern:/^\s*(arcgis-workforce:\/\/([^\s]+))\s*$/i,appName:"Workforce",label:z.NLS_openLinkInApp},{pattern:/^\s*(iform:\/\/([^\s]+))\s*$/i,appName:"iForm",label:z.NLS_openLinkInApp},{pattern:/^\s*(flow:\/\/([^\s]+))\s*$/i,appName:"FlowFinity",label:z.NLS_openLinkInApp},{pattern:/^\s*(lfmobile:\/\/([^\s]+))\s*$/i,appName:"Laserfische",label:z.NLS_openLinkInApp},
{pattern:/^\s*(mspbi:\/\/([^\s]+))\s*$/i,appName:"Microsoft Power BI",label:z.NLS_openLinkInApp}],_findURIInfo:function(a){var b;t.some(this._supportedURIInfos,function(c){c.pattern.test(a)&&(b=c);return!!b});return b},_createLinkIfURI:function(a){var b=this._findURIInfo(a);if(b){var c=a.match(b.pattern);return a.replace(b.pattern,"\x3ca target\x3d'_blank' href\x3d'$1' title\x3d'$1'\x3e"+l.substitute({appName:b.appName,hierPart:c&&c[2]},b.label)+"\x3c/a\x3e")}return a},_showStatus:function(a){h.set(this._status,
"innerHTML",a);q.remove(this._status,"hidden");e.query(".mainSection",this.domNode).addClass("hidden")},_hideStatus:function(){h.set(this._status,"innerHTML","");q.add(this._status,"hidden");e.query(".mainSection",this.domNode).removeClass("hidden")},_handleComponentsSuccess:function(a){if(a){this._hideStatus();var f=this.showTitle?a.title:"",d=a.description,g=a.fields,l=a.mediaInfos,w=this.domNode,k=this._nls,u=this,x=this.template,r=this.graphic;this._prevMedia.title=k.NLS_prevMedia;this._nextMedia.title=
k.NLS_nextMedia;h.set(this._title,"innerHTML",f);f||q.add(this._title,"hidden");!a.hasDescription&&g&&(d="",t.forEach(g,function(a){d+="\x3ctr valign\x3d'top'\x3e";d+="\x3ctd class\x3d'attrName'\x3e"+b.encode(a[0])+"\x3c/td\x3e";d+="\x3ctd class\x3d'attrValue'\x3e"+this._createLinkIfURI(a[1])+"\x3c/td\x3e";d+="\x3c/tr\x3e"},this),d&&(d="\x3ctable class\x3d'attrTable' cellpadding\x3d'0px' cellspacing\x3d'0px'\x3e"+d+"\x3c/table\x3e"));h.set(this._description,"innerHTML",d);d||q.add(this._description,
"hidden");e.query("a",this._description).forEach(function(a){u._preventNewTab(a.href)?"_blank"===a.target&&h.remove(a,"target"):h.set(a,"target","_blank")});f&&d?e.query(".mainSection .hzLine",w).removeClass("hidden"):f||d?e.query(".mainSection .hzLine",w).addClass("hidden"):e.query(".mainSection",w).addClass("hidden");if(f=this._attachmentsDfd=x.getAttachments(r))f.addBoth(v.hitch(this,this._attListHandler,f)),h.set(this._attachmentsList,"innerHTML","\x3cli\x3e"+k.NLS_searching+"...\x3c/li\x3e"),
e.query(".attachmentsSection",w).removeClass("hidden");l&&l.length&&(e.query(".mediaSection",w).removeClass("hidden"),c.setSelectable(this._mediaFrame,!1),this._mediaInfos=l,this._mediaPtr=0,this._updateUI(),this._displayMedia());a.editSummary&&(h.set(this._editSummary,"innerHTML",a.editSummary),l&&l.length&&q.remove(this._mediaBreak,"hidden"),q.remove(this._editSummarySection,"hidden"));this.emit("content-update")}else this._showStatus(z.NLS_noInfo)},_handleComponentsError:function(a){a&&"cancel"===
a.dojoType||(console.log("PopupRenderer: error loading template",a),this._showStatus(z.NLS_noInfo))}});k("extend-esri")&&v.setObject("dijit._PopupRenderer",n,f);return n})},"dijit/_Templated":function(){define("./_WidgetBase ./_TemplatedMixin ./_WidgetsInTemplateMixin dojo/_base/array dojo/_base/declare dojo/_base/lang dojo/_base/kernel".split(" "),function(m,n,d,v,t,e,k){e.extend(m,{waiRole:"",waiState:""});return t("dijit._Templated",[n,d],{constructor:function(){k.deprecated(this.declaredClass+
": dijit._Templated deprecated, use dijit._TemplatedMixin and if necessary dijit._WidgetsInTemplateMixin","","2.0")},_processNode:function(d,c){var e=this.inherited(arguments),k=c(d,"waiRole");k&&d.setAttribute("role",k);(k=c(d,"waiState"))&&v.forEach(k.split(/\s*,\s*/),function(c){-1!=c.indexOf("-")&&(c=c.split("-"),d.setAttribute("aria-"+c[0],c[1]))});return e}})})},"dijit/_WidgetsInTemplateMixin":function(){define(["dojo/_base/array","dojo/aspect","dojo/_base/declare","dojo/_base/lang","dojo/parser"],
function(m,n,d,v,t){return d("dijit._WidgetsInTemplateMixin",null,{_earlyTemplatedStartup:!1,contextRequire:null,_beforeFillContent:function(){if(/dojoType|data-dojo-type/i.test(this.domNode.innerHTML)){var d=this.domNode;this.containerNode&&!this.searchContainerNode&&(this.containerNode.stopParser=!0);t.parse(d,{noStart:!this._earlyTemplatedStartup,template:!0,inherited:{dir:this.dir,lang:this.lang,textDir:this.textDir},propsThis:this,contextRequire:this.contextRequire,scope:"dojo"}).then(v.hitch(this,
function(d){this._startupWidgets=d;for(var e=0;e<d.length;e++)this._processTemplateNode(d[e],function(c,d){return c[d]},function(c,d,e){return d in c?c.connect(c,d,e):c.on(d,e,!0)});this.containerNode&&this.containerNode.stopParser&&delete this.containerNode.stopParser}));if(!this._startupWidgets)throw Error(this.declaredClass+": parser returned unfilled promise (probably waiting for module auto-load), unsupported by _WidgetsInTemplateMixin.   Must pre-load all supporting widgets before instantiation.");
}},_processTemplateNode:function(d,k,r){return k(d,"dojoType")||k(d,"data-dojo-type")?!0:this.inherited(arguments)},startup:function(){m.forEach(this._startupWidgets,function(d){d&&!d._started&&d.startup&&d.startup()});this._startupWidgets=null;this.inherited(arguments)}})})},"dojo/parser":function(){define("require ./_base/kernel ./_base/lang ./_base/array ./_base/config ./dom ./_base/window ./_base/url ./aspect ./promise/all ./date/stamp ./Deferred ./has ./query ./on ./ready".split(" "),function(m,
n,d,v,t,e,k,r,c,h,q,u,x,b,g,a){function f(a){return eval("("+a+")")}function l(a){var b=a._nameCaseMap,c=a.prototype;if(!b||b._extendCnt<F){var b=a._nameCaseMap={},f;for(f in c)"_"!==f.charAt(0)&&(b[f.toLowerCase()]=f);b._extendCnt=F}return b}function y(a,b){b||(b=m);var c=b._dojoParserCtorMap||(b._dojoParserCtorMap={}),f=a.join();if(!c[f]){for(var g=[],l=0,e=a.length;l<e;l++){var h=a[l];g[g.length]=c[h]=c[h]||d.getObject(h)||~h.indexOf("/")&&b(h)}l=g.shift();c[f]=g.length?l.createSubclass?l.createSubclass(g):
l.extend.apply(l,g):l}return c[f]}new Date("X");var F=0;c.after(d,"extend",function(){F++},!0);var B={_clearCache:function(){F++;_ctorMap={}},_functionFromScript:function(a,b){var c="",f="",d=a.getAttribute(b+"args")||a.getAttribute("args"),g=a.getAttribute("with"),d=(d||"").split(/\s*,\s*/);g&&g.length&&v.forEach(g.split(/\s*,\s*/),function(a){c+="with("+a+"){";f+="}"});return new Function(d,c+a.innerHTML+f)},instantiate:function(a,b,c){b=b||{};c=c||{};var f=(c.scope||n._scopeName)+"Type",d="data-"+
(c.scope||n._scopeName)+"-",g=d+"type",l=d+"mixins",e=[];v.forEach(a,function(a){var c=f in b?b[f]:a.getAttribute(g)||a.getAttribute(f);if(c){var d=a.getAttribute(l),c=d?[c].concat(d.split(/\s*,\s*/)):[c];e.push({node:a,types:c})}});return this._instantiate(e,b,c)},_instantiate:function(a,b,c,f){function d(a){b._started||c.noStart||v.forEach(a,function(a){"function"!==typeof a.startup||a._started||a.startup()});return a}a=v.map(a,function(a){var f=a.ctor||y(a.types,c.contextRequire);if(!f)throw Error("Unable to resolve constructor for: '"+
a.types.join()+"'");return this.construct(f,a.node,b,c,a.scripts,a.inherited)},this);return f?h(a).then(d):d(a)},construct:function(a,e,h,k,u,y){function w(a){H&&d.setObject(H,a);for(N=0;N<A.length;N++)c[A[N].advice||"after"](a,A[N].method,d.hitch(a,A[N].func),!0);for(N=0;N<Z.length;N++)Z[N].call(a);for(N=0;N<T.length;N++)a.watch(T[N].prop,T[N].func);for(N=0;N<R.length;N++)g(a,R[N].event,R[N].func);return a}var t=a&&a.prototype;k=k||{};var m={};k.defaults&&d.mixin(m,k.defaults);y&&d.mixin(m,y);var F;
x("dom-attributes-explicit")?F=e.attributes:x("dom-attributes-specified-flag")?F=v.filter(e.attributes,function(a){return a.specified}):(y=(/^input$|^img$/i.test(e.nodeName)?e:e.cloneNode(!1)).outerHTML.replace(/=[^\s"']+|="[^"]*"|='[^']*'/g,"").replace(/^\s*<[a-zA-Z0-9]*\s*/,"").replace(/\s*>.*$/,""),F=v.map(y.split(/\s+/),function(a){var b=a.toLowerCase();return{name:a,value:"LI"==e.nodeName&&"value"==a||"enctype"==b?e.getAttribute(b):e.getAttributeNode(b).value}}));var B=k.scope||n._scopeName;
y="data-"+B+"-";var D={};"dojo"!==B&&(D[y+"props"]="data-dojo-props",D[y+"type"]="data-dojo-type",D[y+"mixins"]="data-dojo-mixins",D[B+"type"]="dojotype",D[y+"id"]="data-dojo-id");for(var N=0,L,B=[],H,E;L=F[N++];){var z=L.name,C=z.toLowerCase();L=L.value;switch(D[C]||C){case "data-dojo-type":case "dojotype":case "data-dojo-mixins":break;case "data-dojo-props":E=L;break;case "data-dojo-id":case "jsid":H=L;break;case "data-dojo-attach-point":case "dojoattachpoint":m.dojoAttachPoint=L;break;case "data-dojo-attach-event":case "dojoattachevent":m.dojoAttachEvent=
L;break;case "class":m["class"]=e.className;break;case "style":m.style=e.style&&e.style.cssText;break;default:if(z in t||(z=l(a)[C]||z),z in t)switch(typeof t[z]){case "string":m[z]=L;break;case "number":m[z]=L.length?Number(L):NaN;break;case "boolean":m[z]="false"!=L.toLowerCase();break;case "function":""===L||-1!=L.search(/[^\w\.]+/i)?m[z]=new Function(L):m[z]=d.getObject(L,!1)||new Function(L);B.push(z);break;default:C=t[z],m[z]=C&&"length"in C?L?L.split(/\s*,\s*/):[]:C instanceof Date?""==L?new Date(""):
"now"==L?new Date:q.fromISOString(L):C instanceof r?n.baseUrl+L:f(L)}else m[z]=L}}for(F=0;F<B.length;F++)D=B[F].toLowerCase(),e.removeAttribute(D),e[D]=null;if(E)try{E=f.call(k.propsThis,"{"+E+"}"),d.mixin(m,E)}catch(Y){throw Error(Y.toString()+" in data-dojo-props\x3d'"+E+"'");}d.mixin(m,h);u||(u=a&&(a._noScript||t._noScript)?[]:b("\x3e script[type^\x3d'dojo/']",e));var A=[],Z=[],T=[],R=[];if(u)for(N=0;N<u.length;N++)D=u[N],e.removeChild(D),h=D.getAttribute(y+"event")||D.getAttribute("event"),k=
D.getAttribute(y+"prop"),E=D.getAttribute(y+"method"),B=D.getAttribute(y+"advice"),F=D.getAttribute("type"),D=this._functionFromScript(D,y),h?"dojo/connect"==F?A.push({method:h,func:D}):"dojo/on"==F?R.push({event:h,func:D}):m[h]=D:"dojo/aspect"==F?A.push({method:E,advice:B,func:D}):"dojo/watch"==F?T.push({prop:k,func:D}):Z.push(D);a=(u=a.markupFactory||t.markupFactory)?u(m,e,a):new a(m,e);return a.then?a.then(w):w(a)},scan:function(a,b){function c(a){if(!a.inherited){a.inherited={};var b=a.node,f=
c(a.parent),b={dir:b.getAttribute("dir")||f.dir,lang:b.getAttribute("lang")||f.lang,textDir:b.getAttribute(k)||f.textDir},d;for(d in b)b[d]&&(a.inherited[d]=b[d])}return a.inherited}var f=[],d=[],g={},e=(b.scope||n._scopeName)+"Type",l="data-"+(b.scope||n._scopeName)+"-",h=l+"type",k=l+"textdir",l=l+"mixins",q=a.firstChild,r=b.inherited;if(!r){var t=function(a,b){return a.getAttribute&&a.getAttribute(b)||a.parentNode&&t(a.parentNode,b)},r={dir:t(a,"dir"),lang:t(a,"lang"),textDir:t(a,k)},F;for(F in r)r[F]||
delete r[F]}for(var r={inherited:r},B,z;;)if(q)if(1!=q.nodeType)q=q.nextSibling;else if(B&&"script"==q.nodeName.toLowerCase())(A=q.getAttribute("type"))&&/^dojo\/\w/i.test(A)&&B.push(q),q=q.nextSibling;else if(z)q=q.nextSibling;else{var A=q.getAttribute(h)||q.getAttribute(e);F=q.firstChild;if(A||F&&(3!=F.nodeType||F.nextSibling)){z=null;if(A){var V=q.getAttribute(l);B=V?[A].concat(V.split(/\s*,\s*/)):[A];try{z=y(B,b.contextRequire)}catch(Z){}z||v.forEach(B,function(a){~a.indexOf("/")&&!g[a]&&(g[a]=
!0,d[d.length]=a)});V=z&&!z.prototype._noScript?[]:null;r={types:B,ctor:z,parent:r,node:q,scripts:V};r.inherited=c(r);f.push(r)}else r={node:q,scripts:B,parent:r};B=V;z=q.stopParser||z&&z.prototype.stopParser&&!b.template;q=F}else q=q.nextSibling}else{if(!r||!r.node)break;q=r.node.nextSibling;z=!1;r=r.parent;B=r.scripts}var ba=new u;d.length?(x("dojo-debug-messages")&&console.warn("WARNING: Modules being Auto-Required: "+d.join(", ")),(b.contextRequire||m)(d,function(){ba.resolve(v.filter(f,function(a){if(!a.ctor)try{a.ctor=
y(a.types,b.contextRequire)}catch(Y){}for(var c=a.parent;c&&!c.types;)c=c.parent;var f=a.ctor&&a.ctor.prototype;a.instantiateChildren=!(f&&f.stopParser&&!b.template);a.instantiate=!c||c.instantiate&&c.instantiateChildren;return a.instantiate}))})):ba.resolve(f);return ba.promise},_require:function(a,b){var c=f("{"+a.innerHTML+"}"),g=[],e=[],l=new u,h=b&&b.contextRequire||m,k;for(k in c)g.push(k),e.push(c[k]);h(e,function(){for(var a=0;a<g.length;a++)d.setObject(g[a],arguments[a]);l.resolve(arguments)});
return l.promise},_scanAmd:function(a,c){var f=new u,d=f.promise;f.resolve(!0);var g=this;b("script[type\x3d'dojo/require']",a).forEach(function(a){d=d.then(function(){return g._require(a,c)});a.parentNode.removeChild(a)});return d},parse:function(a,b){!a||"string"==typeof a||"nodeType"in a||(b=a,a=b.rootNode);var c=a?e.byId(a):k.body();b=b||{};var f=b.template?{template:!0}:{},g=[],l=this,h=this._scanAmd(c,b).then(function(){return l.scan(c,b)}).then(function(a){return l._instantiate(a,f,b,!0)}).then(function(a){return g=
g.concat(a)}).otherwise(function(a){console.error("dojo/parser::parse() error",a);throw a;});d.mixin(g,h);return g}};n.parser=B;t.parseOnLoad&&a(100,B,"parse");return B})},"esri/dijit/_EventedWidget":function(){define("dojo/_base/declare dojo/_base/lang dojo/aspect dojo/on ../Evented dijit/_WidgetBase".split(" "),function(m,n,d,v,t,e){return m([e,t],{_onMap:function(d){var e=this.constructor._onMap,c;e&&e.FINAL||(delete this.constructor._onMap,e=this.registerConnectEvents(),e.FINAL=!0);d=d.toLowerCase();
e[d]?c=this[e[d].method]:(d=this._onCamelCase(d),this[d]&&(c=d));return c},on:function(d,e){var c=this._onMap(d),h=d.replace(/\-/g,""),k="on"+h in this.domNode;return c||!k?this.inherited(arguments):this.own(v(this.domNode,h,e))[0]},emit:function(d,e,c){var h,k,u,x=d.toLowerCase(),b=this.constructor._onMap||this.registerConnectEvents();k=this[this._onMap(x)];e=e||{};e.target||(e.target=this);k&&b&&b[x]&&(this._onObj2Arr(function(){h=Array.prototype.slice.call(arguments)},b[x].argKeys)(e),u=n.mixin({},
arguments),u[2]=h,u[0]=b[x].name.replace(/^on/,""));return this.inherited(u||arguments)}})})},"esri/tasks/GeometryService":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/json dojo/_base/Deferred dojo/has ../kernel ../request ../deferredUtils ./Task ../geometry/Extent ../geometry/Polyline ../geometry/Polygon ../geometry/Multipoint ../geometry/jsonUtils".split(" "),function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g){m=m(h,{declaredClass:"esri.tasks.GeometryService",_eventMap:{"areas-and-lengths-complete":["result"],
"auto-complete-complete":["geometries"],"buffer-complete":["geometries"],"convex-hull-complete":["geometry"],"cut-complete":["result"],"densify-complete":["geometries"],"difference-complete":["geometries"],"distance-complete":["distance"],"generalize-complete":["geometries"],"intersect-complete":["geometries"],"label-points-complete":["geometries"],"lengths-complete":["result"],"offset-complete":["geometries"],"project-complete":["geometries"],"relation-complete":["relations"],"reshape-complete":["geometry"],
"simplify-complete":["geometries"],"trim-extend-complete":["geometries"],"union-complete":["geometry"]},constructor:function(a){a=n.hitch;this._projectHandler=a(this,this._projectHandler);this._simplifyHandler=a(this,this._simplifyHandler);this._bufferHandler=a(this,this._bufferHandler);this._areasAndLengthsHandler=a(this,this._areasAndLengthsHandler);this._lengthsHandler=a(this,this._lengthsHandler);this._labelPointsHandler=a(this,this._labelPointsHandler);this._relationHandler=a(this,this._relationHandler);
this._convexHullHandler=a(this,this._convexHullHandler);this._unionHandler=a(this,this._unionHandler);this._autoCompleteHandler=a(this,this._autoCompleteHandler);this._reshapeHandler=a(this,this._reshapeHandler);this._cutHandler=a(this,this._cutHandler);this._intersectHandler=a(this,this._intersectHandler);this._differenceHandler=a(this,this._differenceHandler);this._trimExtendHandler=a(this,this._trimExtendHandler);this._densifyHandler=a(this,this._densifyHandler);this._generalizeHandler=a(this,
this._densifyHandler);this._offsetHandler=a(this,this._offsetHandler);this._distanceHandler=a(this,this._distanceHandler);this._toGeoCoordinateHandler=a(this,this._toGeoCoordinateHandler);this._fromGeoCoordinateHandler=a(this,this._fromGeoCoordinateHandler);this.registerConnectEvents()},_encodeGeometries:function(a){var b=[],c,d=a.length;for(c=0;c<d;c++)b.push(a[c].toJson());return{geometryType:g.getJsonType(a[0]),geometries:b}},_decodeGeometries:function(a,b,c){var f=g.getGeometryType(b);a=a.geometries;
var e=[],l={spatialReference:c.toJson()},h=n.mixin;d.forEach(a,function(a,b){e[b]=new f(h(a,l))});return e},_toProjectGeometry:function(a){var b=a.spatialReference.toJson();return a instanceof q?new x({rings:[[[a.xmin,a.ymin],[a.xmin,a.ymax],[a.xmax,a.ymax],[a.xmax,a.ymin],[a.xmin,a.ymin]]],spatialReference:b}):new u({paths:[[].concat(a.points)],spatialReference:b})},_fromProjectedGeometry:function(a,c,d){return"esriGeometryEnvelope"===c?(a=a.rings[0],new q(a[0][0],a[0][1],a[2][0],a[2][1],d)):new b({points:a.paths[0],
spatialReference:d.toJson()})},project:function(a,b,d,e){var f=n.mixin({},this._url.query,{f:"json"}),l;a.geometries?(e=d,d=b,b=a.outSR,l=a.geometries[0],f=n.mixin(f,a.toJson())):(l=a[0],f=n.mixin(f,{outSR:b.wkid||v.toJson(b.toJson()),inSR:l.spatialReference.wkid||v.toJson(l.spatialReference.toJson()),geometries:v.toJson(this._encodeGeometries(a))}));var h=g.getJsonType(l),k=this._projectHandler,w=this._errorHandler,u=new t(c._dfdCanceller);u._pendingDfd=r({url:this._url.path+"/project",content:f,
callbackParamName:"callback",load:function(a,c){k(a,c,h,b,d,e,u)},error:function(a){w(a,e,u)}});return u},_projectHandler:function(a,b,c,d,g,e,h){try{var f=this._decodeGeometries(a,c,d);this._successHandler([f],"onProjectComplete",g,h)}catch(w){this._errorHandler(w,e,h)}},onProjectComplete:function(){},simplify:function(a,b,d){var f=a[0].spatialReference,e=n.mixin({},this._url.query,{f:"json",sr:f.wkid?f.wkid:v.toJson(f.toJson()),geometries:v.toJson(this._encodeGeometries(a))}),l=g.getJsonType(a[0]),
h=this._simplifyHandler,k=this._errorHandler,w=new t(c._dfdCanceller);w._pendingDfd=r({url:this._url.path+"/simplify",content:e,callbackParamName:"callback",load:function(a,c){h(a,c,l,f,b,d,w)},error:function(a){k(a,d,w)}});return w},_simplifyHandler:function(a,b,c,d,g,e,h){try{var f=this._decodeGeometries(a,c,d);this._successHandler([f],"onSimplifyComplete",g,h)}catch(w){this._errorHandler(w,e,h)}},onSimplifyComplete:function(){},convexHull:function(a,b,d){var f=a[0].spatialReference;a=n.mixin({},
this._url.query,{f:"json",sr:v.toJson(f.toJson()),geometries:v.toJson(this._encodeGeometries(a))});var g=this._convexHullHandler,e=this._errorHandler,l=new t(c._dfdCanceller);l._pendingDfd=r({url:this._url.path+"/convexHull",content:a,callbackParamName:"callback",load:function(a,c){g(a,c,f,b,d,l)},error:function(a){e(a,d,l)}});return l},_convexHullHandler:function(a,b,c,d,e,h){try{var f=g.fromJson(a.geometry).setSpatialReference(c);this._successHandler([f],"onConvexHullComplete",d,h)}catch(z){this._errorHandler(z,
e,h)}},onConvexHullComplete:function(){},union:function(a,b,d){var f=a[0].spatialReference;a=n.mixin({},this._url.query,{f:"json",sr:v.toJson(f.toJson()),geometries:v.toJson(this._encodeGeometries(a))});var g=this._unionHandler,e=this._errorHandler,l=new t(c._dfdCanceller);l._pendingDfd=r({url:this._url.path+"/union",content:a,callbackParamName:"callback",load:function(a,c){g(a,c,f,b,d,l)},error:function(a){e(a,d,l)}});return l},_unionHandler:function(a,b,c,d,e,h){try{var f=g.fromJson(a.geometry).setSpatialReference(c);
this._successHandler([f],"onUnionComplete",d,h)}catch(z){this._errorHandler(z,e,h)}},onUnionComplete:function(){},autoComplete:function(a,b,d,g){var f=a[0].spatialReference;a=n.mixin({},this._url.query,{f:"json",sr:v.toJson(f.toJson()),polygons:v.toJson(this._encodeGeometries(a).geometries),polylines:v.toJson(this._encodeGeometries(b).geometries)});var e=this._autoCompleteHandler,l=this._errorHandler,h=new t(c._dfdCanceller);h._pendingDfd=r({url:this._url.path+"/autoComplete",content:a,callbackParamName:"callback",
load:function(a,b){e(a,b,f,d,g,h)},error:function(a){l(a,g,h)}});return h},_autoCompleteHandler:function(a,b,c,d,g,e){try{var f=a.geometries;a=[];var l,h=f.length;for(l=0;l<h;l++)a[l]=new x({spatialReference:c,rings:f[l].rings});this._successHandler([a],"onAutoCompleteComplete",d,e)}catch(D){this._errorHandler(D,g,e)}},onAutoCompleteComplete:function(){},reshape:function(a,b,d,e){var f=a.spatialReference;a=n.mixin({},this._url.query,{f:"json",sr:v.toJson(f.toJson()),target:v.toJson({geometryType:g.getJsonType(a),
geometry:a.toJson()}),reshaper:v.toJson(b.toJson())});var l=this._reshapeHandler,h=this._errorHandler,k=new t(c._dfdCanceller);k._pendingDfd=r({url:this._url.path+"/reshape",content:a,callbackParamName:"callback",load:function(a,b){l(a,b,f,d,e,k)},error:function(a){h(a,e,k)}});return k},_reshapeHandler:function(a,b,c,d,e,h){try{var f=g.fromJson(a.geometry).setSpatialReference(c);this._successHandler([f],"onReshapeComplete",d,h)}catch(z){this._errorHandler(z,e,h)}},onReshapeComplete:function(){},cut:function(a,
b,e,h){var f=a[0].spatialReference,l=d.map(a,function(a){return a.toJson()});a=n.mixin({},this._url.query,{f:"json",sr:v.toJson(f.toJson()),target:v.toJson({geometryType:g.getJsonType(a[0]),geometries:l}),cutter:v.toJson(b.toJson())});var k=this._cutHandler,u=this._errorHandler,w=new t(c._dfdCanceller);w._pendingDfd=r({url:this._url.path+"/cut",content:a,callbackParamName:"callback",load:function(a,b){k(a,b,f,e,h,w)},error:function(a){u(a,h,w)}});return w},_cutHandler:function(a,b,c,e,h,k){try{var f=
a.geometries,l={};l.cutIndexes=a.cutIndexes;l.geometries=[];d.forEach(f,function(a){l.geometries.push(g.fromJson(a).setSpatialReference(c))});this._successHandler([l],"onCutComplete",e,k)}catch(w){this._errorHandler(w,h,k)}},onCutComplete:function(){},intersect:function(a,b,d,e){var f=a[0].spatialReference;a=n.mixin({},this._url.query,{f:"json",sr:v.toJson(f.toJson()),geometries:v.toJson(this._encodeGeometries(a)),geometry:v.toJson({geometryType:g.getJsonType(b),geometry:b.toJson()})});var l=this._intersectHandler,
h=this._errorHandler,k=new t(c._dfdCanceller);k._pendingDfd=r({url:this._url.path+"/intersect",content:a,callbackParamName:"callback",load:function(a,b){l(a,b,f,d,e,k)},error:function(a){h(a,e,k)}});return k},_intersectHandler:function(a,b,c,e,h,k){try{var f=[];d.forEach(a.geometries,function(a){f.push(g.fromJson(a).setSpatialReference(c))});this._successHandler([f],"onIntersectComplete",e,k)}catch(z){this._errorHandler(z,h,k)}},onIntersectComplete:function(){},difference:function(a,b,d,e){var f=
a[0].spatialReference;a=n.mixin({},this._url.query,{f:"json",sr:v.toJson(f.toJson()),geometries:v.toJson(this._encodeGeometries(a)),geometry:v.toJson({geometryType:g.getJsonType(b),geometry:b.toJson()})});var l=this._differenceHandler,h=this._errorHandler,k=new t(c._dfdCanceller);k._pendingDfd=r({url:this._url.path+"/difference",content:a,callbackParamName:"callback",load:function(a,b){l(a,b,f,d,e,k)},error:function(a){h(a,e,k)}});return k},_differenceHandler:function(a,b,c,e,h,k){try{var f=[];d.forEach(a.geometries,
function(a){f.push(g.fromJson(a).setSpatialReference(c))});this._successHandler([f],"onDifferenceComplete",e,k)}catch(z){this._errorHandler(z,h,k)}},onDifferenceComplete:function(){},buffer:function(a,b,d){var f=n.mixin({},this._url.query,{f:"json"},a.toJson()),g=a.outSpatialReference||a.geometries[0].spatialReference,e=this._bufferHandler,l=this._errorHandler,h=new t(c._dfdCanceller);h._pendingDfd=r({url:this._url.path+"/buffer",content:f,callbackParamName:"callback",load:function(a,c){e(a,c,g,b,
d,h)},error:function(a){l(a,d,h)}});return h},_bufferHandler:function(a,b,c,d,g,e){try{var f=a.geometries;a=[];var l,h=f.length;for(l=0;l<h;l++)a[l]=new x({spatialReference:c,rings:f[l].rings});this._successHandler([a],"onBufferComplete",d,e)}catch(D){this._errorHandler(D,g,e)}},onBufferComplete:function(){},areasAndLengths:function(a,b,d){a=n.mixin({},this._url.query,{f:"json"},a.toJson());var f=this._areasAndLengthsHandler,g=this._errorHandler,e=new t(c._dfdCanceller);e._pendingDfd=r({url:this._url.path+
"/areasAndLengths",content:a,callbackParamName:"callback",load:function(a,c){f(a,c,b,d,e)},error:function(a){g(a,d,e)}});return e},_areasAndLengthsHandler:function(a,b,c,d,g){try{this._successHandler([a],"onAreasAndLengthsComplete",c,g)}catch(B){this._errorHandler(B,d,g)}},onAreasAndLengthsComplete:function(){},lengths:function(a,b,d){a=n.mixin({},this._url.query,{f:"json"},a.toJson());var f=this._lengthsHandler,g=this._errorHandler,e=new t(c._dfdCanceller);e._pendingDfd=r({url:this._url.path+"/lengths",
content:a,callbackParamName:"callback",load:function(a,c){f(a,c,b,d,e)},error:function(a){g(a,d,e)}});return e},_lengthsHandler:function(a,b,c,d,g){try{this._successHandler([a],"onLengthsComplete",c,g)}catch(B){this._errorHandler(B,d,g)}},onLengthsComplete:function(){},labelPoints:function(a,b,g){var f=d.map(a,function(a){return a.toJson()}),e=a[0].spatialReference,f=n.mixin({},this._url.query,{f:"json",sr:e.wkid?e.wkid:v.toJson(e.toJson()),polygons:v.toJson(f)}),l=this._labelPointsHandler,h=this._errorHandler,
k=new t(c._dfdCanceller);k._pendingDfd=r({url:this._url.path+"/labelPoints",content:f,callbackParamName:"callback",load:function(c,f){l(c,f,a,e,b,g,k)},error:function(a){h(a,g,k)}});return k},_labelPointsHandler:function(a,b,c,e,h,k,u){try{var f=[];d.forEach(a.labelPoints,function(a){f.push(g.fromJson(a).setSpatialReference(e))});this._successHandler([f],"onLabelPointsComplete",h,u)}catch(w){this._errorHandler(w,k,u)}},onLabelPointsComplete:function(){},relation:function(a,b,d){a=n.mixin({},this._url.query,
{f:"json"},a.toJson());var f=this._relationHandler,g=this._errorHandler,e=new t(c._dfdCanceller);e._pendingDfd=r({url:this._url.path+"/relation",content:a,callbackParamName:"callback",load:function(a,c){f(a,c,b,d,e)},error:function(a){g(a,d,e)}});return e},_relationHandler:function(a,b,c,d,g){try{this._successHandler([a.relations],"onRelationComplete",c,g)}catch(B){this._errorHandler(B,d,g)}},onRelationComplete:function(){},trimExtend:function(a,b,d){var f=n.mixin({},this._url.query,{f:"json"},a.toJson()),
g=a.sr,e=this._trimExtendHandler,l=this._errorHandler,h=new t(c._dfdCanceller);h._pendingDfd=r({url:this._url.path+"/trimExtend",content:f,callbackParamName:"callback",load:function(a,c){e(a,c,g,b,d,h)},error:function(a){l(a,d,h)}});return h},_trimExtendHandler:function(a,b,c,d,g,e){try{var f=a.geometries;a=[];var l,h=f.length;for(l=0;l<h;l++)a[l]=new u({spatialReference:c,paths:f[l].paths});this._successHandler([a],"onTrimExtendComplete",d,e)}catch(D){this._errorHandler(D,g,e)}},onTrimExtendComplete:function(){},
densify:function(a,b,d){var f=n.mixin({},this._url.query,{f:"json"},a.toJson()),g=a.geometries[0].spatialReference,e=this._densifyHandler,l=this._errorHandler,h=new t(c._dfdCanceller);h._pendingDfd=r({url:this._url.path+"/densify",content:f,callbackParamName:"callback",load:function(a,c){e(a,c,g,b,d,h)},error:function(a){l(a,d,h)}});return h},_densifyHandler:function(a,b,c,e,h,k){try{var f=[];d.forEach(a.geometries,function(a){f.push(g.fromJson(a).setSpatialReference(c))});this._successHandler([f],
"onDensifyComplete",e,k)}catch(z){this._errorHandler(z,h,k)}},onDensifyComplete:function(){},generalize:function(a,b,d){var f=n.mixin({},this._url.query,{f:"json"},a.toJson()),g=a.geometries[0].spatialReference,e=this._generalizeHandler,l=this._errorHandler,h=new t(c._dfdCanceller);h._pendingDfd=r({url:this._url.path+"/generalize",content:f,callbackParamName:"callback",load:function(a,c){e(a,c,g,b,d,h)},error:function(a){l(a,d,h)}});return h},_generalizeHandler:function(a,b,c,e,h,k){try{var f=[];
d.forEach(a.geometries,function(a){f.push(g.fromJson(a).setSpatialReference(c))});this._successHandler([f],"onGeneralizeComplete",e,k)}catch(z){this._errorHandler(z,h,k)}},onGeneralizeComplete:function(){},offset:function(a,b,d){var f=n.mixin({},this._url.query,{f:"json"},a.toJson()),g=a.geometries[0].spatialReference,e=this._offsetHandler,l=this._errorHandler,h=new t(c._dfdCanceller);h._pendingDfd=r({url:this._url.path+"/offset",content:f,callbackParamName:"callback",load:function(a,c){e(a,c,g,b,
d,h)},error:function(a){l(a,d,h)}});return h},_offsetHandler:function(a,b,c,e,h,k){try{var f=[];d.forEach(a.geometries,function(a){f.push(g.fromJson(a).setSpatialReference(c))});this._successHandler([f],"onOffsetComplete",e,k)}catch(z){this._errorHandler(z,h,k)}},onOffsetComplete:function(){},distance:function(a,b,d){var f=n.mixin({},this._url.query,{f:"json"},a.toJson()),g=a.geometry1.spatialReference,e=this._distanceHandler,h=this._errorHandler,l=new t(c._dfdCanceller);l._pendingDfd=r({url:this._url.path+
"/distance",content:f,callbackParamName:"callback",load:function(a,c){e(a,c,g,b,d,l)},error:function(a){h(a,d,l)}});return l},_distanceHandler:function(a,b,c,d,g,e){try{a=a&&a.distance,this._successHandler([a],"onDistanceComplete",d,e)}catch(A){this._errorHandler(A,g,e)}},onDistanceComplete:function(){},toGeoCoordinateString:function(a,b,d){var f={};n.isObject(a.sr)?f.sr=a.sr.wkid||v.toJson(a.sr.toJson()):f.sr=a.sr;f.coordinates=v.toJson(a.coordinates);f.conversionType=a.conversionType||"MGRS";f.conversionMode=
a.conversionMode;f.numOfDigits=a.numOfDigits;f.rounding=a.rounding;f.addSpaces=a.addSpaces;a=n.mixin({},this._url.query,{f:"json"},f);var g=this._toGeoCoordinateHandler,e=this._errorHandler,h=new t(c._dfdCanceller);h._pendingDfd=r({url:this._url.path+"/toGeoCoordinateString",content:a,callbackParamName:"callback",load:function(a,c){g(a,c,b,d,h)},error:function(a){e(a,d,h)}});return h},_toGeoCoordinateHandler:function(a,b,c,d,g){try{this._successHandler([a.strings],"onToGeoCoordinateStringComplete",
c,g)}catch(B){this._errorHandler(B,d,g)}},onToGeoCoordinateStringComplete:function(){},fromGeoCoordinateString:function(a,b,d){var f={};n.isObject(a.sr)?f.sr=a.sr.wkid||v.toJson(a.sr.toJson()):f.sr=a.sr;f.strings=v.toJson(a.strings);f.conversionType=a.conversionType||"MGRS";f.conversionMode=a.conversionMode;a=n.mixin({},this._url.query,{f:"json"},f);var g=this._fromGeoCoordinateHandler,e=this._errorHandler,h=new t(c._dfdCanceller);h._pendingDfd=r({url:this._url.path+"/fromGeoCoordinateString",content:a,
callbackParamName:"callback",load:function(a,c){g(a,c,b,d,h)},error:function(a){e(a,d,h)}});return h},_fromGeoCoordinateHandler:function(a,b,c,d,g){try{this._successHandler([a.coordinates],"onToGeoCoordinateStringComplete",c,g)}catch(B){this._errorHandler(B,d,g)}},onFromGeoCoordinateStringComplete:function(){}});n.mixin(m,{UNIT_METER:9001,UNIT_GERMAN_METER:9031,UNIT_FOOT:9002,UNIT_SURVEY_FOOT:9003,UNIT_CLARKE_FOOT:9005,UNIT_FATHOM:9014,UNIT_NAUTICAL_MILE:9030,UNIT_SURVEY_CHAIN:9033,UNIT_SURVEY_LINK:9034,
UNIT_SURVEY_MILE:9035,UNIT_KILOMETER:9036,UNIT_CLARKE_YARD:9037,UNIT_CLARKE_CHAIN:9038,UNIT_CLARKE_LINK:9039,UNIT_SEARS_YARD:9040,UNIT_SEARS_FOOT:9041,UNIT_SEARS_CHAIN:9042,UNIT_SEARS_LINK:9043,UNIT_BENOIT_1895A_YARD:9050,UNIT_BENOIT_1895A_FOOT:9051,UNIT_BENOIT_1895A_CHAIN:9052,UNIT_BENOIT_1895A_LINK:9053,UNIT_BENOIT_1895B_YARD:9060,UNIT_BENOIT_1895B_FOOT:9061,UNIT_BENOIT_1895B_CHAIN:9062,UNIT_BENOIT_1895B_LINK:9063,UNIT_INDIAN_FOOT:9080,UNIT_INDIAN_1937_FOOT:9081,UNIT_INDIAN_1962_FOOT:9082,UNIT_INDIAN_1975_FOOT:9083,
UNIT_INDIAN_YARD:9084,UNIT_INDIAN_1937_YARD:9085,UNIT_INDIAN_1962_YARD:9086,UNIT_INDIAN_1975_YARD:9087,UNIT_FOOT_1865:9070,UNIT_RADIAN:9101,UNIT_DEGREE:9102,UNIT_ARCMINUTE:9103,UNIT_ARCSECOND:9104,UNIT_GRAD:9105,UNIT_GON:9106,UNIT_MICRORADIAN:9109,UNIT_ARCMINUTE_CENTESIMAL:9112,UNIT_ARCSECOND_CENTESIMAL:9113,UNIT_MIL6400:9114,UNIT_BRITISH_1936_FOOT:9095,UNIT_GOLDCOAST_FOOT:9094,UNIT_INTERNATIONAL_CHAIN:109003,UNIT_INTERNATIONAL_LINK:109004,UNIT_INTERNATIONAL_YARD:109001,UNIT_STATUTE_MILE:9093,UNIT_SURVEY_YARD:109002,
UNIT_50KILOMETER_LENGTH:109030,UNIT_150KILOMETER_LENGTH:109031,UNIT_DECIMETER:109005,UNIT_CENTIMETER:109006,UNIT_MILLIMETER:109007,UNIT_INTERNATIONAL_INCH:109008,UNIT_US_SURVEY_INCH:109009,UNIT_INTERNATIONAL_ROD:109010,UNIT_US_SURVEY_ROD:109011,UNIT_US_NAUTICAL_MILE:109012,UNIT_UK_NAUTICAL_MILE:109013,UNIT_SQUARE_INCHES:"esriSquareInches",UNIT_SQUARE_FEET:"esriSquareFeet",UNIT_SQUARE_YARDS:"esriSquareYards",UNIT_ACRES:"esriAcres",UNIT_SQUARE_MILES:"esriSquareMiles",UNIT_SQUARE_MILLIMETERS:"esriSquareMillimeters",
UNIT_SQUARE_CENTIMETERS:"esriSquareCentimeters",UNIT_SQUARE_DECIMETERS:"esriSquareDecimeters",UNIT_SQUARE_METERS:"esriSquareMeters",UNIT_ARES:"esriAres",UNIT_HECTARES:"esriHectares",UNIT_SQUARE_KILOMETERS:"esriSquareKilometers"});e("extend-esri")&&n.setObject("tasks.GeometryService",m,k);return m})},"esri/layers/FeatureLayer":function(){define("require module dojo/_base/declare dojo/_base/connect dojo/_base/lang dojo/_base/array dojo/_base/json dojo/_base/Deferred dojo/date/locale dojo/sniff dojo/io-query dojo/dom-construct dojo/i18n dojo/when dojo/promise/all ../kernel ../lang ../request ../config ../deferredUtils ../promiseList ../SpatialReference ../symbols/SimpleMarkerSymbol ../symbols/SimpleLineSymbol ../symbols/SimpleFillSymbol ../symbols/jsonUtils ../renderers/SimpleRenderer ../renderers/UniqueValueRenderer ../renderers/jsonUtils ../support/expressionUtils ../tasks/QueryTask ../tasks/query ../tasks/FeatureSet ../tasks/StatisticDefinition ../geometry/Extent ../geometry/jsonUtils ../geometry/normalizeUtils ../geometry/scaleUtils ./GraphicsLayer ./Field ./TimeInfo ./FeatureType ./FeatureTemplate ./FeatureEditResult ./LabelClass ./SnapshotMode ./OnDemandMode ./SelectionMode ./StreamMode ./TrackManager ./HeatmapManager ./clustering/ClusterManager dojo/i18n!../nls/jsapi dojo/has!extend-esri?./agscommon".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,a,f,l,y,F,B,A,z,w,D,C,E,O,J,K,I,X,P,N,L,H,Q,ja,V,ba,Z,T,R,Y,da,U,ka,fa,sa,ma,aa,ca,oa){var ga=y.defaults,M=d(V,{declaredClass:"esri.layers.FeatureLayer",invalidParams:"query contains one or more unsupported parameters",reHostedFS:/(https?:)?\/\/services.*\.arcgis\.com/i,maxPointCountForAuto:4E3,maxRecordCountForAuto:2E3,maxVertexCountForAuto:25E4,generalizeForScale:4E3,_eventMap:{"add-attachment-complete":["result"],"before-apply-edits":["adds","updates","deletes"],
"delete-attachments-complete":["results"],"edits-complete":["adds","updates","deletes"],"query-attachment-infos-complete":["results"],"query-count-complete":["count"],"query-features-complete":["featureSet"],"query-ids-complete":["objectIds"],"query-related-features-complete":["featureSets"],"selection-complete":["features","method"],"update-end":["error","info"]},constructor:function(a,b){this._preventInit||this._initFeatureLayer(a,b)},_initFeatureLayer:function(a,b){this.i18n=oa;b=b||{};this._featureReduction=
this._featureReduction||b.featureReduction;this._featureReductionEnabled=null!=b.featureReductionEnabled?b.featureReductionEnabled:!0;this.showLabels=null!=b.showLabels?b.showLabels:!0;this._outFields=b.outFields;this._defnExpr=b.definitionExpression;this._loadCallback=b.loadCallback;this._trackIdField=b.trackIdField;this.objectIdField=b.objectIdField;this._maxOffset=null!=b.maxAllowableOffset?b.maxAllowableOffset:this.maxAllowableOffset;this.quantize=null!=b.quantize?b.quantize:!0;this._optEditable=
b.editable;this._optAutoGen=b.autoGeneralize;this.editSummaryCallback=b.editSummaryCallback;this.userId=b.userId;this.userIsAdmin=b.userIsAdmin;this.useMapTime=b.hasOwnProperty("useMapTime")?!!b.useMapTime:!0;this.source=b.source;this.gdbVersion=b.gdbVersion;this.orderByFields=b.orderByFields;this.maxPointCountForAuto=null!=b.maxPointCountForAuto?b.maxPointCountForAuto:this.maxPointCountForAuto;this.maxRecordCountForAuto=null!=b.maxRecordCountForAuto?b.maxRecordCountForAuto:this.maxRecordCountForAuto;
this.maxVertexCountForAuto=null!=b.maxVertexCountForAuto?b.maxVertexCountForAuto:this.maxVertexCountForAuto;this.generalizeForScale=null!=b.generalizeForScale?b.generalizeForScale:this.generalizeForScale;this.queryPagination=this._optQueryPagination=null!=b.queryPagination?b.queryPagination:!0;this.multipatchOption=b.multipatchOption;this._selectedFeatures={};this._selectedFeaturesArr=[];this._newFeatures=[];this._deletedFeatures={};this._ulid=this._getUniqueId();var c=f.isDefined(b.mode)?b.mode:
M.MODE_ONDEMAND;this._isStream&&(c=M.MODE_STREAM);this.mode=c;switch(c){case M.MODE_SNAPSHOT:this.currentMode=M.MODE_SNAPSHOT;this._mode=new U(this);break;case M.MODE_ONDEMAND:case M.MODE_AUTO:this.currentMode=M.MODE_ONDEMAND;this._tileWidth=b.tileWidth||512;this._tileHeight=b.tileHeight||512;this._mode=new ka(this);this.latticeTiling=b.latticeTiling;break;case M.MODE_SELECTION:this.currentMode=M.MODE_SELECTION;this._mode=new fa(this);this._isSelOnly=!0;break;case M.MODE_STREAM:this.currentMode=M.MODE_STREAM,
this._mode=new sa(this),this._isStream=!0}this._initLayer=t.hitch(this,this._initLayer);this._selectHandler=t.hitch(this,this._selectHandler);this._editable=!1;if(t.isObject(a)&&a.layerDefinition)return this._collection=!0,this.mode=this._isStream?M.MODE_STREAM:M.MODE_SNAPSHOT,this._isStream||this._outFields||(this._outFields=["*"]),this._initLayer(a),this;this._task=new I(this.url,{source:this.source,gdbVersion:this.gdbVersion});c=this._url.path;this._fserver=!1;-1!==c.search(/\/FeatureServer\//i)&&
(this._fserver=!0);this.mode===M.MODE_AUTO&&this.reHostedFS.test(this.url)&&this._queryLimit();var d=b.resourceInfo;d?this._initLayer(d):(this.source&&(d={source:this.source.toJson()},this._url.query=t.mixin(this._url.query,{layer:k.toJson(d)})),this.gdbVersion&&(this._url.query=t.mixin(this._url.query,{gdbVersion:this.gdbVersion})),l({url:c,content:t.mixin({f:"json"},this._url.query),callbackParamName:"callback",load:this._initLayer,error:this._errorHandler}));this.registerConnectEvents()},_initLayer:function(a,
b){if(a||b){this._json=a;this._findCredential();if(this.credential&&this.credential.ssl||a&&a._ssl)this._useSSL(),this._task._useSSL();this.version=a.currentVersion;this.version||(this.version="capabilities"in a||"drawingInfo"in a||"hasAttachments"in a||"htmlPopupType"in a||"relationships"in a||"timeInfo"in a||"typeIdField"in a||"types"in a?10:9.3);this._collection&&(this._isStream||(this.currentMode=M.MODE_SNAPSHOT,this._mode=new U(this)),this._featureSet=a.featureSet,this._nextId=a.nextObjectId,
a=a.layerDefinition);this.geometryType=a.geometryType;"string"!==typeof this.multipatchOption&&"esriGeometryMultiPatch"===this.geometryType&&(this.multipatchOption="xyFootprint");if(a.hasOwnProperty("capabilities")){var c=this.capabilities=a.capabilities;c&&-1!==c.toLowerCase().indexOf("editing")?this._editable=!0:this._editable=!1}else this._collection||(this._editable=this._fserver);f.isDefined(this._optEditable)?(this._editable=this._optEditable,delete this._optEditable):"esriGeometryMultiPatch"===
this.geometryType&&(this._editable=!1);this._json=k.toJson(this._json);this.isEditable()?this._setMaxOffset(null):this.mode===M.MODE_SNAPSHOT||"esriGeometryPolyline"!==this.geometryType&&"esriGeometryPolygon"!==this.geometryType&&!this.hasXYFootprint()||(this._autoGeneralize=f.isDefined(this._optAutoGen)?this._optAutoGen:this.mode===M.MODE_ONDEMAND||this.mode===M.MODE_AUTO,delete this._optAutoGen);var c=a.effectiveMinScale||a.minScale,d=a.effectiveMaxScale||a.maxScale;!this._hasMin&&c&&this.setMinScale(c);
!this._hasMax&&d&&this.setMaxScale(d);this.layerId=a.id;this.name=a.name;this.description=a.description;this.copyright=a.copyrightText;this.type=a.type;this.displayField=a.displayField;this.defaultDefinitionExpression=a.definitionExpression||(a.isView?a.viewDefinitionQuery:a.definitionQuery);this.fullExtent=new L(a.extent);this.initialExtent=new L(this.fullExtent.toJson());this.fullExtent.spatialReference&&(this.spatialReference=new A(this.fullExtent.spatialReference.toJson()));this.defaultVisibility=
a.defaultVisibility;if("esriGeometryPoint"===this.geometryType||"esriGeometryMultipoint"===this.geometryType)this.latticeTiling=!1;this.hasM=a.hasM||!1;this.hasZ=a.hasZ||!1;this.indexedFields=a.indexedFields;this.maxRecordCount=a.maxRecordCount;this.canModifyLayer=a.canModifyLayer;this.supportsStatistics=a.supportsStatistics;this.supportsAdvancedQueries=this._collection?!1:a.supportsAdvancedQueries;this.supportsCalculate=a.supportsCalculate;this.supportsAttachmentsByUploadId=a.supportsAttachmentsByUploadId;
this.supportsCoordinatesQuantization=a.supportsCoordinatesQuantization;this.quantize=this.quantize&&this.supportsCoordinatesQuantization;this.hasLabels=a.hasLabels;this.canScaleSymbols=a.canScaleSymbols;this.supportsRollbackOnFailureParameter=this.supportsRollbackOnFailure=a.supportsRollbackOnFailure;this.syncCanReturnChanges=a.syncCanReturnChanges;this.isDataVersioned=a.isDataVersioned;this.editFieldsInfo=a.editFieldsInfo;this.ownershipBasedAccessControlForFeatures=a.ownershipBasedAccessControlForFeatures;
this.editFieldsInfo&&this.ownershipBasedAccessControlForFeatures&&(this.creatorField=this.editFieldsInfo.creatorField);this.relationships=a.relationships;this.allowGeometryUpdates=f.isDefined(a.allowGeometryUpdates)?a.allowGeometryUpdates:!0;this.allowUpdateWithoutMValues=!!a.allowUpdateWithoutMValues;this.enableZDefaults=!!a.enableZDefaults;this.zDefault=f.isDefined(a.zDefault)?a.zDefault:null;this.advancedQueryCapabilities=a.advancedQueryCapabilities||{supportsStatistics:this.supportsStatistics,
supportsOrderBy:this.supportsAdvancedQueries,supportsDistinct:this.supportsAdvancedQueries};this.url&&(this.advancedQueryCapabilities.supportsPagination=this.advancedQueryCapabilities.supportsPagination&&(this.reHostedFS.test(this.url)||10.3<this.version));this.queryPagination=this._optQueryPagination&&this.advancedQueryCapabilities.supportsPagination;this.useStandardizedQueries=a.useStandardizedQueries;this.tileMaxRecordCount=a.tileMaxRecordCount;this.standardMaxRecordCount=a.standardMaxRecordCount;
this._setMaxOffset(this._maxOffset,!0);this._isTable="Table"===this.type;for(var g=this.fields=[],d=a.fields,c=0;c<d.length;c++)g.push(new ba(d[c]));if(!this.objectIdField){this.objectIdField=a.objectIdField;if(!this.objectIdField)for(d=a.fields,c=0;c<d.length;c++)if(g=d[c],"esriFieldTypeOID"===g.type){this.objectIdField=g.name;break}this.objectIdField||this._isStream||console.debug("esri.layers.FeatureLayer: "+f.substitute({url:this.url},"objectIdField is not set [url: ${url}]"))}if(!f.isDefined(this._nextId)){d=
this.objectIdField;g=-1;if(this._collection&&d)for(var l=(c=this._featureSet)&&c.features,u=l?l.length:0,q,c=0;c<u;c++)q=(q=l[c].attributes)&&q[d],q>g&&(g=q);this._nextId=g+1}this.globalIdField=a.globalIdField;if(c=this.typeIdField=a.typeIdField)if(c=!this._getField(c)&&this._getField(c,!0))this.typeIdField=c.name;this.visibilityField=a.visibilityField;if(d=a.defaultSymbol)this.defaultSymbol=C.fromJson(d);var x=this.types=[],r=a.types,m,n,g=(c=this.editFieldsInfo)&&c.creatorField,l=c&&c.editorField;
q=g||l;u=[];if(r)for(c=0;c<r.length;c++)m=new T(r[c]),n=m.templates,q&&n&&n.length&&(u=u.concat(n)),x.push(m);r=a.templates;m=this.templates=[];if(r)for(c=0;c<r.length;c++)x=new R(r[c]),q&&u.push(x),m.push(x);for(c=0;c<u.length;c++)if(q=t.getObject("prototype.attributes",!1,u[c]))g&&delete q[g],l&&delete q[l];if(c=a.timeInfo)this.timeInfo=new Z(c),this._startTimeField=c.startTimeField,this._endTimeField=c.endTimeField,this._startTimeField&&this._endTimeField&&(this._twoTimeFields=!0),this._trackIdField?
c.trackIdField=this._trackIdField:this._trackIdField=c.trackIdField;this.hasAttachments=!this._collection&&a.hasAttachments?!0:!1;this.htmlPopupType=a.htmlPopupType;var c=a.drawingInfo,S;(g=c&&c.labelingInfo)&&!this.labelingInfo&&(this.labelingInfo=e.map(g,function(a){return new da(a)}),this._fixLabelExpr());if(!this.renderer)if(c&&c.renderer){if(S=c.renderer,this.setRenderer(J.fromJson(S)),"classBreaks"===S.type&&this.renderer.setMaxInclusive(!0),!this._collection){var y=S.type,d=[];S=this.renderer;
switch(y){case "simple":d.push(S.symbol);break;case "uniqueValue":case "classBreaks":d.push(S.defaultSymbol),d=d.concat(e.map(S.infos,function(a){return a.symbol}))}var d=e.filter(d,f.isDefined),G=this._url.path+"/images/",la=this._getToken();e.forEach(d,function(a){var b=a.url;b&&(-1===b.search(/https?\:/)&&-1===b.indexOf("data:")&&(a.url=G+b),la&&-1!==a.url.search(/https?\:/)&&(a.url+="?token\x3d"+la))})}}else if(d)r=this.types,0<r.length?(S=new O(this.defaultSymbol,this.typeIdField),e.forEach(r,
function(a){S.addValue(a.id,a.symbol)})):S=new E(this.defaultSymbol),this.setRenderer(S);else if(!this._isTable){switch(this.geometryType){case "esriGeometryPoint":case "esriGeometryMultipoint":y=new z;break;case "esriGeometryPolyline":y=new w;break;case "esriGeometryPolygon":y=new D;break;default:this.hasXYFootprint()&&(y=new D)}this.setRenderer(y?new E(y):null)}y=c&&c.transparency||0;!this.hasOwnProperty("opacity")&&0<y&&(this.opacity=1-y/100);(h("ie")||7<=h("trident")||h("safari"))&&this.isEditable()&&
10.02>this.version&&(this._ts=!0);this.statistics=a.statistics;this._fixRendererFields();this._updateRequiredFieldsFromLabelingInfo();this._checkFields();this._updateCaps();var ea=function(){null==this._maxOffset||this._isFractionalOffsetAllowed()||this._setMaxOffset(this._maxOffset);this.loaded=!0;this.setFeatureReduction(this.getFeatureReduction());this.currentMode!==M.MODE_SNAPSHOT&&(this.queryPagination=!1);this.onLoad(this);var a=this._loadCallback;a&&(delete this._loadCallback,a(this))},y=[];
this._collection?(c=this._featureSet,this._featureSet=null,this._mode._drawFeatures(new P(c)),this._fcAdded=!0):(y.push(this._forceIdentity()),this._limitPromise&&y.push(this._limitPromise));y.push(this._evalGeometryOperations());y.length?B(y).then(t.hitch(this,function(){ea.call(this)})):ea.call(this)}},setShowLabels:function(a){this.showLabels=a;this.onShowLabelsChange()},onShowLabelsChange:function(){},onRendererChange:function(a){this.inherited(arguments);var b=this._map;this._ager=!!(a&&a.observationAger&&
a.observationRenderer);a&&"colors"in a&&"blurRadius"in a&&"maxPixelIntensity"in a?"esriGeometryPoint"==this.geometryType&&!this._heatmapManager&&b&&(this._heatmapManager=new aa(this),this._heatmapManager.initialize(b)):this.renderer&&this.renderer.getRendererInfo?e.some(this.renderer.rendererInfos,function(a){return a.renderer&&"colors"in a.renderer&&"blurRadius"in a.renderer})||(this._heatmapManager=null):this._heatmapManager=null;this.timeInfo&&b&&(a&&(a.latestObservationRenderer||a.trackRenderer)?
this._trackManager||(this._trackManager=new ma(this),this._trackManager.initialize(b),this._childLayer=this._trackManager.container,this._mode._applyTimeFilter()):this._trackManager&&!this._isStream&&(this._trackManager.destroy(),this._trackManager=null));if(a){var c=[],b=e.filter([a,a.observationRenderer,a.latestObservationRenderer,a.trackRenderer],f.isDefined),d=function(a){return null!=a&&"function"!=typeof a&&a};e.forEach(b,function(a){var b=d(a.attributeField),f=d(a.attributeField2);a=d(a.attributeField3);
!1!==b&&c.push(b);!1!==f&&c.push(f);!1!==a&&c.push(a)});this._requiredFields=c}else this._requiredFields=[];this.loaded&&(this._fixRendererFields(),this._checkFields(this._requiredFields),this._collection&&(this._typesDirty=!0))},setFeatureReduction:function(a){a&&(a=t.mixin({},a),null!=a.clusterSize&&null==a.clusterRadius&&(a.clusterRadius=a.clusterSize),delete a.clusterSize);this.loaded?this._isFeatureReductionSupported(a)?this._featureReduction=a:(this._featureReduction=null,a&&console.log("Clustering is not supported for this layer: "+
this.url)):this._featureReduction=a;this._evalFeatureReduction(this._featureReduction)},hasFeatureReduction:function(){return!!this._featureReduction},getFeatureReduction:function(){var a=this._featureReduction;if(a){var a=t.mixin({},a),b=this._clusterManager;if(b=b&&b.aggregationInfo)a.clusterRadius=b.clusterRadius,a.infoTemplate=b.infoTemplate}return a},isFeatureReductionActive:function(){var a=this._clusterManager;return!!(a&&a.isClusteringEnabled()&&a.isClusteringActive())},isFeatureReductionEnabled:function(){return this._featureReductionEnabled},
enableFeatureReduction:function(){this._featureReductionEnabled||(this._featureReductionEnabled=!0,this._evalFeatureReduction(this._featureReduction))},disableFeatureReduction:function(){this._featureReductionEnabled&&(this._featureReductionEnabled=!1,this._evalFeatureReduction(this._featureReduction))},isFeatureReductionApplied:function(){return this.hasFeatureReduction()&&this.isFeatureReductionEnabled()&&this._canCluster(this.getFeatureReduction())},getAggregateGraphics:function(){return this._clusterManager?
this._clusterManager.getAggregateGraphics():[]},getChildGraphics:function(a){return this._clusterManager?this._clusterManager.getFeaturesInCluster(a):[]},getSingleGraphics:function(){return this._clusterManager?this._clusterManager.getSingleGraphics():[]},getFeatureReductionRenderer:function(){return this.isFeatureReductionActive()?this._clusterManager.getClusterRenderer():null},getFeatureReductionLayer:function(){return this._clusterManager?this._clusterManager.container:null},getFeatureReductionField:function(a){var b,
c=this._clusterManager?this._clusterManager.getClusterFields():null;a=a?a.toLowerCase():"";e.some(c,function(c){a===c.name.toLowerCase()&&(b=c);return!!b});return b},_isFeatureReductionSupported:function(a){return a&&"cluster"===a.type&&"esriGeometryPoint"===this.geometryType&&(this._collection||this._isStream||this._optQueryPagination&&this.advancedQueryCapabilities.supportsPagination)},_isReductionCompatibleRenderer:function(a){a=a&&a.declaredClass||"";a=a.toLowerCase();return-1<a.indexOf("simplerenderer")||
-1<a.indexOf("classbreaksrenderer")||-1<a.indexOf("uniquevaluerenderer")},_evalFeatureReduction:function(a){this.loaded&&this.getMap()&&(a=a||this.getFeatureReduction(),this._evalFetchMode(a),a&&this.isFeatureReductionEnabled()?this._canCluster(a)?this._clusterManager?this._updateClusterManager(a):(this._clusterManager=this._createClusterManager(a),this.onFeatureReductionChange()):(console.log("Clustering is supported only for point layers where map spatial reference is WGS84 or Web Mercator"),this._destroyClusterManager()):
this._destroyClusterManager())},_canCluster:function(a){var b=this._map.spatialReference;return this._isFeatureReductionSupported(a)&&this._isReductionCompatibleRenderer(this.renderer)&&(b.isWebMercator()||4326===b.wkid)},_createClusterManager:function(a){a=new ca({layer:this,aggregationInfo:a});this._clusterHandles=[a.on("renderer-change",t.hitch(this,function(){this.onFeatureReductionRendererChange()}))];a.initialize(this._map);return a},_updateClusterManager:function(a){var b=this._clusterManager;
b&&b.setAggregationInfo(a)},_destroyClusterManager:function(a){e.forEach(this._clusterHandles,function(a){a.remove()});this._clusterHandles=null;this._clusterManager&&(this._clusterManager.destroy(a),this._clusterManager=null,this.onFeatureReductionChange())},redraw:function(){this.inherited(arguments);this._clusterManager&&this._clusterManager.redraw();this._trackManager&&this._trackManager.container&&this._trackManager.container.redraw()},_evalSDRenderer:function(a){this.inherited(arguments);var b=
this._getRenderer();this._ager=!!(b&&b.observationAger&&b.observationRenderer);this._trackManager&&this._trackManager.container&&this._trackManager.container.setRenderer(b&&b.trackRenderer);a&&this._evalFeatureReduction()},_setMap:function(a){var b=this.inherited(arguments),c=this._mode,f=this;c&&a.loaded&&c.initialize(a);this.geometryType&&this.attr("data-geometry-type",this.geometryType.replace(/esriGeometry/i,"").toLowerCase());this._addHandle=this.on("graphic-node-add",function(a){a=a.graphic.attributes;
(a=f._selectedFeatures[a&&a[f.objectIdField]])&&a.attr("data-selected","")});return b},_unsetMap:function(a){var b=this._mode;b&&(b.suspend(),b.destroy());this._destroyClusterManager(!1);this._trackManager&&(this._trackManager.destroy(),this._trackManager=null);v.disconnect(this._zoomConnect);v.disconnect(this._addHandle);this._zoomConnect=this._addHandle=null;this._toggleTime(!1);this.inherited("_unsetMap",arguments)},refresh:function(){this._needsRefresh=!1;var a=this._mode;a&&a.refresh()},hasXYFootprint:function(){return"esriGeometryMultiPatch"===
this.geometryType&&"xyFootprint"===this.multipatchOption},getOutFields:function(){return e.filter(this._getOutFields(),function(a){return"*"===a||!!this._getField(a)},this)},getField:function(a){return this._getField(a,!0)},isOutField:function(a){a=this.getField(a);if(!a)return!1;var b=this.getOutFields();return-1<e.indexOf(b,"*")||-1<e.indexOf(b,a.name)},getFieldLabel:function(a){var b=this.infoTemplate,b=b&&b.getFieldInfo&&b.getFieldInfo(a);a=t.isFunction(a)?null:this.getField(a);var c=b||a,f="";
c&&(f=b&&b.label||a&&a.alias||c.name||c.fieldName);return f},getDomain:function(a,b){var c,f,d=b&&b.feature,g=d&&this.typeIdField&&d.attributes&&d.attributes[this.typeIdField];null!=g&&e.some(this.types,function(b){return b.id==g?((c=b.domains&&b.domains[a])&&"inherited"===c.type&&(c=this._getLayerDomain(a),f=!0),!0):!1},this);f||c||(c=this._getLayerDomain(a));return c},_getLayerDomain:function(a){var b;e.some(this.fields,function(c){c.name===a&&(b=c.domain);return!!b});return b},getType:function(a){var b,
c=a&&this.typeIdField&&a.attributes&&a.attributes[this.typeIdField];e.some(this.types,function(a){a.id==c&&(b=a);return!!b});return b},setEditable:function(a){if(!this._collection)return console.log("FeatureLayer:setEditable - this functionality is not yet supported for layer in a feature service"),this;if(!this.loaded)return this._optEditable=a,this;var b=this._editable;this._editable=a;this._updateCaps();if(b!==a)this.onCapabilitiesChange();return this},getEditCapabilities:function(a){var b={canCreate:!1,
canUpdate:!1,canDelete:!1,canUpdateGeometry:!1};if(!this.loaded||!this.isEditable())return b;var c=a&&a.feature;a=a&&a.userId||this.getUserId();var f=e.map(this.capabilities?this.capabilities.toLowerCase().split(","):[],t.trim),d=(b=-1<e.indexOf(f,"editing"))&&-1<e.indexOf(f,"create"),g=b&&-1<e.indexOf(f,"update"),f=b&&-1<e.indexOf(f,"delete"),h=this.ownershipBasedAccessControlForFeatures,l=this.editFieldsInfo,w=l&&l.creatorField,l=l&&l.realm,c=(c=c&&c.attributes)&&w?c[w]:void 0,k=!!this.userIsAdmin,
w=!h||k||!(!h.allowOthersToUpdate&&!h.allowUpdateToOthers),u=!h||k||!(!h.allowOthersToDelete&&!h.allowDeleteToOthers),q=!h||k||!h.hasOwnProperty("allowAnonymousToUpdate")||h.allowAnonymousToUpdate,h=!h||k||!h.hasOwnProperty("allowAnonymousToDelete")||h.allowAnonymousToDelete;a&&l&&(a=a+"@"+l);if(k||b&&!(d||g||f))d=g=f=!0;b={canCreate:d,canUpdate:g,canDelete:f,canUpdateGeometry:k||this.allowGeometryUpdates};a||(b.canUpdate=b.canUpdate&&q,b.canDelete=b.canDelete&&h);null===c?(b.canUpdate=b.canUpdate&&
w,b.canDelete=b.canDelete&&u):""!==c&&c&&a.toLowerCase()!==c.toLowerCase()&&(b.canUpdate=b.canUpdate&&w,b.canDelete=b.canDelete&&u);return b},getUserId:function(){var a;this.loaded&&(a=this.credential&&this.credential.userId||this.userId||"");return a},setUserIsAdmin:function(a){this.userIsAdmin=a},setEditSummaryCallback:function(a){this.editSummaryCallback=a},getEditSummary:function(a,b,c){c=f.isDefined(c)?c:(new Date).getTime();var d="";c=this.getEditInfo(a,b,c);(b=b&&b.callback||this.editSummaryCallback)&&
(c=b(a,c)||"");if(t.isString(c))d=c;else{if(c){a=c.action;b=c.userId;var g=c.timeValue,e=0;a&&e++;b&&e++;f.isDefined(g)&&e++;1<e&&(d=("edit"===a?"edit":"create")+(b?"User":"")+(f.isDefined(g)?c.displayPattern:""))}d=d&&f.substitute(c,this.i18n.layers.FeatureLayer[d])}return d},getEditInfo:function(a,b,c){if(this.loaded){c=f.isDefined(c)?c:(new Date).getTime();b=b&&b.action||"last";var d=this.editFieldsInfo,g=d&&d.creatorField,e=d&&d.creationDateField,h=d&&d.editorField,d=d&&d.editDateField,h=(a=a&&
a.attributes)&&h?a[h]:void 0,d=a&&d?a[d]:null,g=this._getEditData(a&&g?a[g]:void 0,a&&e?a[e]:null,c);c=this._getEditData(h,d,c);var l;switch(b){case "creation":l=g;break;case "edit":l=c;break;case "last":l=c||g}l&&(l.action=l===c?"edit":"creation");return l}},_getEditData:function(a,b,d){var g,e,h;f.isDefined(b)&&(e=d-b,h=0>e?"Full":6E4>e?"Seconds":12E4>e?"Minute":36E5>e?"Minutes":72E5>e?"Hour":864E5>e?"Hours":6048E5>e?"WeekDay":"Full");if(void 0!==a||h)g=g||{},g.userId=a,h&&(a=c.format,d=new Date(b),
g.minutes=Math.floor(e/6E4),g.hours=Math.floor(e/36E5),g.weekDay=a(d,{datePattern:"EEEE",selector:"date"}),g.formattedDate=a(d,{selector:"date"}),g.formattedTime=a(d,{selector:"time"}),g.displayPattern=h,g.timeValue=b);return g},isEditable:function(){return!(!this._editable&&!this.userIsAdmin)},isQueryable:function(){var a=e.map(this.capabilities?this.capabilities.toLowerCase().split(","):[],t.trim);return this._isStream||this.userIsAdmin||this._collection||-1!==e.indexOf(a,"query")||-1!==e.indexOf(a,
"catalog")},setMaxAllowableOffset:function(a){this.isEditable()||this._setMaxOffset(a,!0);return this},getMaxAllowableOffset:function(){var a=this._quantizationParameters?this._quantizationParameters.tolerance:void 0;return null!=this._maxOffset?this._maxOffset:a},_setMaxOffset:function(a,b){if(null==a)return delete this._maxOffset,delete this._quantizationParameters,this;this.quantize&&this.supportsCoordinatesQuantization?("esriGeometryPolyline"===this.geometryType?this._maxOffset=a:delete this._maxOffset,
this._quantizationParameters={mode:"view",originPosition:"upperLeft",tolerance:a,extent:this.fullExtent}):(this._isFractionalOffsetAllowed()&&b||(a=Math.floor(a)),isNaN(a)||0===a?delete this._maxOffset:this._maxOffset=a,delete this._quantizationParameters);return this},_isFractionalOffsetAllowed:function(){return null==this.version||10.1<=this.version||navigator.languages&&this._isLangWithDot(navigator.languages[0])},_isLangWithDot:function(a){a=(a=a&&a.split("-"))&&a[0]&&a[0].toLowerCase();return-1!==
e.indexOf(this._langsWithDot,a)},_langsWithDot:"ar en et fr he ja ko th vi zh".split(" "),setAutoGeneralize:function(a){this.loaded?this.isEditable()||this.mode===M.MODE_SNAPSHOT||"esriGeometryPolyline"!==this.geometryType&&"esriGeometryPolygon"!==this.geometryType&&!this.hasXYFootprint()||((this._autoGeneralize=a)?(this._autoSnapshot&&(this._prevScale=null),this._updateMaxOffset()):this._setMaxOffset(null)):this._optAutoGen=a;return this},setGDBVersion:function(a){this._collection||a===this.gdbVersion||
!a&&!this.gdbVersion||(this.gdbVersion=a,this._task.gdbVersion=a,this._url.query=t.mixin(this._url.query,{gdbVersion:a}),this.loaded&&(this.clearSelection(),this._map&&this.refresh()),this.onGDBVersionChange());return this},hasAllFeatures:function(){return this._mode?this._mode.hasAllFeatures():!0},setDefinitionExpression:function(a){this._defnExpr=a;(a=this._mode)&&a.propertyChangeHandler(1);return this},getDefinitionExpression:function(){return this._defnExpr},setTimeDefinition:function(a){this._isSnapshotMode()?
(this._timeDefn=a,(a=this._mode)&&a.propertyChangeHandler(2)):console.log("FeatureLayer.setTimeDefinition: layer in on-demand or selection mode does not support time definitions. Layer id \x3d "+this.id+", Layer URL \x3d "+this.url);return this},getTimeDefinition:function(){return this._timeDefn},setTimeOffset:function(a,b){this._timeOffset=a;this._timeOffsetUnits=b;var c=this._mode;c&&c.propertyChangeHandler(0);return this},setUseMapTime:function(a){this.useMapTime=a;this._toggleTime(!this.suspended);
(a=this._mode)&&a.propertyChangeHandler(0)},selectFeatures:function(a,c,f,d){c=c||M.SELECTION_NEW;this._hasPartialSelectedFeatures=!1;a=this._getShallowClone(a);var g=this._map,e,h=this,l=F._fixDfd(new r(F._dfdCanceller));a.outFields=this.getOutFields();a.returnGeometry=!0;a.multipatchOption=this.multipatchOption;g&&(a.outSpatialReference=new A(g.spatialReference.toJson()));if(!this._applyQueryFilters(a,!0))return e={features:[]},this._selectHandler(e,c,f,d,l),l;if(g=this._canDoClientSideQuery(a))l._pendingDfd=
b(this._doQuery(a,g)),l._pendingDfd.then(function(a){e={features:a};h._selectHandler(e,c,f,d,l)});else{if(this._collection)return this._resolve([Error("FeatureLayer::selectFeatures - "+this.invalidParams)],null,d,l,!0),l;if(this.loaded&&!this.isQueryable())return this._resolve([Error("Layer does not support query capability.")],null,d,l,!0),l;var w=this;this._ts&&(a._ts=(new Date).getTime());(l._pendingDfd=this._task.execute(a)).addCallbacks(function(a){w._selectHandler(a,c,f,d,l)},function(a){w._hasPartialSelectedFeatures=
!0;w._resolve([a],null,d,l,!0)})}return l},getSelectedFeatures:function(){var a=this._selectedFeatures,b=[],c;for(c in a)a.hasOwnProperty(c)&&b.push(a[c]);return b},clearSelection:function(a){var b=this._selectedFeatures,c=this._mode,f;for(f in b)b.hasOwnProperty(f)&&(this._unSelectFeatureIIf(f,c),c._removeFeatureIIf(f));this._selectedFeatures={};this._isSelOnly&&c._applyTimeFilter(!0);if(!a)this.onSelectionClear();return this},setSelectionSymbol:function(a){if(this._selectionSymbol=a){var b=this._selectedFeatures,
c;for(c in b)b.hasOwnProperty(c)&&b[c].setSymbol(a)}return this},getSelectionSymbol:function(){return this._selectionSymbol},setLabelingInfo:function(a){a?(this.labelingInfo=a,this._fixLabelExpr()):delete this.labelingInfo;this._collection&&(this._typesDirty=!0);this.onLabelingInfoChange()},_fixLabelExpr:function(){var a=/\[([^\[\]]+)\]/ig,b,c=this,f=function(a,b){var f=c._getField(b,!0);return"["+(f&&f.name||b)+"]"};e.forEach(this.labelingInfo,function(c){if(b=c.labelExpression)c.labelExpression=
b.replace(a,f)})},_updateRequiredFieldsFromLabelingInfo:function(){var a=[];e.forEach(this.labelingInfo,function(b){var c=b.labelExpressionInfo;if(b.labelExpression){var f=/[\[\]]/ig;b=b.labelExpression.match(/\[[^\[\]]+\]/ig);(b=e.map(b,function(a){return a.replace(f,"")}))&&(a=a.concat(b))}if(c){if(c.value){var d=/[\{\}]/ig;b=c.value.match(/\{[^\{\}]+\}/ig);(b=e.map(b,function(a){return a.replace(d,"")}))&&(a=a.concat(b))}c.expression&&(a=a.concat(K.extractFieldNames(c.expression)))}});a=e.map(a,
function(a){var b=this.getField(a);return b?b.name:a},this);this._requiredFields&&(this._requiredFields=this._requiredFields.concat(a))},__msigns:[{n:"applyEdits",c:5,a:[{i:0},{i:1}],e:4,f:1}],applyEdits:function(a,b,c,f,d,g){var h=g.assembly,w=g.dfd;this._applyNormalized(a,h&&h[0]);this._applyNormalized(b,h&&h[1]);this.onBeforeApplyEdits(a,b,c);var k={},u=this.objectIdField,h={f:"json"},q=!1;if(this._collection)g={},g.addResults=a?e.map(a,function(){q=!0;return{objectId:this._nextId++,success:!0}},
this):null,g.updateResults=b?e.map(b,function(a){q=!0;var b=a.attributes[u];k[b]=a;return{objectId:b,success:!0}},this):null,g.deleteResults=c?e.map(c,function(a){q=!0;return{objectId:a.attributes[u],success:!0}},this):null,q?this._editHandler(g,a,k,f,d,w):this._resolve([g.addResults,g.updateResults,g.deleteResults],null,f,w);else{a&&0<a.length&&(h.adds=this._convertFeaturesToJson(a,0,1),q=!0);if(b&&0<b.length){for(g=0;g<b.length;g++){var x=b[g];k[x.attributes[u]]=x}h.updates=this._convertFeaturesToJson(b,
0,0,1);q=!0}if(c&&0<c.length){b=[];for(g=0;g<c.length;g++)b.push(c[g].attributes[u]);h.deletes=b.join(",");q=!0}if(q){var r=this;return l({url:this._url.path+"/applyEdits",content:t.mixin(h,this._url.query),callbackParamName:"callback",load:function(b){r._editHandler(b,a,k,f,d,w)},error:function(a){r._resolve([a],null,d,w,!0)}},{usePost:!0})}this._resolve([],null,f,w)}},queryFeatures:function(a,b,c){return this._query("execute","onQueryFeaturesComplete",a,b,c)},queryRelatedFeatures:function(a,b,c){return this._query("executeRelationshipQuery",
"onQueryRelatedFeaturesComplete",a,b,c)},queryIds:function(a,b,c){return this._query("executeForIds","onQueryIdsComplete",a,b,c)},queryCount:function(a,b,c){return this._query("executeForCount","onQueryCountComplete",a,b,c)},queryExtent:function(a,b,c){return this._query("executeForExtent","onQueryExtentComplete",a,b,c)},queryAttachmentInfos:function(a,b,c){var f=this._url.path+"/"+a+"/attachments",d=new r(F._dfdCanceller),g=this;d._pendingDfd=l({url:f,content:t.mixin({f:"json"},this._url.query),
callbackParamName:"callback",load:function(c){c=c.attachmentInfos;var h;e.forEach(c,function(b){h=q.objectToQuery({gdbVersion:g._url.query&&g._url.query.gdbVersion,layer:g._url.query&&g._url.query.layer,token:g._getToken()});b.url=f+"/"+b.id+(h?"?"+h:"");b.objectId=a});g._resolve([c],"onQueryAttachmentInfosComplete",b,d)},error:function(a){g._resolve([a],null,c,d,!0)}});return d},addAttachment:function(a,b,c,f){return this._sendAttachment("add",a,b,c,f)},updateAttachment:function(a,b,c,f,d){c.appendChild(u.create("input",
{type:"hidden",name:"attachmentId",value:b}));return this._sendAttachment("update",a,c,f,d)},deleteAttachments:function(a,b,c,f){var d=this._url.path+"/"+a+"/deleteAttachments",g=new r(F._dfdCanceller),h=this;b={f:"json",attachmentIds:b.join(",")};g._pendingDfd=l({url:d,content:t.mixin(b,this._url.query),callbackParamName:"callback",load:t.hitch(this,function(b){b=b.deleteAttachmentResults;b=e.map(b,function(b){b=new Y(b);b.attachmentId=b.objectId;b.objectId=a;return b});h._resolve([b],"onDeleteAttachmentsComplete",
c,g)}),error:function(a){h._resolve([a],null,f,g,!0)}},{usePost:!0});return g},addType:function(a){var b=this.types;if(b){if(e.some(b,function(b){return b.id==a.id?!0:!1}))return!1;b.push(a)}else this.types=[a];return this._typesDirty=!0},deleteType:function(a){if(this._collection){var b=this.types;if(b){var c=-1;e.some(b,function(b,f){return b.id==a?(c=f,!0):!1});if(-1<c)return this._typesDirty=!0,b.splice(c,1)[0]}}},toJson:function(){var a=this._json;if(a=t.isString(a)?k.fromJson(a):t.clone(a)){var a=
a.layerDefinition?a:{layerDefinition:a},b=a.layerDefinition,c=this._collection;if(c&&this._typesDirty){b.types=e.map(this.types||[],function(a){return a.toJson()});var f=this.renderer,d=this.labelingInfo,g=b.drawingInfo;!f&&!d||g||(g=b.drawingInfo={});g&&f&&-1===f.declaredClass.indexOf("TemporalRenderer")&&(g.renderer=f.toJson());d&&(g.labelingInfo=e.map(d,function(a){return a.toJson()}))}f=null;if(!c||this._fcAdded)f={geometryType:b.geometryType,features:this._convertFeaturesToJson(this.graphics,
!0)};a.featureSet=t.mixin({},a.featureSet||{},f);a.featureSet.transform&&(d=a.featureSet.transform,delete a.featureSet.transform,f=new P(a.featureSet),f.quantize(d),a.featureSet=f.toJson());c&&(a.nextObjectId=this._nextId,b.capabilities=this.capabilities);return a}},onSelectionComplete:function(){},onSelectionClear:function(){},onBeforeApplyEdits:function(){},onEditsComplete:function(){},onQueryFeaturesComplete:function(){},onQueryRelatedFeaturesComplete:function(){},onQueryIdsComplete:function(){},
onQueryCountComplete:function(){},onQueryExtentComplete:function(){},onQueryAttachmentInfosComplete:function(){},onAddAttachmentComplete:function(){},onUpdateAttachmentComplete:function(){},onDeleteAttachmentsComplete:function(){},onCapabilitiesChange:function(){},onGDBVersionChange:function(){},onQueryLimitExceeded:function(){},onLabelingInfoChange:function(){},onFeatureReductionRendererChange:function(){},onFeatureReductionChange:function(){},_evalGeometryOperations:function(){var a=new r;setTimeout(t.hitch(this,
function(){this._isGeometryOperationsUsed()?K.enableGeometryOperations().always(function(){a.resolve()}):a.resolve()}),0);return a.promise},_isGeometryOperationsUsed:function(){var a=this.infoTemplate,b=this.renderer,c=this.labelingInfo;return a&&a.hasGeometryOperations&&a.hasGeometryOperations()||b&&b.hasGeometryOperations&&b.hasGeometryOperations()||e.some(c,function(a){return K.hasGeometryOperations(a.labelExpressionInfo&&a.labelExpressionInfo.expression)})?!0:!1},_forceIdentity:function(){var b=
new r,c=this,f,d=this._url&&this._url.path;f=d&&d.toLowerCase().indexOf("/rest/services");var g=this.editFieldsInfo,g=g&&(g.creatorField||g.editorField);(this.userIsAdmin||g)&&!this._getToken()&&-1<f&&a.id?(f=d.substring(0,f)+"/rest/info",l({url:f,content:{f:"json"},handleAs:"json",callbackParamName:"callback"}).then(function(b){if(b.owningSystemUrl)return a.id.checkSignInStatus(b.owningSystemUrl+"/sharing")}).then(function(b){if(b)return a.id.getCredential(d)}).then(function(a){a&&c._findCredential()}).always(function(){b.resolve()})):
b.resolve();return b.promise},_isSnapshotMode:function(){return this._mode?this._mode.isInstanceOf(U):!1},_checkMode:function(a){var b=this.geometryType,c=this.maxRecordCount;a=(a=a&&a.features&&a.features[0])&&a.attributes&&a.attributes.exceedslimit;this.mode===M.MODE_AUTO&&!this.isEditable()&&0===a&&(this.queryPagination||("esriGeometryPolyline"===b||"esriGeometryPolygon"===b||"esriGeometryMultipoint"===b||this.hasXYFootprint())&&c>=this.maxRecordCountForAuto||"esriGeometryPoint"===b&&c>=this.maxPointCountForAuto)&&
(this.currentMode=M.MODE_SNAPSHOT,this._mode=new U(this),this._autoSnapshot=!0)},_evalFetchMode:function(a){this.loaded&&(a&&this.isFeatureReductionEnabled()&&this._canCluster(a)?this._switchToSnapshotMode():this._switchToNormalMode())},_switchToSnapshotMode:function(){if(null==this._savedMode){var a=this.currentMode;a!==M.MODE_SNAPSHOT&&a!==M.MODE_STREAM&&a!==M.MODE_SELECTION&&(this._savedMode=this.mode,this._mode.suspend(),this._mode.destroy(),this.mode=this.currentMode=M.MODE_SNAPSHOT,this._mode=
new U(this),this.queryPagination=this._optQueryPagination&&this.advancedQueryCapabilities.supportsPagination,this.clearSelection(),(a=this.getMap())&&a.loaded&&(this._mode.initialize(a),this._mode.startup()))}},_switchToNormalMode:function(){if(null!=this._savedMode){this._mode.suspend();this._mode.destroy();this.mode=this._savedMode;this._savedMode=null;this.currentMode=M.MODE_ONDEMAND;this._mode=new ka(this);this.queryPagination=!1;this.clearSelection();var a=this.getMap();a&&a.loaded&&(this._mode.initialize(a),
this._mode.startup())}},_queryLimit:function(){var a=this,b=new r;this._limitPromise=b.promise;this._limitPromise.then(function(b){a._checkMode(b)});this._limitPromise.always(function(){a._limitPromise=null});setTimeout(function(){var c=new X,f=new N;f.statisticType="exceedslimit";f.maxPointCount=a.maxPointCountForAuto;f.maxRecordCount=a.maxRecordCountForAuto;f.maxVertexCount=a.maxVertexCountForAuto;f.outStatisticFieldName="exceedslimit";c.outStatistics=[f];a.queryFeatures(c).promise.then(function(a){b.resolve(a)},
function(a){b.reject(a)})},0)},_updateCaps:function(){var a=this._editable,b=t.trim(this.capabilities||""),c=e.map(b?b.split(","):[],t.trim),f=e.map(b?b.toLowerCase().split(","):[],t.trim),b=e.indexOf(f,"editing"),d,f={Create:e.indexOf(f,"create"),Update:e.indexOf(f,"update"),Delete:e.indexOf(f,"delete")};if(a&&-1===b)c.push("Editing");else if(!a&&-1<b){a=[b];for(d in f)-1<f[d]&&a.push(f[d]);a.sort();for(d=a.length-1;0<=d;d--)c.splice(a[d],1)}this.capabilities=c.join(",")},_counter:{value:0},_getUniqueId:function(){return this._counter.value++},
onSuspend:function(){this.inherited(arguments);this._toggleTime(!1);var a=this._mode;a&&a.suspend()},onResume:function(a){this.inherited(arguments);this._toggleTime(!0);var b=this._map,c=this._getRenderer();if(a.firstOccurrence){if(this._fixRendererFields(),this._updateRequiredFieldsFromLabelingInfo(),this._checkFields(),this.clearSelection(),this._evalFeatureReduction(),this.timeInfo&&!this._trackManager&&(this._trackIdField||c&&(c.latestObservationRenderer||c.trackRenderer))&&(this._trackManager=
new ma(this),this._trackManager.initialize(b),this._childLayer=this._trackManager.container),c&&"colors"in c&&"blurRadius"in c&&"maxPixelIntensity"in c&&"esriGeometryPoint"==this.geometryType&&!this._heatmapManager&&(this._heatmapManager=new aa(this),this._heatmapManager.initialize(b)),this._autoSnapshot&&this._autoGeneralize&&("esriGeometryPolyline"===this.geometryType||"esriGeometryPolygon"===this.geometryType||this.hasXYFootprint())&&!this.isEditable()&&null==this.getMaxAllowableOffset()&&(c=this.generalizeForScale,
this._calculatedScale=c=this.maxScale?this.maxScale:this.minScale?Math.min(c,this.minScale):Math.min(c,ja.getScale(b,this.initialExtent)),this._calcMaxOffset=b.extent.getWidth()/b.width/b.getScale()*c),this._zoomConnect=v.connect(b,"onZoomEnd",this,this._zoomEndHandler),this._updateMaxOffset(),this._needsRefresh=!1,c=this._mode)c._init||c.initialize(b),c.startup()}else this._zoomEndHandler(),this._mode&&this._mode.resume()},_zoomEndHandler:function(){var a=this._map;this._updateMaxOffset();this._prevScale=
a.getScale();!this.suspended&&this._needsRefresh&&this.refresh()},_updateMaxOffset:function(){var a=this._map;a&&a.loaded&&this._autoGeneralize&&(this._autoSnapshot?(a=this.getMaxAllowableOffset(),this._setMaxOffset(this._getMaxOffsetForScale(),!0),this._needsRefresh||(this._needsRefresh=a!=this.getMaxAllowableOffset())):this._setMaxOffset(a.extent.getWidth()/a.width,!a.extent.spatialReference.isWebMercator()))},_getMaxOffsetForScale:function(){if(this._map){var a=this._map.getScale(),b=this._calculatedScale,
c=this._calcMaxOffset,f=this._prevScale;return a>=b&&(null==f||f<b)?c:a<b&&(null==f||f>=b)?null:this.getMaxAllowableOffset()}},_toggleTime:function(a){var b=this._map;a&&this.timeInfo&&this.useMapTime&&b?(this._mapTimeExtent=b.timeExtent,this._timeConnect||(this._timeConnect=v.connect(b,"onTimeExtentChange",this,this._timeChangeHandler))):(this._mapTimeExtent=null,v.disconnect(this._timeConnect),this._timeConnect=null)},_timeChangeHandler:function(a){this._mapTimeExtent=a;(a=this._mode)&&a.propertyChangeHandler(0)},
_getOffsettedTE:function(a){var b=this._timeOffset,c=this._timeOffsetUnits;return a&&b&&c?a.offset(-1*b,c):a},_getTimeOverlap:function(a,b){return a&&b?a.intersection(b):a||b},_getTimeFilter:function(a){var b=this.getTimeDefinition(),c;if(b&&(c=this._getTimeOverlap(b,null),!c))return[!1];if(a){if(a=c?this._getTimeOverlap(a,c):a,!a)return[!1]}else a=c;return[!0,a]},_getAttributeFilter:function(a){var b=this.getDefinitionExpression();return a?b?"("+b+") AND ("+a+")":a:b},_applyQueryFilters:function(a,
b){a.where=this._getAttributeFilter(a.where);a.returnGeometry&&null==a.maxAllowableOffset&&!a.quantizationParameters&&(a.maxAllowableOffset=this._maxOffset,a.quantizationParameters=this._quantizationParameters);b&&this.supportsAdvancedQueries&&(a.orderByFields=a.orderByFields||this.getOrderByFields());if(this.timeInfo){var c=this._getTimeFilter(a.timeExtent);if(c[0])a.timeExtent=c[1];else return!1}return!0},_add:function(a){var b=this._selectionSymbol,c=a.attributes,f=this.visibilityField;b&&this._isSelOnly&&
a.setSymbol(b);if(f&&c&&c.hasOwnProperty(f))a[c[f]?"show":"hide"]();return this.add.apply(this,arguments)},_remove:function(){return this.remove.apply(this,arguments)},_canDoClientSideQuery:function(a){var b=[],c=this._map,f;if((this._collection||!this._isTable&&c)&&!(a.text||a.where&&a.where!==this.getDefinitionExpression()||a.orderByFields&&a.orderByFields.length&&(f=this.getOrderByFields()||[])&&a.orderByFields.join()!==f.join()||a.outStatistics||a.returnDistinctValues)){f=this._isSnapshotMode();
var d=this._isSelOnly,g=a.geometry;if(g){if(d||a.spatialRelationship!==X.SPATIAL_REL_INTERSECTS||"extent"!==g.type||!f&&!c.extent.contains(g))return;b.push(1)}if(c=a.objectIds)if(f)b.push(2);else{var g=c.length,h=this._mode,l=0,w;for(w=0;w<g;w++)h._getFeature(c[w])&&l++;if(l===g)b.push(2);else return}if(this.timeInfo)if(a=a.timeExtent,c=this._mapTimeExtent,f)a&&b.push(3);else if(d){if(a)return}else if(c)if(-1!==e.indexOf(b,2))a&&b.push(3);else if(-1!==e.indexOf(b,1))a==c&&b.push(3);else return;else if(0<
b.length)a&&b.push(3);else if(a)return;return 0<b.length?b:null}},_getAbsMid:function(a){return m.toAbsMid?m.toAbsMid(a):n.id.replace(/\/[^\/]*$/ig,"/")+a},_doQuery:function(a,b,c){var f=[],d=this.objectIdField,g=this,h=new r,l=new r,w=this.graphics;if(-1!==e.indexOf(b,1)){var k=this.spatialIndex||this._map&&this._map.spatialIndex,u,q=a.geometry._normalize(null,!0);null==k&&ga.autoSpatialIndexing?u=(this._map||this).addPlugin(this._getAbsMid("../plugins/spatialIndex")).then(t.hitch(this,t.partial(this._getFromIndex,
q,k)),function(a){l.resolve(t.hitch(this,t.partial(this._filterByExtent,w,q)))}):k&&(u=this._getFromIndex(q,k));u?u.then(function(a){for(var b=0;b<a.length;b++)a[b].results&&(f=f.concat(a[b].results));l.resolve(f)}).otherwise(function(a){l.reject(a)}):l.resolve(this._filterByExtent(w,q))}else l.resolve(w);l.then(function(l){f=l;if(-1!==e.indexOf(b,2)){var w=a.objectIds;f=e.filter(f,function(a){return-1<e.indexOf(w,a.attributes[d])})}-1!==e.indexOf(b,3)&&g.timeInfo&&(l=a.timeExtent,f=g._filterByTime(f,
l.startTime,l.endTime).match);c&&(f=e.map(f,function(a){return a.attributes[d]},this));h.resolve(f)});return h},_getFromIndex:function(a,b){b=b||this.spatialIndex||this._map.spatialIndex;a instanceof Array||(a=[a]);var c=this.id;return g(e.map(a,function(a){return b.intersects(a,c)}))},_filterByExtent:function(a,b){for(var c=[],f=0,d=a.length;f<d;f++){var g=a[f],e=g.geometry;e&&(this.normalization&&b.length?(b[0].intersects(e)||b[1].intersects(e))&&c.push(g):b.intersects(e)&&c.push(g))}return c},
_filterByTime:function(a,b,c){var d=this._startTimeField,g=this._endTimeField,e;this._twoTimeFields||(e=d||g);var h=f.isDefined,l=[],w=[],k,u=a.length,q,x;b=b?b.getTime():-Infinity;c=c?c.getTime():Infinity;if(e)for(k=0;k<u;k++)q=a[k],x=q.attributes,d=x[e],d>=b&&d<=c?l.push(q):w.push(q);else for(k=0;k<u;k++)q=a[k],x=q.attributes,e=x[d],x=x[g],e=h(e)?e:-Infinity,x=h(x)?x:Infinity,e>=b&&e<=c||x>=b&&x<=c||b>=e&&c<=x?l.push(q):w.push(q);return{match:l,noMatch:w}},_getSizeVariables:function(a){return a&&
e.filter(a.getVisualVariablesForType("sizeInfo",!1),function(a){return!(!a.field&&!a.valueExpression)})},_needClientSideSorting:function(a){return this._collection?!(!a||!a.length):e.some(a,function(a){return!!a.valueExpression})},_sortFeatures:function(a){var b=this.renderer,c=this._getSizeVariables(b);if(a&&1<a.length&&this._needClientSideSorting(c)){var f=c[0],d=this;a.sort(function(a,c){a._layer||(a._layer=d);c._layer||(c._layer=d);var g=b._getDataValue(a,f,"sizeInfo",null,d),e=b._getDataValue(c,
f,"sizeInfo",null,d);return null==g?-1:null==e?1:e-g})}return a},_resolve:function(a,b,c,f,d){b&&this[b].apply(this,a);c&&c.apply(null,a);f&&F._resDfd(f,a,d)},_getShallowClone:function(a){var b=new X,c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},_query:function(a,c,f,d,g){var h=this,l=this._map,w=new r(F._dfdCanceller),k=f,u,q,x;if("executeRelationshipQuery"!==a){var k=this._getShallowClone(f),t=this.getOutFields();k.outFields||(k.outFields=t);k.outFields&&k.outFields.length&&(q=-1<e.indexOf(t,
"*")?!1:!e.every(k.outFields,function(a){return-1<e.indexOf(t,a)}));k.returnGeometry=f.hasOwnProperty("returnGeometry")?f.returnGeometry:!f.outStatistics;k.returnGeometry&&(k.multipatchOption=this.multipatchOption,null!=k.maxAllowableOffset||k.quantizationParameters)&&(f=null!=k.maxAllowableOffset?k.maxAllowableOffset:k.quantizationParameters.tolerance,null!=f&&f!==this.getMaxAllowableOffset()&&(x=!0));var m;l&&(l=l&&l.spatialReference,(f=k.outSpatialReference)?u=!f.equals(l):k.outSpatialReference=
new A(l.toJson()));if(!this._applyQueryFilters(k,"execute"===a&&!k.outStatistics)){switch(a){case "execute":m=new P({features:[]});break;case "executeForIds":m=[];break;case "executeForCount":m=0;break;case "executeForExtent":m={}}this._resolve([m],c,d,w);return w}if(l="executeForExtent"!==a&&!u&&!q&&!x&&this._canDoClientSideQuery(k))return w._pendingDfd=b(this._doQuery(k,l,"executeForIds"===a||"executeForCount"===a)),w._pendingDfd.then(function(b){switch(a){case "execute":m=new P;m.features=b;break;
case "executeForIds":m=b;break;case "executeForCount":m=b.length}h._resolve([m],c,d,w)}),w}if(this._collection)return this._resolve([Error("FeatureLayer::_query - "+this.invalidParams)],null,g,w,!0),w;if(this.loaded&&!this.isQueryable())return this._resolve([Error("Layer does not support query capability.")],null,g,w,!0),w;this._ts&&(k._ts=(new Date).getTime());(w._pendingDfd=this._task[a](k)).addCallbacks(function(b){var f=!!k.outStatistics||u||q||x;if("execute"===a||"executeRelationshipQuery"===
a){var g,e;if("execute"===a)for(g=b.features,e=g.length,--e;0<=e;e--){if(g[e]._layer=h,!f&&!h._isTable){var l=h._mode._getFeature(g[e].attributes[h.objectIdField]);l&&g.splice(e,1,l)}}else for(l in b)if(b.hasOwnProperty(l))for(g=b[l].features,e=g.length,--e;0<=e;e--)g[e]._layer=h}h._resolve([b],c,d,w)},function(a){h._resolve([a],null,g,w,!0)});return w},_convertFeaturesToJson:function(a,b,c,f){var d=[],g=this._selectionSymbol,h=this.visibilityField,l,w=this.objectIdField;this.loaded&&(c||f)&&(l=e.filter(this.fields,
function(a){return!1===a.editable&&(!f||a.name!==w)}));for(c=0;c<a.length;c++){var u=a[c],q={},x=u.geometry,r=u.attributes,m=u.symbol;!x||f&&this.loaded&&!this.allowGeometryUpdates||(q.geometry=x.toJson());h?(q.attributes=r=t.mixin({},r),r[h]=u.visible?1:0):r&&(q.attributes=t.mixin({},r));q.attributes&&l&&l.length&&e.forEach(l,function(a){delete q.attributes[a.name]});m&&m!==g&&(q.symbol=m.toJson());d.push(q)}return b?d:k.toJson(d)},_selectHandler:function(a,b,c,f,d){var g;switch(b){case M.SELECTION_NEW:this.clearSelection(!0);
g=!0;break;case M.SELECTION_ADD:g=!0;break;case M.SELECTION_SUBTRACT:g=!1}f=a.features;var e=this._mode,h=[],l=this.objectIdField,w,k;if(g)for(g=0;g<f.length;g++)w=f[g],k=w.attributes[l],w=e._addFeatureIIf(k,w),h.push(w),this._selectFeatureIIf(k,w,e);else for(g=0;g<f.length;g++)w=f[g],k=w.attributes[l],this._unSelectFeatureIIf(k,e),k=e._removeFeatureIIf(k),h.push(k||w);this._isSelOnly&&e._applyTimeFilter(!0);this._hasPartialSelectedFeatures=!!a.exceededTransferLimit;this._resolve([h,b,a.exceededTransferLimit?
{queryLimitExceeded:!0}:null],"onSelectionComplete",c,d);if(a.exceededTransferLimit)this.onQueryLimitExceeded()},_selectFeatureIIf:function(a,b,c){var f=this._selectedFeatures,d=f[a];d||(c._incRefCount(a),f[a]=b,this._isTable||(this._setSelectSymbol(b),b.attr("data-selected","")));return d||b},_unSelectFeatureIIf:function(a,b){var c=this._selectedFeatures[a];c&&(b._decRefCount(a),delete this._selectedFeatures[a],this._isTable||(this._setUnSelectSymbol(c),c.attr("data-selected")));return c},_isSelected:function(a){},
_setSelectSymbol:function(a){var b=this._selectionSymbol;b&&!this._isSelOnly&&a.setSymbol(b)},_setUnSelectSymbol:function(a){var b=this._selectionSymbol;b&&!this._isSelOnly&&b===a.symbol&&a.setSymbol(null,!0)},_getOutFields:function(){var a=[this.objectIdField,this.typeIdField,this.creatorField,this._startTimeField,this._endTimeField,this._trackIdField].concat(this._requiredFields).concat(this.dataAttributes),a=e.filter(a,function(a,b,c){return!!a&&e.indexOf(c,a)===b}),b=t.clone(this._outFields);
if(b){if(-1!==e.indexOf(b,"*"))return b;e.forEach(a,function(a){-1===e.indexOf(b,a)&&b.push(a)});return b}return a},_checkFields:function(a){var b=a||this._getOutFields();e.forEach(b,function(a){"*"!==a&&(this._getField(a)||console.debug("esri.layers.FeatureLayer: "+f.substitute({url:this.url,field:a},"unable to find '${field}' field in the layer 'fields' information [url: ${url}]")))},this);a||this._isTable||this._fserver||this._collection||this._isStream||e.some(this.fields,function(a){return a&&
"esriFieldTypeGeometry"===a.type?!0:!1})||console.debug("esri.layers.FeatureLayer: "+f.substitute({url:this.url},"unable to find a field of type 'esriFieldTypeGeometry' in the layer 'fields' information. If you are using a map service layer, features will not have geometry [url: ${url}]"))},_fixFieldCase:function(a,b,c){var f=a&&a[b],d;if(f&&!t.isFunction(f)){if(d=!this._getField(f)&&this._getField(f,!0))f=a[b]=d.name;c&&c.push(f)}return f},_fixRendererFields:function(){var a=this.renderer;this._orderBy=
null;this._requiredFields=[];if(a&&0<this.fields.length){var b=[],c,a=e.filter([a,a.observationRenderer,a.latestObservationRenderer,a.trackRenderer],f.isDefined),d=[].concat(a);e.forEach(a,function(a){e.forEach(a.rendererInfos,function(a){a.renderer&&d.push(a.renderer)})});e.forEach(d,function(a){this._fixFieldCase(a,"attributeField",b);this._fixFieldCase(a,"attributeField2",b);this._fixFieldCase(a,"attributeField3",b);this._fixFieldCase(a.rotationInfo,"field",b);(c=this._fixFieldCase(a.sizeInfo,
"field",b))&&!this._orderBy&&(this._orderBy=[c+" DESC"]);this._fixFieldCase(a.sizeInfo,"normalizationField",b);this._fixFieldCase(a.colorInfo,"field",b);this._fixFieldCase(a.colorInfo,"normalizationField",b);this._fixFieldCase(a.field,"field",b);this._fixFieldCase(a.opacityInfo,"field",b);this._fixFieldCase(a.opacityInfo,"normalizationField",b);e.forEach(a.visualVariables,function(a){c=this._fixFieldCase(a,"field",b);"sizeInfo"===a.type&&c&&!this._orderBy&&(this._orderBy=[c+" DESC"]);this._fixFieldCase(a,
"normalizationField",b)},this);var f=e.map(a.getFieldsUsedInExpressions(),function(a){var b=this.getField(a);return b?b.name:a},this);b=b.concat(f);this._orderBy||!a.addBreak||t.isFunction(a.attributeField)||!a.backgroundFillSymbol&&!this._hasSizeDiff(a)||(this._orderBy=[a.attributeField+" DESC"])},this);this._requiredFields=e.filter(b,f.isDefined)}},_hasSizeDiff:function(a){var b=Number.MAX_VALUE,c=-Number.MAX_VALUE,f,d;e.forEach(a.infos,function(a){if(d=a.symbol){f=0;switch(d.type){case "simplemarkersymbol":f=
d.size;break;case "picturemarkersymbol":f=(d.width+d.height)/2;break;case "simplelinesymbol":case "cartographiclinesymbol":f=d.width;break;case "simplefillsymbol":case "picturefillsymbol":f=d.outline&&d.outline.width}f&&(b=Math.min(b,f),c=Math.max(c,f))}});return b!==Number.MAX_VALUE&&c!==-Number.MAX_VALUE&&1<Math.abs(c-b)},getOrderByFields:function(){var a=this.orderByFields||this._orderBy;return this.supportsAdvancedQueries&&a?e.filter(a,function(a){a=a.split(" ")[0];return!!this._getField(a,!0)},
this):null},_getField:function(a,b){var c=this.fields;if(!c||0===c.length)return null;var f;b&&(a=a.toLowerCase());e.some(c,function(c){var d=!1;(d=b?c&&c.name.toLowerCase()===a?!0:!1:c&&c.name===a?!0:!1)&&(f=c);return d});return f},_getDateOpts:function(){this._dtOpts||(this._dtOpts={properties:e.map(e.filter(this.fields,function(a){return!(!a||"esriFieldTypeDate"!==a.type)}),function(a){return a.name})});return this._dtOpts},_applyNormalized:function(a,b){a&&b&&e.forEach(a,function(a,c){a&&b[c]&&
a.setGeometry(b[c])})},_editHandler:function(a,b,c,f,d,g){d=a.addResults;var h=a.updateResults;a=a.deleteResults;var l,w,k,u,q,x=this.objectIdField,r=this._mode,G=this._isTable;l=this.editFieldsInfo;u=this.getOutFields()||[];var m=l&&l.creatorField,n=l&&l.creationDateField,y=l&&l.editorField,v=l&&l.editDateField;l=l&&l.realm;-1===e.indexOf(u,"*")&&(m&&-1===e.indexOf(u,m)&&(m=null),n&&-1===e.indexOf(u,n)&&(n=null),y&&-1===e.indexOf(u,y)&&(y=null),v&&-1===e.indexOf(u,v)&&(v=null));var N=n||v?(new Date).getTime():
null,L=m||y?this.getUserId():void 0;L&&l&&(L=L+"@"+l);if(d){var E=this.globalIdField;for(l=0;l<d.length;l++)d[l]=new Y(d[l]),G||(w=d[l],w.success&&(k=w.objectId,u=b[l],(q=u._graphicsLayer)&&q!==this&&q.remove(u),q=u.attributes||{},q[x]=k,k=w.globalId,E&&k&&(q[E]=k),m&&(q[m]=L),y&&(q[y]=L),n&&(q[n]=N),v&&(q[v]=N),u.setAttributes(q),r._init&&r.drawFeature(u)))}if(h)for(l=0;l<h.length;l++)if(h[l]=new Y(h[l]),!G&&(w=h[l],w.success)){k=w.objectId;u=c[k];if(b=r._getFeature(k))b.geometry!==u.geometry&&u.geometry&&
b.setGeometry(H.fromJson(u.geometry.toJson())),b.attributes!==u.attributes&&u.attributes&&b.setAttributes(t.mixin(b.attributes,u.attributes)),this._repaint(b,k);u=b||u;q=u.attributes||{};y&&(q[y]=L);v&&(q[v]=N);u.setAttributes(q)}if(a){c=[];for(l=0;l<a.length;l++)if(a[l]=new Y(a[l]),!G&&(w=a[l],w.success&&(k=w.objectId,u=r._getFeature(k))))this._unSelectFeatureIIf(k,r)&&c.push(u),u._count=0,r._removeFeatureIIf(k);if(0<c.length)this.onSelectionComplete(c,M.SELECTION_SUBTRACT)}this._resolve([d,h,a],
"onEditsComplete",f,g)},_sendAttachment:function(a,b,c,f,d){var g=this;return l({url:this._url.path+"/"+b+"/"+("add"===a?"addAttachment":"updateAttachment"),form:c,content:t.mixin(this._url.query,{f:"json",token:this._getToken()||void 0}),callbackParamName:"callback.html",handleAs:"json"}).addCallback(function(c){var d="add"===a?"onAddAttachmentComplete":"onUpdateAttachmentComplete";c=new Y(c["add"===a?"addAttachmentResult":"updateAttachmentResult"]);c.attachmentId=c.objectId;c.objectId=b;g._resolve([c],
d,f);return c}).addErrback(function(a){g._resolve([a],null,d,null,!0)})},_repaint:function(a,b,c){b=f.isDefined(b)?b:a.attributes[this.objectIdField];b in this._selectedFeatures&&this._selectionSymbol||a.setSymbol(a.symbol,c)},_getKind:function(a){var b=this._trackManager;return b?b.isLatestObservation(a)?1:0:0}});t.mixin(M,{MODE_SNAPSHOT:0,MODE_ONDEMAND:1,MODE_SELECTION:2,SELECTION_NEW:3,SELECTION_ADD:4,SELECTION_SUBTRACT:5,MODE_AUTO:6,MODE_STREAM:7,POPUP_NONE:"esriServerHTMLPopupTypeNone",POPUP_HTML_TEXT:"esriServerHTMLPopupTypeAsHTMLText",
POPUP_URL:"esriServerHTMLPopupTypeAsURL"});Q._createWrappers(M);h("extend-esri")&&t.setObject("layers.FeatureLayer",M,a);return M})},"esri/layers/FeatureType":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has ../kernel ../lang ../symbols/jsonUtils ./RangeDomain ./CodedValueDomain ./InheritedDomain ./FeatureTemplate".split(" "),function(m,n,d,v,t,e,k,r,c,h,q){m=m(null,{declaredClass:"esri.layers.FeatureType",constructor:function(d){if(d&&n.isObject(d)){this.id=d.id;this.name=
d.name;var e=d.symbol;e&&(this.symbol=k.fromJson(e));var e=d.domains,b,g=this.domains={};for(b in e)if(e.hasOwnProperty(b)){var a=e[b];switch(a.type){case "range":g[b]=new r(a);break;case "codedValue":g[b]=new c(a);break;case "inherited":g[b]=new h(a)}}if(b=d.templates)for(e=this.templates=[],d=0;d<b.length;d++)e.push(new q(b[d]))}},toJson:function(){var c={id:this.id,name:this.name,symbol:this.symbol&&this.symbol.toJson()},h,b=this.domains,g=this.templates,a=e.fixJson;if(b){var f=c.domains={};for(h in b)b.hasOwnProperty(h)&&
(f[h]=b[h]&&b[h].toJson());a(f)}g&&(c.templates=d.map(g,function(a){return a.toJson()}));return a(c)}});v("extend-esri")&&n.setObject("layers.FeatureType",m,t);return m})},"esri/layers/FeatureTemplate":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../kernel ../lang ../graphic".split(" "),function(m,n,d,v,t,e){m=m(null,{declaredClass:"esri.layers.FeatureTemplate",constructor:function(d){d&&n.isObject(d)&&(this.name=d.name,this.description=d.description,this.drawingTool=d.drawingTool,
this.thumbnail=d.thumbnail,d=d.prototype,this.prototype=new e(d.geometry,null,d.attributes))},toJson:function(){return t.fixJson({name:this.name,description:this.description,drawingTool:this.drawingTool,thumbnail:t.fixJson(n.clone(this.thumbnail)),prototype:this.prototype&&this.prototype.toJson()})}});n.mixin(m,{TOOL_AUTO_COMPLETE_POLYGON:"esriFeatureEditToolAutoCompletePolygon",TOOL_CIRCLE:"esriFeatureEditToolCircle",TOOL_ELLIPSE:"esriFeatureEditToolEllipse",TOOL_FREEHAND:"esriFeatureEditToolFreehand",
TOOL_LINE:"esriFeatureEditToolLine",TOOL_NONE:"esriFeatureEditToolNone",TOOL_POINT:"esriFeatureEditToolPoint",TOOL_POLYGON:"esriFeatureEditToolPolygon",TOOL_RECTANGLE:"esriFeatureEditToolRectangle",TOOL_ARROW:"esriFeatureEditToolArrow",TOOL_TRIANGLE:"esriFeatureEditToolTriangle",TOOL_LEFT_ARROW:"esriFeatureEditToolLeftArrow",TOOL_RIGHT_ARROW:"esriFeatureEditToolRightArrow",TOOL_UP_ARROW:"esriFeatureEditToolUpArrow",TOOL_DOWN_ARROW:"esriFeatureEditToolDownArrow"});d("extend-esri")&&n.setObject("layers.FeatureTemplate",
m,v);return m})},"esri/layers/FeatureEditResult":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel"],function(m,n,d,v){m=m(null,{declaredClass:"esri.layers.FeatureEditResult",constructor:function(d){d&&n.isObject(d)&&(this.objectId=d.objectId,this.globalId=d.globalId,this.success=d.success,d.success||(d=d.error,this.error=Error(),this.error.code=d.code,this.error.message=d.description))}});d("extend-esri")&&n.setObject("layers.FeatureEditResult",m,v);return m})},"esri/layers/SnapshotMode":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../kernel ../SpatialReference ../srUtils ../tasks/query ./RenderMode ./support/ParallelSnapshot".split(" "),
function(m,n,d,v,t,e,k,r,c){m=m([r],{declaredClass:"esri.layers._SnapshotMode",maxFeatures:5E4,constructor:function(c){this.featureLayer=c;this._featureMap={};this._hasPartialFeatures=!1;this._drawFeatures=n.hitch(this,this._drawFeatures);this._queryErrorHandler=n.hitch(this,this._queryErrorHandler);this._handleSuccess=n.hitch(this,this._handleSuccess);this._handleError=n.hitch(this,this._handleError);this._handleProgress=n.hitch(this,this._handleProgress)},startup:function(){if(!this._started){this.inherited(arguments);
var d=this.featureLayer,e=d.advancedQueryCapabilities,k=d.reHostedFS.test(d.url);this.pagination=d.queryPagination&&null!=d.maxRecordCount;this._tileQueriesAllowed=k&&e&&e.supportsQueryWithResultType&&d.isFeatureReductionApplied();k&&this.pagination&&(this._parallelSnapshot=new c({layer:d,mode:this,queryTask:d._task}));d._collection?this._applyTimeFilter():this._fetchAll()}},propertyChangeHandler:function(c){this._init&&(c?this.featureLayer._collection?console.log("FeatureLayer: layer created by value (from a feature collection) does not support definition expressions and time definitions. Layer id \x3d "+
this.featureLayer.id):this._fetchAll():this._applyTimeFilter())},destroy:function(){this._cancelPendingRequest(this._pendingRequest);this._parallelSnapshot&&this._parallelSnapshot.destroy();this.inherited(arguments)},drawFeature:function(c){var d=c.attributes[this.featureLayer.objectIdField];this._addFeatureIIf(d,c);this._incRefCount(d)},resume:function(){this.propertyChangeHandler(0)},refresh:function(){var c=this.featureLayer;c._collection?(c._fireUpdateStart(),c._refresh(!0),c._fireUpdateEnd()):
this._fetchAll()},hasAllFeatures:function(){return!this._hasPartialFeatures},_fetchAll:function(){var c=this.featureLayer;c._collection||c.suspended||!c.isQueryable()||(c._fireUpdateStart(),this._clearIIf(),this._hasPartialFeatures=!1,this._parallelSnapshot?this._parallelSnapshot.fetch(this._createQuery()).then(this._handleSuccess,this._handleError,this._handleProgress):this._sendRequest())},_handleSuccess:function(c){this._hasPartialFeatures=c.hasPartialFeatures;this.featureLayer._fireUpdateEnd(null)},
_handleError:function(c){this._queryErrorHandler(c)},_handleProgress:function(c){c.isError?this.featureLayer._errorHandler(c.error):this._addFeatures(c.features)},_sendRequest:function(c){var d=this.featureLayer,e=this._createQuery();this.pagination&&(this._start=e.start=null==c?0:c,e.num=d.maxRecordCount);this._pendingRequest&&this._cancelPendingRequest(this._pendingRequest);this._pendingRequest=d._task.execute(e,this._drawFeatures,this._queryErrorHandler)},_drawFeatures:function(c){this._pendingRequest=
null;var d=this.featureLayer,e=c.exceededTransferLimit,h=e&&!d._collection;c=this._checkMaxLimit(c.features);var b=c.maxLimitReached;this._addFeatures(c.features);this.pagination&&h&&!b||(this._hasPartialFeatures=!!e,d._fireUpdateEnd(null,e?{queryLimitExceeded:!0}:null));h&&(this.pagination&&!b&&this._sendRequest(this._start+d.maxRecordCount),d.onQueryLimitExceeded())},_queryErrorHandler:function(c){this._pendingRequest=null;this._hasPartialFeatures=!0;var d=this.featureLayer;d._errorHandler(c);d._fireUpdateEnd(c)},
_checkMaxLimit:function(c){var d=c?c.length:0,e=this.featureLayer.graphics.length+d,h=e>=this.maxFeatures;if(h){var b=e-this.maxFeatures;b&&c.splice(d-b,b)}return{maxLimitReached:h,featuresDiscarded:e>this.maxFeatures,features:c}},_createQuery:function(){var c=this.featureLayer,d=new k;d.outFields=c.getOutFields();d.where=c.getDefinitionExpression()||"1\x3d1";d.returnGeometry=!0;d.outSpatialReference=e.createSpatialReference(this.map.spatialReference.toJson());d.timeExtent=c.getTimeDefinition();d.maxAllowableOffset=
c._maxOffset;d.quantizationParameters=c._quantizationParameters;d.orderByFields=c.supportsAdvancedQueries?c.getOrderByFields():null;d.multipatchOption=c.multipatchOption;c._ts&&(d._ts=(new Date).getTime());this._tileQueriesAllowed&&(d.resultType="tile");return d},_addFeatures:function(c){var d=this.featureLayer,e=d.objectIdField,h=c.length,b=d._selectedFeatures,g=d.mode===d.constructor.MODE_AUTO,a,f,l;d._fireUpdateStart();d._sortFeatures(c);for(d=0;d<h;d++)f=c[d],l=f.attributes[e],a=this._addFeatureIIf(l,
f),this._incRefCount(l),g&&a!==f&&b[l]&&(a.setGeometry(f.geometry),a.setAttributes(f.attributes));this._applyTimeFilter(!0)}});d("extend-esri")&&n.setObject("layers._SnapshotMode",m,v);return m})},"esri/layers/RenderMode":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/_base/array","dojo/has","../kernel"],function(m,n,d,v,t){m=m(null,{declaredClass:"esri.layers._RenderMode",initialize:function(d){this.map=d;this._init=!0},startup:function(){this._started=!0},propertyChangeHandler:function(d){},
destroy:function(){this._init=this._started=!1},drawFeature:function(d){},suspend:function(){},resume:function(){},refresh:function(){},hasAllFeatures:function(){return!0},_incRefCount:function(d){(d=this._featureMap[d])&&d._count++},_decRefCount:function(d){(d=this._featureMap[d])&&d._count--},_getFeature:function(d){return this._featureMap[d]},_addFeatureIIf:function(d,k){var e=this._featureMap,c=e[d],h=this.featureLayer;c||(e[d]=k,h._add(k),k._count=0);return c||k},_removeFeatureIIf:function(d){var e=
this._featureMap[d],r=this.featureLayer;if(e){if(e._count)return;delete this._featureMap[d];r._remove(e)}return e},_clearIIf:function(){var d;d=this.featureLayer;var k=d.graphics,r=d._selectedFeatures,c=d.getSelectedFeatures().length,h=d.objectIdField;if(c)for(d=k.length-1;0<=d;d--){var c=k[d],q=c.attributes[h];q in r?c._count=1:(c._count=0,this._removeFeatureIIf(q))}else d.clear(),this._featureMap={}},_cancelPendingRequest:function(d){if(d)try{d.cancel()}catch(k){}},_toggleVisibility:function(d){var e=
this.featureLayer,r=e.graphics,c=d?"show":"hide",h,q=r.length;d=d&&e._ager;for(h=0;h<q;h++){var u=r[h];u[c]();d&&e._repaint(u)}},_applyTimeFilter:function(e){var k=this.featureLayer;if(k.timeInfo&&!k.suspended){e||k._fireUpdateStart();var r=k._trackManager;r&&r.clearTracks();var c=k.getTimeDefinition(),h=k._getOffsettedTE(k._mapTimeExtent);h?(h=k._getTimeOverlap(c,h))?(c=k._filterByTime(k.graphics,h.startTime,h.endTime),r&&r.addFeatures(c.match),d.forEach(c.match,function(c){var d=c._shape;c.visible||
(c.show(),(d=c._shape)&&d._moveToFront());k._ager&&d&&k._repaint(c)}),d.forEach(c.noMatch,function(c){c.visible&&c.hide()})):this._toggleVisibility(!1):(r&&r.addFeatures(k.graphics),this._toggleVisibility(!0));r&&(r.moveLatestToFront(),r.drawTracks());e||k._fireUpdateEnd()}}});v("extend-esri")&&n.setObject("layers._RenderMode",m,t);return m})},"esri/layers/support/ParallelSnapshot":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has dojo/Deferred ../../kernel".split(" "),
function(m,n,d,v,t,e){m=m(null,{declaredClass:"esri.layers.support.ParallelSnapshot",layer:null,mode:null,queryTask:null,batchSize:5,_query:null,_fetchDfd:null,_startPage:null,_lastPage:null,_maxPage:null,_requests:null,constructor:function(d){n.mixin(this,d);this._requests={};this._maxPage=Math.ceil(this.mode.maxFeatures/this.layer.maxRecordCount)},destroy:function(){this.cancel()},fetch:function(d){var e=new t;this.cancel(!0);this._query=d;this._fetchDfd=e;this._sendRequests();return e.promise},
cancel:function(d){this._cancelPendingRequests(d);this._reset()},_reset:function(){this._startPage=this._lastPage=null;this._requests={}},_sendRequests:function(d){var e=this._query,c=this.queryTask,h=this._requests,k=this.layer.maxRecordCount,u;d=null==d?1:d;u=d+this.batchSize-1;u>this._maxPage&&(u=this._maxPage);if(!(d>u))for(this._startPage=d,this._lastPage=u;d<=u;d++)e.start=(d-1)*k,e.num=k,h[d]=c.execute(e),h[d].then(n.hitch(this,this._handleSuccess,d)).otherwise(n.hitch(this,this._handleError,
d))},_evalNextBatch:function(d){d===this._lastPage&&this._sendRequests(this._lastPage+1)},_handleSuccess:function(d,e){e.exceededTransferLimit||this._cancelLaterRequests(d,!0);var c=this.mode._checkMaxLimit(e.features);this._fetchDfd.progress({features:c.features,isError:!1});c.maxLimitReached?((c=c.featuresDiscarded||this._hasRejectedRequests())||(c=!!this._getResult(this._getLastSuccessfulRequest()).exceededTransferLimit),this._resolveFetch(c)):(e.exceededTransferLimit&&this._evalNextBatch(d),this._evalResolution())},
_handleError:function(d,e){var c=this._requests;c&&c[d]&&(1===d?this._rejectFetch(e):(this._evalNextBatch(d),this._fetchDfd.progress({error:e,isError:!0}),this._evalResolution()))},_evalResolution:function(){this._hasPendingRequests()||this._resolveFetch(this._hasRejectedRequests())},_resolveFetch:function(d){this.cancel(!0);this._fetchDfd.resolve({hasPartialFeatures:d})},_rejectFetch:function(d){this.cancel(!0);this._fetchDfd.reject(d)},_getResult:function(d){return d&&d.dfd.results[0]},_hasPendingRequests:function(){return!!this._getPendingRequests().length},
_getPendingRequests:function(){var d=this._requests,e,c=[];for(e in d){var h=d[e];h.isFulfilled()||c.push({pageId:Number(e),dfd:h})}return c},_getLastSuccessfulRequest:function(){var e=this._getResolvedRequests(),r=-Infinity,c,e=d.filter(e,function(c){return!!this._getResult(c).features.length||1===c.pageId},this);d.forEach(e,function(d){d.pageId>r&&(r=d.pageId,c=d)});return c},_getResolvedRequests:function(){var d=this._requests,e,c=[];for(e in d){var h=d[e];h.isResolved()&&c.push({pageId:Number(e),
dfd:h})}return c},_hasRejectedRequests:function(){var e=this._getRejectedRequests(),r=this._getLastSuccessfulRequest(),c=this._getResult(r);c&&!c.exceededTransferLimit&&(e=d.filter(e,function(c){return c.pageId<=r.pageId}));return!!e.length},_getRejectedRequests:function(){var d=this._requests,e,c=[];for(e in d){var h=d[e];h.isRejected()&&c.push({pageId:Number(e),dfd:h})}return c},_cancelPendingRequests:function(d){this._cancelRequests(this._getPendingRequests(),d)},_cancelLaterRequests:function(e,
r){var c=d.filter(this._getPendingRequests(),function(c){return c.pageId>e});this._cancelRequests(c,r)},_cancelRequests:function(e,r){var c=this.mode,h=this._requests;d.forEach(e,function(d){r&&delete h[d.pageId];c._cancelPendingRequest(d.dfd)})}});v("extend-esri")&&n.setObject("layers.support.ParallelSnapshot",m,e);return m})},"esri/layers/OnDemandMode":function(){define("dojo/_base/declare dojo/_base/connect dojo/_base/lang dojo/_base/array dojo/has ../kernel ../geometry/Point ../tasks/query ./RenderMode ./GridLayout".split(" "),
function(m,n,d,v,t,e,k,r,c,h){m=m([c],{declaredClass:"esri.layers._OnDemandMode",constructor:function(c){this.featureLayer=c;this._featureMap={};this._hasPartialFeatures=!1;this._queryErrorHandler=d.hitch(this,this._queryErrorHandler)},initialize:function(c){this.inherited(arguments);var d=this.featureLayer,e=d._srInfo;this._gridLayer=new h(new k(e?e.valid[0]:c.extent.xmin,e?e.valid[1]:c.extent.ymax,c.spatialReference),{width:d._tileWidth,height:d._tileHeight},{width:c.width,height:c.height},e);this._cellMap=
{};this._gridLayer.setResolution(c.extent)},startup:function(){this._started||(this.inherited(arguments),this._ioQueue=[],this.featureLayer.suspended||(this._zoomHandler(),this._enableConnectors()))},propertyChangeHandler:function(c){this._init&&(2>c?this._zoomHandler():console.log("FeatureLayer: layer in on-demand mode does not support time definitions. Layer id \x3d "+this.featureLayer.id+", Layer URL \x3d "+this.featureLayer.url))},destroy:function(){this._disableConnectors();this._processIOQueue(!0);
this.inherited(arguments)},drawFeature:function(c){var d=c.geometry,e=[];if(d){var e=this._gridLayer.getCellsInExtent("point"===d.type?{xmin:d.x,ymin:d.y,xmax:d.x,ymax:d.y}:d.getExtent(),!1).cells,d=this._cellMap,b,g,a=c.attributes[this.featureLayer.objectIdField],f,l,h;for(b=0;b<e.length;b++)g=e[b],f=g.latticeID,l=g.row,h=g.col,f?g=d[f]=d[f]||g:(d[l]=d[l]||{},g=d[l][h]=d[l][h]||g),g.features=g.features||[],g.features.push(c),this._addFeatureIIf(a,c),this._incRefCount(a)}},suspend:function(){this._init&&
this._disableConnectors()},resume:function(){this._init&&(this._enableConnectors(),this._zoomHandler())},refresh:function(){this._zoomHandler()},hasAllFeatures:function(){if(this._hasPartialFeatures)return!1;var c=!1,d=this._getCurrentCells(),e;for(e=0;e<d.length;e++)if(d[e].hasPartialFeatures){c=!0;break}return!c},_enableConnectors:function(){var c=this.map;this._zoomConnect=n.connect(c,"onZoomEnd",this,this._zoomHandler);this._panConnect=n.connect(c,"onPanEnd",this,this._panHandler);this._resizeConnect=
n.connect(c,"onResize",this,this._panHandler)},_disableConnectors:function(){n.disconnect(this._zoomConnect);n.disconnect(this._panConnect);n.disconnect(this._resizeConnect)},_zoomHandler:function(){this._processIOQueue(!0);var c=this.featureLayer,d=this.map;!c.suspended&&c.isQueryable()&&(c._fireUpdateStart(),this._clearIIf(),this._hasPartialFeatures=!1,(c=c._trackManager)&&c.clearTracks(),this._cellMap={},this._gridLayer.setResolution(d.extent),this._sendRequest())},_panHandler:function(c){if(this.featureLayer.isQueryable()){this.featureLayer._fireUpdateStart();
var d=this.featureLayer._resized;c=d?c:null;d&&this._gridLayer.setMapState(c,this.map.width,this.map.height);this._sendRequest(c)}},_sendRequest:function(c){this._exceeds=!1;var d=this.featureLayer,e=this.map;c=c||e.extent;e=this._gridLayer.getCellsInExtent(c,d.latticeTiling).cells;if(!d.isEditable())var b=this._cellMap,e=v.filter(e,function(a){if(a.lattice){if(b[a.latticeID])return!1}else if(b[a.row]&&b[a.row][a.col])return!1;return!0});var g=d.getOutFields(),a=d.getDefinitionExpression(),f=d._getOffsettedTE(d._mapTimeExtent),
l=d.supportsAdvancedQueries?d.getOrderByFields():null,h=this._ioQueue,k,q=this,m=this._drawFeatures,n,w;this._pending=this._pending||0;for(k=0;k<e.length;k++){n=e[k];w=new r;w.geometry=n.extent||n.lattice;w.outFields=g;w.where=a;d.latticeTiling&&n.extent&&(w.spatialRelationship=r.SPATIAL_REL_CONTAINS);w.returnGeometry=!0;w.timeExtent=f;d._ts&&(w._ts=(new Date).getTime());w.orderByFields=l;w.multipatchOption=d.multipatchOption;w.maxAllowableOffset=d._maxOffset;w.quantizationParameters=d._quantizationParameters;
var t=d.advancedQueryCapabilities;t&&t.supportsQueryWithResultType&&(w.resultType="tile");this._pending++;h.push(d._task.execute(w,function(){var a=n;return function(b){m.apply(q,[b,a])}}.call(this),this._queryErrorHandler))}this._removeOldCells(c);this._endCheck()},_drawFeatures:function(c,d){d.hasPartialFeatures=!!c.exceededTransferLimit;this._exceeds=this._exceeds||c.exceededTransferLimit;this._finalizeIO();var e=this.featureLayer,b=this.map.extent,g=d.extent,a=d.row,f=d.col,l=e.objectIdField,
h=c.features,k=this._gridLayer,u=this._cellMap,q=d.latticeID,r=q?u[q]:u[a]&&u[a][f];if(d.resolution==k._resolution&&(q?q===k.getLatticeID(b):k.intersects(g,b)))if(r)e._sortFeatures(h),this._updateCell(r,h);else for(e._sortFeatures(h),d.features=h,q?u[q]=d:(u[a]=u[a]||{},u[a][f]=d),b=h.length,e=0;e<b;e++)g=h[e],a=g.attributes[l],this._addFeatureIIf(a,g),this._incRefCount(a);else r&&this._removeCell(a,f,q);this._endCheck()},_queryErrorHandler:function(c){this._finalizeIO();this._hasPartialFeatures=
!0;this.featureLayer._errorHandler(c);this._endCheck(!0)},_finalizeIO:function(){this._pending--},_endCheck:function(c){if(0===this._pending){this._processIOQueue();var d=this.featureLayer,e=d._trackManager;e&&(e.clearTracks(),e.addFeatures(d.graphics),d._ager&&v.forEach(d.graphics,function(b){b._shape&&d._repaint(b)}),e.moveLatestToFront(),e.drawTracks());this.featureLayer._fireUpdateEnd(c&&Error("FeatureLayer: an error occurred while updating the layer"),this._exceeds?{queryLimitExceeded:!0}:null);
if(this._exceeds)d.onQueryLimitExceeded()}},_processIOQueue:function(c){this._ioQueue=v.filter(this._ioQueue,function(c){return-1<c.fired?!1:!0});c&&v.forEach(this._ioQueue,this._cancelPendingRequest)},_getCurrentCells:function(c){var d=[];c=c||this._cellMap;for(var e in c)if(c.hasOwnProperty(e)){var b=c[e];b&&(b.hasOwnProperty("row")||b.hasOwnProperty("latticeID")?d.push(b):"object"===typeof b&&d.push.apply(d,this._getCurrentCells(b)))}return d},_removeOldCells:function(c){var d=this._cellMap,e=
this._gridLayer,b,g;for(b in d)if(d[b]){var a=d[b],f=a.latticeID,l=0,h=0;if(f)l++,f!==e.getLatticeID(c)&&(this._removeCell(null,null,f),h++);else for(g in a)a[g]&&(l++,e.intersects(a[g].extent,c)||(this._removeCell(b,g),h++));h===l&&delete d[b]}},_updateCell:function(c,d){var e=this.featureLayer,b=e.objectIdField,e=e._selectedFeatures,g,a=d.length;c.features=c.features||[];for(g=0;g<a;g++){var f=d[g],l=f.attributes[b],h=this._addFeatureIIf(l,f);h===f?(this._incRefCount(l),c.features.push(h)):l in
e||(h.setGeometry(f.geometry),h.setAttributes(f.attributes))}},_removeCell:function(c,d,e){var b=this._cellMap,g=this.featureLayer,a=g.objectIdField,f=e?b[e]:b[c]&&b[c][d];if(f)for(e?delete b[e]:delete b[c][d],c=f.features,d=0;d<c.length;d++)e=c[d].attributes[a],this._decRefCount(e),e in g._selectedFeatures||this._removeFeatureIIf(e)}});t("extend-esri")&&d.setObject("layers._OnDemandMode",m,e);return m})},"esri/layers/GridLayout":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has ../kernel ../SpatialReference ../geometry/Extent ../geometry/Polyline ../srUtils".split(" "),
function(m,n,d,v,t,e,k,r,c){m=m(null,{declaredClass:"esri.layers._GridLayout",constructor:function(c,d,e,k){this.origin=c;this.cellWidth=d.width;this.cellHeight=d.height;this.mapWidth=e.width;this.mapHeight=e.height;this.srInfo=k},setResolution:function(c){this._resolution=(c.xmax-c.xmin)/this.mapWidth;this.srInfo&&(c=Math.round(Math.round(2*this.srInfo.valid[1]/this._resolution)/this.cellWidth),this._frameStats=[c,0,c-1])},setMapState:function(c,d,e){this.mapWidth=d;this.mapHeight=e;this.setResolution(c)},
getCellCoordinates:function(c){var d=this._resolution,e=this.origin;return{row:Math.floor((e.y-c.y)/(this.cellHeight*d)),col:Math.floor((c.x-e.x)/(this.cellWidth*d))}},normalize:function(c){var d=this._frameStats;if(d){var e=d[0],h=d[1],d=d[2];c<h?(c%=e,c=c<h?c+e:c):c>d&&(c%=e)}return c},intersects:function(c,e){var h=this.srInfo;return h?d.some(e._getParts(h),function(d){return c.intersects(d.extent)}):c.intersects(e)},getCellExtent:function(d,e){var h=this._resolution,r=this.origin,b=this.cellWidth,
g=this.cellHeight;return new k(e*b*h+r.x,r.y-(d+1)*g*h,(e+1)*b*h+r.x,r.y-d*g*h,c.createSpatialReference(r.spatialReference.toJson()))},getLatticeID:function(c){var d=this.getCellCoordinates({x:c.xmin,y:c.ymax}),e=this.getCellCoordinates({x:c.xmax,y:c.ymin});c=d.row;var h=e.row,d=this.normalize(d.col),e=this.normalize(e.col);return c+"_"+h+"_"+d+"_"+e},sorter:function(c,d){return c<d?-1:1},getCellsInExtent:function(c,e){var h=this.getCellCoordinates({x:c.xmin,y:c.ymax}),k=this.getCellCoordinates({x:c.xmax,
y:c.ymin}),b=h.row,g=k.row,h=h.col,k=k.col,a=[],f,l,q,m=[],n=[],t,v,w,D,C=[];for(f=b;f<=g;f++)for(l=h;l<=k;l++)q=this.normalize(l),c=this.getCellExtent(f,q),d.some(a,function(a){return a.row===f&&a.col===q})||a.push({row:f,col:q,extent:c,resolution:this._resolution}),e&&(m.push(c.xmin,c.xmax),n.push(c.ymin,c.ymax));h=this.normalize(h);k=this.normalize(k);m.sort(this.sorter);n.sort(this.sorter);l=m.length;for(f=l-1;0<=f;f--)f<l-1&&m[f]===m[f+1]&&m.splice(f,1);l=n.length;for(f=l-1;0<=f;f--)f<l-1&&n[f]===
n[f+1]&&n.splice(f,1);if(m.length&&n.length){t=m[0];v=m[m.length-1];w=n[0];D=n[n.length-1];l=m.length;for(f=0;f<l;f++)C.push([[m[f],D],[m[f],w]]);l=n.length;for(f=0;f<l;f++)C.push([[t,n[f]],[v,n[f]]]);m=new r({paths:C,spatialReference:this.origin.spatialReference.toJson()});a.push({latticeID:b+"_"+g+"_"+h+"_"+k,lattice:m,resolution:this._resolution})}return{minRow:b,maxRow:g,minCol:h,maxCol:k,cells:a}}});v("extend-esri")&&n.setObject("layers._GridLayout",m,t);return m})},"esri/layers/SelectionMode":function(){define(["dojo/_base/declare",
"dojo/_base/lang","dojo/has","../kernel","./RenderMode"],function(m,n,d,v,t){m=m([t],{declaredClass:"esri.layers._SelectionMode",constructor:function(d){this.featureLayer=d;this._featureMap={}},propertyChangeHandler:function(d){this._init&&0===d&&this._applyTimeFilter()},resume:function(){this.propertyChangeHandler(0)},hasAllFeatures:function(){return!this.featureLayer._hasPartialSelectedFeatures}});d("extend-esri")&&n.setObject("layers._SelectionMode",m,v);return m})},"esri/layers/StreamMode":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/Deferred dojo/has ../kernel ../SpatialReference ../tasks/query ../tasks/QueryTask ../geometry/jsonUtils ./RenderMode".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q){m=m([q],{declaredClass:"esri.layers._StreamMode",constructor:function(c,d){this.featureLayer=c;this._featureMap={};this._setRefreshRate();this._drawBuffer={adds:[],updates:[]};this._timeoutId=null;this._flushDrawBuffer=n.hitch(this,this._flushDrawBuffer);this._featuresByTime={};this._lastEndTimeCheck=null;this._maxFeatureAge=0;c.purgeOptions&&c.purgeOptions.age&&"number"===typeof c.purgeOptions.age&&(this._maxFeatureAge=1E3*Math.ceil(60*c.purgeOptions.age));this._drawFeatures=
n.hitch(this,this._drawFeatures);this._queryErrorHandler=n.hitch(this,this._queryErrorHandler)},startup:function(){this._started||this.inherited(arguments)},propertyChangeHandler:function(c){this._init&&(0===c?this._applyTimeFilter():3===c?this._redrawAllTracks():console.debug("StreamLayer: Stream Layer only supports changing map time or maximumTrackPoints. Layer id \x3d "+this.featureLayer.id))},destroy:function(){this.inherited(arguments);clearTimeout(this._timeoutId);this._featuresByTime=this._drawBuffer=
this._featureMap=null},drawFeature:function(c){var d=this.featureLayer,b=d.objectIdField;this._timeoutId||(this._timeoutId=setTimeout(this._flushDrawBuffer,this._refreshRate));d._joinField&&this._getFeature(c.attributes[b])?this._drawBuffer.updates.push({oid:c.attributes[b],updates:c}):this._drawBuffer.adds.push(c)},resume:function(){this.propertyChangeHandler(0)},refresh:function(){this._pendingRequest&&this._cancelPendingRequest(this._pendingRequest);var c=this.featureLayer;c&&(c._relatedUrl||c._keepLatestUrl?
(c._fireUpdateStart(),c._refreshing=!0,c.disconnect(),c.clear(),c._relatedQueried=!1,c._keepLatestQueried=!1,c.connect()):(c._fireUpdateStart(),c.clear(),c._fireUpdateEnd()))},_drawFeatures:function(c,d){var b=this.featureLayer;b._create(c.features||[]);b._fireUpdateEnd(null,d)},_applyTimeFilter:function(c){this.inherited(arguments);this._redrawAllTracks()},_removeFeatures:function(c){var e=this.featureLayer,b=e.objectIdField;c&&d.forEach(c,function(c){c=c.attributes[b];e._unSelectFeatureIIf(c,this);
this._decRefCount(c);this._removeFeatureIIf(c)},this)},_addFeatures:function(c){var e=this.featureLayer,b=e._endTimeField,g=e._startTimeField,a,f,l,h=[],k=[],u=[];a=e._trackManager;f=e.objectIdField;if(a)for(l in c=a.addFeatures(c),c)c.hasOwnProperty(l)&&(h.push(l),c[l].adds&&(k=k.concat(c[l].adds)),c[l].deletes&&(u=u.concat(c[l].deletes)));else k=c;d.forEach(k,function(a){var c=a.attributes[f],d;d=b&&a.attributes[b];!d&&this._maxFeatureAge&&(d=g&&a.attributes[g]?a.attributes[g]+this._maxFeatureAge:
Date.now()+this._maxFeatureAge);d&&(d=1E3*Math.ceil(d/1E3),this._featuresByTime[d]?this._featuresByTime[d].push(c):this._featuresByTime[d]=[c]);this._addFeatureIIf(c,a);this._incRefCount(c)},this);u.length&&this._removeFeatures(u);a&&a.refreshTracks(h)},_updateFeatures:function(c){var e=this.featureLayer,b,g,a=[];b=e._trackManager;g=e._trackIdField;d.forEach(c,function(c){var d=c.updates;c=this._getFeature(c.oid);var f;if(c){d.geometry&&c.setGeometry(d.geometry);d=d.attributes||{};for(f in d)d.hasOwnProperty(f)&&
(c.attributes[f]=d[f]);c.setAttributes(c.attributes);c.visible=this._checkFeatureTimeIntersects(c);b&&c.attributes[g]?a.push(c.attributes[g]):e._repaint(c,null,!0)}},this);a.length&&b.refreshTracks(a)},_redrawAllTracks:function(){var c=this.featureLayer._trackManager,d;c&&(d=c.trimTracks())&&0<d.length&&(this._removeFeatures(d),c.refreshTracks())},_flushDrawBuffer:function(){clearTimeout(this._timeoutId);var c=this._drawBuffer,d=c.adds.splice(0,c.adds.length),b=c.updates.splice(0,c.updates.length),
c=this.featureLayer;if(!c)return!1;c.updating||c._fireUpdateStart();this._addFeatures(d);this._updateFeatures(b);(d=this._getExpiredFeatures())&&d.length&&(this._removeFeatures(d),c._trackManager&&c._trackManager.removeFeatures(d));c._purge();c._fireUpdateEnd();this._timeoutId=null},_clearDrawBuffer:function(){var c=this._timeoutId,d=this._drawBuffer,b=d.adds,d=d.updates;c&&clearTimeout(c);b.splice(0,b.length);d.splice(0,d.length);this._timeoutId=null},_clearTimeBin:function(){this._featuresByTime=
{};this._lastEndTimeCheck=1E3*Math.ceil(Date.now()/1E3)},_clearFeatureMap:function(){this._featureMap={}},_setRefreshRate:function(c){c=c||0===c?c:200;0>c&&(c=200);this._refreshRate=c},_checkFeatureTimeIntersects:function(c){var d=this.featureLayer,b=d.getMap();return(b=b?b.timeExtent:null)&&d.timeInfo&&(d.timeInfo.startTimeField||d.timeInfo.endTimeField)?0<d._filterByTime([c],b.startTime,b.endTime).match.length:!0},_fetchArchive:function(d){var e=new v,b=this.featureLayer,g,a,f,l,u;this._pendingRequest&&
this._cancelPendingRequest(this._pendingRequest);b._fireUpdateStart();d&&this.map?(d=new c(d),g=new r,a=this.map,f=b.getFilter()||{},l=f.where||"1\x3d1",u=f.geometry?h.fromJson(f.geometry):null,f=f.outFields?f.outFields.split(","):["*"],g.geometry=u,g.where=l,g.outFields=f,g.returnGeometry=!0,g.outSpatialReference=new k(a.spatialReference.toJson()),this._pendingRequest=d.execute(g).then(function(a){this._pendingRequest=null;var c=this._fixFieldNameCasing(b,a);a.features=c;this._drawFeatures(a);b._fireUpdateEnd();
e.resolve()}.bind(this)).otherwise(function(a){this._pendingRequest=null;b._errorHandler(a);b._fireUpdateEnd(a);e.reject(a)}.bind(this))):e.resolve();return e.promise},_queryErrorHandler:function(c){var d=this.featureLayer;d._errorHandler(c);d._fireUpdateEnd(c)},_fixFieldNameCasing:function(c,d){var b=d.features||[],g=d.fields;if(!g||!b.length)return b;for(var g=this._mapFieldNameDifferences(c.fields,g),a=[],f,e,h=0,k=d.features.length;h<k;h++)f=b[h],e=this._swizzleResponseAttributes(f.attributes,
g),a.push({geometry:f.geometry,attributes:e});return a},_mapFieldNameDifferences:function(c,d){var b=[],g={},a,f;a=0;for(f=d.length;a<f;a++)b.push(d[a].name);a=0;for(f=c.length;a<f;a++){var e=c[a].name,h=this._checkForStreamFieldName(e,b);h&&(g[h]=e)}return g},_checkForStreamFieldName:function(c,d){for(var b=c.toLowerCase(),g,a=0,f=d.length;a<f;a++)if(d[a].toLowerCase()===b){g=d[a];break}return g},_swizzleResponseAttributes:function(c,d){var b={},g;for(g in c)if(c.hasOwnProperty(g)){var a=c[g];d.hasOwnProperty(g)?
b[d[g]]=a:b[g]=a}return b},_getExpiredFeatures:function(){var c,e,b,g=[],a=[];if(!this.featureLayer._endTimeField&&!this._maxFeatureAge)return a;c=1E3*Math.floor(this._lastEndTimeCheck/1E3);this._lastEndTimeCheck=e=1E3*Math.ceil(Date.now()/1E3);if(c&&c!==e)for(b=this._featuresByTime;c<=e;c+=1E3)b[c]&&(g=g.concat(b[c]),delete b[c]);d.forEach(g,function(b){(b=this._getFeature(b))&&a.push(b)},this);return a}});t("extend-esri")&&n.setObject("layers._StreamMode",m,e);return m})},"esri/layers/TrackManager":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has dojo/dom-construct dojox/gfx ../kernel ../graphic ../geometry/Polyline ./GraphicsLayer".split(" "),
function(m,n,d,v,t,e,k,r,c,h){var q=-1!==e.renderer.toLowerCase().indexOf("canvas");m=m(null,{declaredClass:"esri.layers._TrackManager",constructor:function(c){this.layer=c;this.trackMap={};this.trackLineMap={}},initialize:function(c){this.map=c;var d=this.layer,b=d._getRenderer(),b=b&&b.trackRenderer;if("esriGeometryPoint"===d.geometryType){var g=this.container=new h._GraphicsLayer({id:d.id+"_tracks",_child:!0,visible:d.visible,minScale:d.minScale,maxScale:d.maxScale});g.loaded=!0;g.onLoad(g);g._setMap(c,
d._div);if(!q){c=g._div.getNode();var a=d._div.getNode();c&&a&&t.place(c,a,"first")}g.setRenderer(b);d.on("visibility-change",n.hitch(this,function(a){this.container.setVisibility(a.visible);this.container.evaluateSuspension()}));d.on("scale-range-change",n.hitch(this,function(){this.container.setScaleRange(this.layer.minScale,this.layer.maxScale)}))}},addFeatures:function(c){var e=this.trackMap,b=this.layer,g=b._trackIdField,a=[];d.forEach(c,function(b){var c=b.attributes[g];(e[c]=e[c]||[]).push(b);
-1===d.indexOf(a,c)&&a.push(c)});var f=b._startTimeField,l=b.objectIdField,h=function(a,b){var c=a.attributes[f],d=b.attributes[f];return c===d?a.attributes[l]<b.attributes[l]?-1:1:c<d?-1:1};d.forEach(a,function(a){e[a].sort(h)})},trimTracks:function(c){function e(c){for(c=b[c]||[];c.length>g;)a.push(c.shift())}var b=this.trackMap,g=this.layer.maximumTrackPoints||0,a=[],f;if(!g)return a;if(c)d.forEach(c,function(a){e(a)});else for(f in b)b.hasOwnProperty(f)&&e(f);return a},drawTracks:function(e){function h(d){var e=
a[d],h,k,w;k=b.trackLineMap[d];g.remove(k);delete b.trackLineMap[d];k=null;if(!e||2>e.length)return!1;k=[];for(h=e.length-1;0<=h;h--)(w=e[h].geometry)&&k.push([w.x,w.y]);e={};e[l]=d;1<k.length&&(k=new r(new c({paths:[k],spatialReference:f}),null,e),g.add(k),b.trackLineMap[d]=k)}var b=this,g=this.container,a,f,l,k;if(g)if(a=this.trackMap,f=this.map.spatialReference,l=this.layer._trackIdField,e)d.forEach(e,function(a){h(a)});else for(k in a)a.hasOwnProperty(k)&&h(k)},refreshTracks:function(c){function e(c){var d,
e;b.drawTracks([c]);if(f&&f.latestObservationRenderer)for(c=g[c]||[],d=c.length,e=0;e<d;e++)a._repaint(c[e],null,!0)}var b=this,g=this.trackMap,a=this.layer,f=a._getRenderer(),l;if(c)d.forEach(c,function(a){e(a)});else for(l in g)g.hasOwnProperty(l)&&e(l);this.moveLatestToFront()},moveLatestToFront:function(c){d.forEach(this.getLatestObservations(c),function(c){var b=c._shape;b&&b._moveToFront();this._repaint(c,null,!0)},this.layer)},getLatestObservations:function(c){function e(b){b=a[b];return b[b.length-
1]}var b=[],g=this.layer._getRenderer(),a=this.trackMap,f;if(!g.latestObservationRenderer)return b;if(c)d.forEach(c,function(a){b.push(e(a))});else for(f in a)a.hasOwnProperty(f)&&b.push(e(f));return b},clearTracks:function(c){var e=this.getLatestObservations(c),b=this.container,g;c?d.forEach(c,function(a){delete this.trackMap[a];b&&(g=this.trackLineMap[a],b.remove(g),delete this.trackLineMap[a])},this):(this.trackMap={},this.trackLineMap={},b&&b.clear());d.forEach(e,function(a){this._repaint(a,null,
!0)},this.layer)},isLatestObservation:function(c){var d=this.trackMap[c.attributes[this.layer._trackIdField]];return d?d[d.length-1]===c:!1},destroy:function(){var c=this.container;c&&(c.clear(),c._unsetMap(this.map,this.layer._div));this.map=this.layer=this.trackMap=this.container=null}});v("extend-esri")&&n.setObject("layers._TrackManager",m,k);return m})},"esri/layers/HeatmapManager":function(){define("dojo/_base/declare dojo/_base/lang dojo/aspect dojo/_base/array require ../kernel ../sniff ../geometry/Point ../geometry/webMercatorUtils ./MapImage ../renderers/HeatmapRenderer ../tasks/query dojo/_base/fx".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x){function b(){}function g(a){var b=a.layer;return{geometry:a.geometry,attributes:a.attributes,getLayer:function(){return b}}}m=m(null,{declaredClass:"esri.layers.HeatmapManager",heatmapRenderer:null,sourceLayer:null,imageLayer:null,useTiles:!0,useWorker:!1,map:null,constructor:function(a){this.sourceLayer=a;this._hndls=[]},initialize:function(a){this.map=a;var b=this.sourceLayer,c=b.renderer;b.setDrawMode(!1);this.imageLayer=a._getMapImageLyr();var d=this;this.heatmapRenderer=
c instanceof q?c:(c.getRendererInfoByZoom(a.getZoom())||c.getRendererInfoByScale(a.getScale())).renderer;this._setupDraw=this._setupDraw.bind(this);this.recalculateHeatmap=this.recalculateHeatmap.bind(this);this._removeRenderer=this._removeRenderer.bind(this);this._handleRendererChange=this._handleRendererChange.bind(this);this._rendererChangeHandle=this.sourceLayer.on("renderer-change",this._handleRendererChange);this._handleOpacityChange=this._handleOpacityChange.bind(this);this._reprojectFeature=
this._reprojectFeature.bind(this);t(["../workers/heatmapCalculator"],function(a){d._calculator=new a(n.mixin({width:d.map.width,height:d.map.height},d._getOptions()));d._setupRenderer();d.heatmapRenderer.getStats=a.calculateStats;d.heatmapRenderer.getHistogramData=a.getHistogramData})},destroy:function(){this._removeHandlers();this._rendererChangeHandle&&this._rendererChangeHandle.remove();this._rendererChangeHandle=this.sourceLayer=this.imageLayer=this.map=this.heatmapRenderer=this._hndls=null},
_handleRendererChange:function(a){var b=a.renderer,c=b instanceof q;this.heatmapRenderer?c?this.heatmapRenderer=b:this._removeRenderer(a):c&&(this.heatmapRenderer=b,this.sourceLayer&&this.map&&this._setupRenderer())},_handleOpacityChange:function(a){a=a.opacity;var b=this._getImageBySourceId(this.sourceLayer.id);b&&b.setOpacity(a)},_setupRenderer:function(){var a=this._hndls,c=this.sourceLayer,g=this.map,e=this;c._originalDraw=c._draw;c._draw=b;c._div.clear();clearTimeout(this._resetTimer);this._resetTimer=
setTimeout(this._resetGraphics.bind(this),250);a.push(c.on("update-end",this._setupDraw));a.push(c.on("suspend",function(a){(a=e._getImageBySourceId(e.sourceLayer.id))&&a.hide()}));a.push(c.on("resume",function(a){(a=e._getImageBySourceId(e.sourceLayer.id))&&a.show()}));a.push(d.after(c,"redraw",this._setupDraw));a.push(g.on("layer-remove",function(a){a.layer==c&&((a=e._getImageBySourceId(e.sourceLayer.id))&&e.imageLayer.removeImage(a),e._removeRenderer({target:c}))}));c._collection&&a.push(c.on("graphic-add",
function(a){e._reprojectFeature(a.graphic);e._setupDraw()}));1!==c.mode&&(a.push(g.on("resize, pan-end",this._setupDraw)),a.push(g.on("zoom-end",this._setupDraw)));a.push(c.on("opacity-change",this._handleOpacityChange));this.imageLayer.suspended&&this.imageLayer.resume();c.graphics&&c.graphics.length&&(c.graphics[0].geometry&&!g.spatialReference.equals(c.graphics[0].geometry.spatialReference)&&v.forEach(c.graphics,function(a){this._reprojectFeature(a)}.bind(this)),this._setupDraw())},_setupDraw:function(){if(!this._drawTimer){var a=
this;this._drawTimer=setTimeout(function(){clearTimeout(a._drawTimer);a._drawTimer=null;a.sourceLayer._getRenderer().isInstanceOf(q)&&a.recalculateHeatmap()},16)}},_removeRenderer:function(a){var b=a.target;b._draw=b._originalDraw;delete b._originalDraw;b.setDrawMode(!0);this._removeHandlers();this._hndls=[];var c=this._getImageBySourceId(this.sourceLayer.id);c&&this.imageLayer.removeImage(c);clearTimeout(this._drawTimer);clearTimeout(this._resetTimer);this._drawTimer=this._resetTimer=null;b.renderer!=
a.renderer&&b.renderer.getRendererInfo?this.heatmapRenderer=null:(b.redraw(),this.destroy())},recalculateHeatmap:function(){this._calculator?this._doMainCalculation():this._calculatorClient&&this._doWorkerCalculation()},_reprojectFeature:function(a){if(a&&a.geometry){var b=a.geometry,d=this.map.spatialReference;d.equals(b.spatialReference)||(b=c.project(b,d),null==b?console.log("Unable to reproject features to map's spatial reference. Please convert feature geometry before adding to layer"):a.geometry=
b)}},_doWorkerCalculation:function(){},_doMainCalculation:function(){var a=this.sourceLayer,b=this.map,c=this.heatmapRenderer,d=this.map.extent,e=this.map.width,k=this.map.height,r=this._calculator,q=this,w=function(f){f=q._getScreenPoints(f.features,b,a);f=r.calculateImageData(n.mixin({screenPoints:f,mapinfo:{extent:[d.xmin,d.ymin,d.xmax,d.ymax],resolution:b.getResolution()},width:e,height:k},q._getOptions()));f=c.getSymbol(g({geometry:b.extent,attributes:{size:[e,k],imageData:f},layer:a}));f=new h({extent:b.extent,
href:f.url,opacity:0,sourceId:a.id});q._swapMapImages(f,q._getImageBySourceId(a.id));a.suspended&&f.hide()},m={geometry:b.extent,timeExtent:a.useMapTime?b.timeExtent:void 0,spatialRelationship:u.SPATIAL_REL_INTERSECTS};null!=a._canDoClientSideQuery(m)?a.queryFeatures(m,w):w({features:a.graphics})},_getScreenPoints:function(a,b,c){var d=[],f=a.length,g=0,e=0,l,h=new r(b.extent.xmin,b.extent.ymax,b.spatialReference),k=b.toScreen(h),q=k.x,k=k.y,m=b.getResolution(),u;for((e=b.extent.getCacheValue("_parts"))&&
(u=v.map(e,function(a){return c._intersects(b,a.extent)[0]}));f--;)e=a[f],e.geometry&&(l={x:Math.ceil((e.geometry.x-h.x)/m+q),y:Math.floor((h.y-e.geometry.y)/m-k),attributes:e.attributes},u&&(e=1<u.length&&l.x<-u[0]?u[1]:u[0],l.x+=e),d[g++]=l);return d},_getImageBySourceId:function(a){var b=this.imageLayer.getImages(),b=v.filter(b,function(b){return b.sourceId==a});if(b.length)return b[b.length-1]},_swapMapImages:function(a,b){function c(){d.removeImage(b)}var d=this.imageLayer,f=this.sourceLayer.opacity;
d.addImage(a);x.anim(a._node,{opacity:f},null,null,function(){a.opacity=f});null!=b&&x.anim(b._node,{opacity:0},null,null,c)},_removeHandlers:function(){if(null!=this._hndls)for(var a=this._hndls.length;a--;)this._hndls[a].remove()},_getOptions:function(){var a=this.heatmapRenderer;return{blurRadius:a.blurRadius,gradient:a.gradient,maxPixelIntensity:a.maxPixelIntensity,minPixelIntensity:a.minPixelIntensity,field:a.field,fieldOffset:a.fieldOffset}},_resetGraphics:function(){clearTimeout(this._resetTimer);
this._resetTimer=null;for(var a=this.sourceLayer.graphics,b=a.length,c;b--;)c=a[b],c._shape=c._offsets=void 0}});k("extend-esri")&&n.setObject("layers.HeatmapManager",m,e);return m})},"esri/layers/clustering/ClusterManager":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has ../../kernel ../../Evented ../../graphic ../../lang ../../Color ../../graphicsUtils ../../dijit/PopupTemplate ../../dijit/Legend/utils ../../renderers/ClassBreaksRenderer ../../symbols/SimpleMarkerSymbol ../GraphicsLayer ../Field ./GeohashAggregation ./statUtils dojo/i18n!../../nls/jsapi".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,a,f,l,y){var F=y.layers.clusters,B=y.widgets.popup,A=F.numFeatures,z=Math.pow(2,53)-1;m=m(e,{declaredClass:"esri.layers.clustering.ClusterManager",layer:null,aggregationInfo:null,container:null,defaults:{clusterRadius:80,markerSymbol:{color:[77,77,77,255],size:6,angle:0,xoffset:0,yoffset:0,type:"esriSMS",style:"esriSMSCircle",outline:{color:[255,255,255,255],width:.75,type:"esriSLS",style:"esriSLSSolid"}}},_initialized:!1,_map:null,_eventHandles:null,_clusterRadius:null,
_renderer:null,_statisticInfos:null,_fields:null,_infoTemplate:null,_clusterGenerator:null,_singleGraphics:null,constructor:function(a){this._eventHandles=[];this.layer=a.layer;this.setAggregationInfo(a.aggregationInfo)},initialize:function(a){this._initialized=!0;this._map=a;this.container=this._createContainer();this._clusterGenerator=this._createClusterGenerator();this._initClusterGenerator();this._createLayerEventListeners();this._createMapEventListeners();this._createPopupEventListeners()},destroy:function(a){this._clearSingleGraphics();
this._removeClusterBoundary();this._destroyEventListeners();this._removeFromPopup(this.container);this._removeFromPopup(this.layer);this._resetClusterNav();this._destroyClusterGenerator(a);this._destroyContainer();this.layer=this.aggregationInfo=this._map=null},setAggregationInfo:function(a){this.aggregationInfo=a?n.mixin({},a):null;this._applyAggregationInfo()},getClusterRenderer:function(){return this._renderer},getClusterFields:function(){return this._fields||[]},getFeaturesInCluster:function(a){a=
a&&a.getAggregationInfo();return this._clusterGenerator?this._clusterGenerator.getFeaturesInCluster(a):[]},getAggregateGraphics:function(){return this.container?this.container.graphics.slice(0):[]},getSingleGraphics:function(){return this._singleGraphics?this._singleGraphics.slice(0):[]},redraw:function(){this.container&&this.container.redraw()},isClusteringEnabled:function(){return!(!this._clusterGenerator||!this._clusterGenerator.clustersEnabled)},isClusteringActive:function(){return!!(this._clusterGenerator&&
0<this._clusterGenerator.getNumFeatures())},_createContainer:function(){var a=this.layer,b=new g._GraphicsLayer({_child:!0,id:a.id+"_clusters",visible:a.visible,minScale:a.minScale,maxScale:a.maxScale,infoTemplate:this._infoTemplate});b.fields=this._fields;b.setRenderer(this._renderer);b.loaded=!0;b.onLoad(b);b._setMap(this._map,a._div);return a._childLayer=b},_destroyContainer:function(){var a=this.container;a&&(a.clear(),a._unsetMap(this._map,this.layer._div),this.layer._childLayer=null);this.container=
null},_createClusterGenerator:function(){return new f({map:this._map,layer:this.layer,clusterRadius:this._clusterRadius,statisticInfos:this._statisticInfos})},_initClusterGenerator:function(){var a=this._clusterGenerator;a.loaded?(this._applyRenderer(),this._initClusterUpdates()):this._eventHandles.push(a.on("load",n.hitch(this,function(){this._applyRenderer();this._initClusterUpdates()})),a.on("load-error",n.hitch(this,function(a){console.log(a.error)})))},_destroyClusterGenerator:function(a){this._clusterGenerator&&
this._clusterGenerator.destroy(a);this._clusterGenerator=null},_applyAggregationInfo:function(){this._applyClusterRadius();this._applyRenderer();this._clusterGenerator&&!this._clusterGenerator.isUpdateScheduled()&&this.redraw()},_applyClusterRadius:function(){var a=this.aggregationInfo;this._clusterRadius=a&&a.clusterRadius||this.defaults.clusterRadius;this._clusterGenerator&&this._clusterGenerator.setClusterRadius(this._clusterRadius);this._computeClusterRadius()},_computeClusterRadius:function(){var a=
this.aggregationInfo||{};a.clusterRadius=this._clusterRadius;this.aggregationInfo=a},_applyRenderer:function(){var a=this.container,b=this._getClusterRendererInfo(),c=this._compareStatInfos(this._statisticInfos,b.statisticInfos);c&&(this._statisticInfos=b.statisticInfos,this._clusterGenerator&&(this._clusterGenerator.setStatisticInfos(d.map(this._statisticInfos,function(a){return{attributeInfo:a.attributeInfo,statisticType:a.statisticType}})),a&&d.forEach(a.graphics,function(a){this._applyClusterAttributes(a,
a.getAggregationInfo())},this)));this._renderer=b.renderer;this._applyFields();this._applyInfoTemplate(!!c&&this._initialized);a&&(a.setRenderer(this._renderer),this.emit("renderer-change"))},_applyFields:function(){this._fields=this._getFields(this._statisticInfos);this.container&&(this.container.fields=this._fields)},_applyInfoTemplate:function(a){if(this.layer.infoTemplate){var b=this.aggregationInfo,b=b&&b.infoTemplate||this._infoTemplate;a=a||!b?this._createInfoTemplate():this._updateInfoTemplate(b)}else a=
null;this._infoTemplate=a;this.container&&this.container.setInfoTemplate(this._infoTemplate);this._computeInfoTemplate()},_computeInfoTemplate:function(){var a=this.aggregationInfo||{};a.infoTemplate=this._infoTemplate;this.aggregationInfo=a},_getClusterRendererInfo:function(){var a=this.layer&&this.layer.renderer;return a?this._createClusterRenderer(a):this._getDefaultClusterRenderer()},_getDefaultClusterRenderer:function(){var a=this._createContinuousCountRenderer();this._addSizeByCountVariable(a);
return{renderer:a,statisticInfos:[]}},_createContinuousCountRenderer:function(a){var c=new x(null,"cluster_count");c.addBreak({minValue:-z,maxValue:z,symbol:a?new a.constructor(a.toJson()):new b(n.clone(this.defaults.markerSymbol))});return c},_createClusterRenderer:function(a){if(!this._isSupportedRenderer(a))return this._getDefaultClusterRenderer();var b,c=[];if(this._isSimpleRenderer(a))b=this._createContinuousCountRenderer(a.symbol);else{b=new a.constructor(a.toJson());var d=this._getRendererAttributeInfo(a),
f;this._isCBRenderer(b)?(f=l.getClusterField(d,"avg"),c.push(this._getStatInfo(d,"avg")),b.normalizationType=null,b.normalizationField=null,b.normalizationTotal=null):this._isUVRenderer(b)&&(f=l.getClusterField(d,"type"),c.push(this._getStatInfo(d,"type")));b.attributeField=f;b.setValueExpression(null);b.valueExpressionTitle=null;b.setVisualVariables(null);this._setRendererTitle(b,a)}a=this._getSupportedVariables(a);d=this._createClusterVariables(a.allVars,c);b.setVisualVariables(d);a.sizeVars.length||
this._isCBSizeRenderer(b)||this._addSizeByCountVariable(b);return{renderer:b,statisticInfos:c}},_isSupportedRenderer:function(a){if(this._isSimpleRenderer(a))return!0;if(this._isCBRenderer(a)){var b=a.normalizationType;return"function"===typeof a.attributeField||b&&"field"!==b?!1:!0}return this._isUVRenderer(a)?"function"===typeof a.attributeField||a.attributeField2?!1:!0:!1},_isSimpleRenderer:function(a){return-1<a.declaredClass.toLowerCase().indexOf("simplerenderer")},_isCBRenderer:function(a){return-1<
a.declaredClass.toLowerCase().indexOf("classbreaksrenderer")},_isUVRenderer:function(a){return-1<a.declaredClass.toLowerCase().indexOf("uniquevaluerenderer")},_isCBSizeRenderer:function(a){var b=a.infos;if(!this._isCBRenderer(a)||!b||2>b.length)return!1;var c=Infinity,f=-Infinity;d.forEach(b,function(a){if(a=a.symbol){var b=0;switch(a.type){case "simplemarkersymbol":b=a.size;break;case "picturemarkersymbol":b=(a.width+a.height)/2}c=Math.min(c,b);f=Math.max(f,b)}});return Infinity!==c&&-Infinity!==
f&&c!==f},_getRendererAttributeInfo:function(a){var b=a.attributeField,c=b?this.layer.getField(b):null;return{field:b,attributeType:c&&"esriFieldTypeDate"===c.type?"date":null,rotationType:null,valueExpression:a.valueExpression,valueExpressionTitle:a.valueExpressionTitle,normalizationField:a.normalizationField}},_setRendererTitle:function(a,b){a.legendOptions=n.clone(b.legendOptions);a.legendOptions&&a.legendOptions.title||(a.legendOptions=a.legendOptions||{},a.legendOptions.title=u.getRendererTitle(b,
this.layer))},_getSupportedVariables:function(a){var b=a.getVisualVariablesForType("colorInfo",!1)||[],c=a.getVisualVariablesForType("sizeInfo",!1)||[],f=a.getVisualVariablesForType("opacityInfo",!1)||[];a=a.getVisualVariablesForType("rotationInfo",!1)||[];b=d.filter(b,this._variableFilter);c=d.filter(c,this._variableFilter);f=d.filter(f,this._variableFilter);a=d.filter(a,this._variableFilter);return{sizeVars:c,allVars:b.concat(c).concat(f).concat(a)}},_variableFilter:function(a){return"function"!==
typeof a.field},_createClusterVariables:function(a,b){return d.map(a,function(a){return this._createVarForAvg(a,b)},this)},_createVarForAvg:function(a,b){var c=n.clone(a),d=this._getVariableAttributeInfo(a);c.field=l.getClusterField(d,"avg");c.normalizationField=null;c.valueExpression=null;c.valueExpressionTitle=null;d=this._getStatInfo(d,"avg");this._addStatInfo(b,d);this._setVariableTitle(c,a);return c},_getVariableAttributeInfo:function(a){var b="rotationInfo"===a.type,c=b?"angle":null,b=b?a.rotationType:
null,d=a.legendOptions&&a.legendOptions.title,f=a.field,g=f?this.layer.getField(f):null;g&&"esriFieldTypeDate"===g.type&&(c="date");return{field:f,attributeType:c,rotationType:b,valueExpression:a.valueExpression,valueExpressionTitle:a.valueExpressionTitle||a.valueExpression&&d,normalizationField:a.normalizationField}},_setVariableTitle:function(a,b){a.legendOptions&&a.legendOptions.title||(a.legendOptions=a.legendOptions||{},a.legendOptions.title=u.getVisualVariableTitle(b,this.layer))},_getStatInfo:function(a,
b){return{statisticHash:l.getStatisticHash(a,b),attributeInfo:a,statisticType:b}},_addStatInfo:function(a,b){var c=this._findStatInfo(a,b);c?c.attributeInfo.valueExpressionTitle||(c.attributeInfo.valueExpressionTitle=b.attributeInfo.valueExpressionTitle):a.push(b)},_findStatInfo:function(a,b){var c;d.some(a,function(a){a.statisticHash===b.statisticHash&&(c=a);return!!c});return c},_compareStatInfos:function(a,b){var c=d.filter(a,function(a){return!this._findStatInfo(b,a)},this),f=d.filter(b,function(b){return!this._findStatInfo(a,
b)},this);return f.length||c.length?{added:f,removed:c}:null},_addSizeByCountVariable:function(a){var b=this._createSizeByCountVariable();b&&this._addVariable(a,b)},_getSizeByCountVariable:function(a){a=a.getVisualVariablesForType("sizeInfo",!1)||[];return d.filter(a,function(a){return"cluster_count"===a.field})[0]},_updateSizeByCountVariable:function(){var a=this._renderer,b=this._getSizeByCountVariable(a);if(b){var c=this._createSizeByCountVariable();c&&this._replaceVariable(a,b,c)}},_createSizeByCountVariable:function(){var a=
this._clusterGenerator,b;if(a){b=a.getCurrentLodStats();var c=a.getNumFeatures(),a=a.clusters,d=b.min,f=b.max;1===b.count&&d===c||1===a.length&&a[0].count===c?(d=1,f=c):d&&d===f&&(f=2*d);b={type:"sizeInfo",field:"cluster_count",valueUnit:"unknown",minSize:12,maxSize:50,minDataValue:d,maxDataValue:f,legendOptions:{title:A}}}return b},_addVariable:function(a,b){var c=a.visualVariables||[];c.push(b);a.setVisualVariables(c)},_replaceVariable:function(a,b,c){var f=a.visualVariables;b=d.indexOf(f,b);-1<
b&&f.splice(b,1);f.push(c);a.setVisualVariables(f)},_getFields:function(b){var c=[new a({name:"cluster_count",type:"esriFieldTypeInteger"})];d.forEach(b,function(b){var d=b.statisticType;b=b.attributeInfo;var f;"avg"===d?f="date"===b.attributeType?"esriFieldTypeDate":"esriFieldTypeDouble":"type"===d&&(f=b.field?this.layer.getField(b.field).type:"esriFieldTypeString");c.push(new a({name:l.getClusterField(b,d),type:f}))},this);return c},_createInfoTemplate:function(){var a=this._statisticInfos,b=this._renderer,
c=[{fieldName:"cluster_count",label:A,visible:!0,format:{digitSeparator:!0,places:0}}],f=[],g=[r.substitute({count:"{cluster_count}"},F.countSummary)],e=this._isUVRenderer(b)?b.infos:[];d.forEach(a,function(a){var b,d,h=a.statisticType,k=a.attributeInfo,w=l.getClusterField(k,h),r=this._getFieldLabel(a);"avg"===h?(b={fieldName:w,label:r,visible:!0,format:"date"===k.attributeType?{dateFormat:"shortDateShortTime"}:{digitSeparator:!0,places:1}},d=this._getFieldSummary(a,w)):"type"===h&&(d="expression/"+
w,b={fieldName:d,visible:!0},f.push({name:w,title:r,returnType:"string",expression:this._getExpression(e,w)}),d=this._getFieldSummary(a,d));b&&c.push(b);d&&g.push(d)},this);return new q({fieldInfos:c,expressionInfos:f,description:g.join("\x3cbr/\x3e\x3cbr/\x3e")})},_updateInfoTemplate:function(a){var b=a.toJson(),c=this._isUVRenderer(this._renderer)?this._renderer.infos:[];d.forEach(this._statisticInfos,function(a){var d=a.statisticType;a=l.getClusterField(a.attributeInfo,d);"type"===d&&(d=this._findExpressionInfo(a,
b))&&(d.expression=this._getExpression(c,a))},this);return new q(b)},_findExpressionInfo:function(a,b){var c;d.some(b.expressionInfos,function(b){b.name===a&&(c=b);return!!c});return c},_escapeDoubleQuotes:function(a){return a?a.replace(/"/g,'\\"'):""},_getExpression:function(a,b){return["var uvInfos \x3d ["+this._getObjects(a).join(", ")+"];",'var predominantType \x3d Text($feature["'+b+'"]);','var label \x3d "'+this._escapeDoubleQuotes(F.predominantNoneValue)+'";',"for (var i \x3d 0; i \x3c Count(uvInfos); i++) {\nif (uvInfos[i].value \x3d\x3d predominantType) {\nlabel \x3d uvInfos[i].label;\nbreak;\n}\n}\nreturn label;"].join("\n")},
_getObjects:function(a){return d.map(a,function(a){return'{"value": "'+String(a.value)+'","label": "'+this._escapeDoubleQuotes(String(a.label))+'"}'},this)},_getFieldLabel:function(a){var b=a.statisticType,c=a.attributeInfo,d=c.field;a=c.normalizationField;var f="",g;"avg"===b?g=a?F.avgNormFieldLabel:F.avgFieldLabel:"type"===b&&(g=F.predominantFieldLabel);g&&(b=c.valueExpression?c.valueExpressionTitle:this.layer.getFieldLabel(d),a=a&&this.layer.getFieldLabel(a),f=r.substitute({fieldLabel:b||"",normFieldLabel:a||
""},g));return f},_getFieldSummary:function(a,b){var c=a.statisticType,d=a.attributeInfo,f=d.field,g=d.normalizationField,e="",h;"avg"===c?h=g?F.avgNormFieldSummary:F.avgFieldSummary:"type"===c&&(h=F.predominantFieldSummary);h&&(c=d.valueExpression?d.valueExpressionTitle:this.layer.getFieldLabel(f),g=g&&this.layer.getFieldLabel(g),e=r.substitute({fieldLabel:c||"",normFieldLabel:g||"",fieldValue:"{"+b+"}"},h));return e},_removeFromPopup:function(a){var b=this._map.infoWindow,c=b.features;if(c&&c.length){var f=
d.filter(c,function(b){return b.getLayer()!==a});f.length<c.length&&(f.length?b.setFeatures(f):(b.clearFeatures(),b.hide()))}},_resetClusterNav:function(){this._resetClusterNavPartial();this._popupClusterGraphic=null},_resetClusterNavPartial:function(){this._map.infoWindow.removeActions(this._popupActions);this._hideSingleGraphic(this._popupSingleGraphic);this._popupSingleGraphic=null},_addClusterBoundary:function(a,b){var c=b.clusterFillSymbol;c&&(c=new c.constructor(c.toJson()));c=new k(a,c);this._map.graphics.add(c);
this._clusterBoundary=c},_removeClusterBoundary:function(){this._map.graphics.remove(this._clusterBoundary);this._clusterBoundary=null},_createBrowseFeaturesAction:function(){return this._map.infoWindow.addActions([{title:B.NLS_browseFeatures,className:"browseFeatures",callback:n.hitch(this,function(a){a.preventDefault();a=this._map.infoWindow;var b=a.getSelectedFeature(),c=b.getChildGraphics(),d=a.getCurrentAnchor();a.setFeatures(c,{anchor:d});if(c=h.graphicsExtent(c))this._addClusterBoundary(c,
a),a.show(this._getPopupLocation(c,d));this._popupClusterGraphic=b})}])[0]},_getPopupLocation:function(a,b){var c=a.getCenter();b=b.toLowerCase();-1<b.indexOf("top")?c.update(c.x,a.ymax):-1<b.indexOf("bottom")?c.update(c.x,a.ymin):-1<b.indexOf("left")?c.update(a.xmin,c.y):c.update(a.xmax,c.y);return c},_createViewSummaryAction:function(){return this._map.infoWindow.addActions([{title:B.NLS_viewSummary,className:"viewSummary",callback:n.hitch(this,function(a){a.preventDefault();a=this._popupClusterGraphic;
var b=this._map.infoWindow;b.setFeatures([a]);b.show(a.geometry);this._popupClusterGraphic=null})}])[0]},_initClusterUpdates:function(){this._updateSizeVariable();this._updateClusterGraphics();this._eventHandles.push(this._clusterGenerator.on("update-end",n.hitch(this,function(a){a.mapLevelChange&&this._updateSizeVariable();this._updateClusterGraphics()})),this._clusterGenerator.on("index-complete",n.hitch(this,function(){this._updateSizeVariable()})))},_updateClusterGraphics:function(){this._hideSingleGraphics();
var a=[],b=[];d.forEach(this._clusterGenerator.clusters,function(c){var d=new k(c.centroid);d.setAggregationSourceLayer(this.layer);d.setAggregationInfo(c);this._applyClusterAttributes(d,c);1===c.count?(c=this._getSingleGraphic(d),b.push(c)):a.push(d)},this);this._showSingleGraphics(b);this._addGraphics(a)},_addGraphics:function(a){var b=this.container;b.clear();d.forEach(a,function(a){b.add(a)})},_getSingleGraphic:function(a){var b=this._clusterGenerator.getCell(a.getAggregationInfo().primary).features[0],
c=this.layer.renderer,c=c&&c.getSymbol(b),d=this._getSizeByCountVariable(this._renderer);c&&d&&(a=d?this._renderer.getSize(a,{sizeInfo:d,shape:c.style,resolution:this._map.getResolutionInMeters(),scale:this._map.getScale()}):null,b.setSize(a));return b},_showSingleGraphics:function(a){d.forEach(a,this._showSingleGraphic);this._singleGraphics=a},_hideSingleGraphics:function(){d.forEach(this._singleGraphics,function(a){a.setSize(null);this._hideSingleGraphic(a)},this);this._singleGraphics=null},_clearSingleGraphics:function(){d.forEach(this._singleGraphics,
function(a){a.setSize(null)});this._singleGraphics=null},_showSingleGraphic:function(a){a&&(a._suspended=!1,a.draw())},_hideSingleGraphic:function(a){a&&(a._suspended=!0,a.show(),a.draw())},_updateSizeVariable:function(){this.isClusteringEnabled()&&(this._updateSizeByCountVariable(),this.emit("renderer-change"))},_applyClusterAttributes:function(a,b){a.setAttributes(b.attributes)},_createLayerEventListeners:function(){var a=this.layer;this._eventHandles.push(a.on("visibility-change",n.hitch(this,
function(a){this.container.setVisibility(a.visible)})),a.on("scale-range-change",n.hitch(this,function(){this.container.setScaleRange(this.layer.minScale,this.layer.maxScale)})),a.on("renderer-change",n.hitch(this,function(){this._applyRenderer()})),a.on("info-template-change",n.hitch(this,function(){this._applyInfoTemplate()})))},_createMapEventListeners:function(){this._eventHandles.push(this._map.on("zoom-start",n.hitch(this,function(){this._removeClusterBoundary();this._removeFromPopup(this.container);
this._removeFromPopup(this.layer);this._resetClusterNav();this.container.clear();this._hideSingleGraphics()})))},_createPopupEventListeners:function(){var a=this._map.infoWindow;this._eventHandles.push(a.on("selection-change",n.hitch(this,function(){this._resetClusterNavPartial();var a=this._map.infoWindow.getSelectedFeature(),b=a&&a.getLayer();if(b){var c;b===this.container?(this._removeClusterBoundary(),c=this._createBrowseFeaturesAction()):b===this.layer&&a._suspended?(c=this._createViewSummaryAction(),
this._popupSingleGraphic=a,this._showSingleGraphic(a)):this._removeClusterBoundary();this._popupActions=c?[c]:null}})),a.on("clear-features",n.hitch(this,function(a){this._resetClusterNav();a.isIntermediate||this._removeClusterBoundary()})),a.on("hide",n.hitch(this,function(){this._popupSingleGraphic&&this._popupSingleGraphic.hide();this._clusterBoundary&&this._clusterBoundary.hide()})),a.on("show",n.hitch(this,function(){this._popupSingleGraphic&&this._popupSingleGraphic.show();this._clusterBoundary&&
this._clusterBoundary.show()})))},_destroyEventListeners:function(){d.forEach(this._eventHandles,function(a){a.remove()})}});v("extend-esri")&&n.setObject("layers.clustering.ClusterManager",m,t);return m})},"esri/dijit/Legend/utils":function(){define(["dojo/_base/lang","../../lang","dojo/i18n!../../nls/jsapi"],function(m,n,d){var v=d.widgets.legend;return{getVisualVariableTitle:function(d,e){var k,r=d.field,c=d.normalizationField,h=!1,q=!1,u=!1,t,r=m.isFunction(r)?null:r,c=m.isFunction(c)?null:c;
if(d.legendOptions&&d.legendOptions.title)k=d.legendOptions.title;else if(d.valueExpressionTitle)k=d.valueExpressionTitle;else{if(e.renderer&&e.renderer.authoringInfo&&e.renderer.authoringInfo.visualVariables){var b=e.renderer.authoringInfo.visualVariables;for(t=0;t<b.length;t++){var g=b[t];if("colorInfo"===g.type&&"ratio"===g.style){h=!0;break}else if("colorInfo"===g.type&&"percent"===g.style){q=!0;break}else if("colorInfo"===g.type&&"percentTotal"===g.style){u=!0;break}}}(h=u&&"showRatioPercentTotal"||
q&&"showRatioPercent"||h&&"showRatio"||c&&"showNormField"||r&&"showField"||null)&&(k=n.substitute({field:r&&e.getFieldLabel(r),normField:c&&e.getFieldLabel(c)},v[h]))}return k},getRendererTitle:function(d,e){var k;if(d){var r,c,h;"esri.renderer.ClassBreaksRenderer"===d.declaredClass&&(r=d.attributeField,c=d.normalizationField,h="percent-of-total"===d.normalizationType);r=m.isFunction(r)?null:r;c=m.isFunction(c)?null:c;d.legendOptions&&d.legendOptions.title?k=d.legendOptions.title:d.valueExpressionTitle?
k=d.valueExpressionTitle:(h=c&&"showNormField"||(h?"showNormPct":null)||r&&"showField"||null)&&(k=n.substitute({field:r&&e.getFieldLabel(r),normField:c&&e.getFieldLabel(c)},v[h]))}return k}}})},"esri/layers/clustering/GeohashAggregation":function(){define("dojo/has dojo/_base/declare dojo/_base/lang dojo/_base/array ../../kernel ../../Evented ../../geometry/Point ../../geometry/Extent ../../geometry/mathUtils ../../support/expressionUtils ../../core/timerUtils ../support/attributeUtils ./geohashUtils ./statUtils".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x,b){n=n(e,{loaded:!1,map:null,layer:null,lod:null,tolerance:null,clusterMode:null,clusterRadius:null,sortEnabled:!0,filterEnabled:!0,bufferEnabled:!0,updateEnabled:!0,clusters:null,clustersEnabled:!0,statisticInfos:null,defaults:{lod:1,tolerance:0,clusterMode:"auto",clusterRadius:80,sortEnabled:!0,filterEnabled:!0,bufferEnabled:!0,updateEnabled:!0},_eventHandles:null,_updateHandle:null,_cellIndex:null,_globalIndex:null,_perfProfile:null,_cellSizeScaleFactor:1.5,_extentScaleFactor:1.25,
_maxGeohashLength:12,_minClusterRadius:15,_levelChange:!0,_clusterFieldPrefix:"cluster_",_mapLevelChange:!1,constructor:function(b){this._update=d.hitch(this,this._update);this._eventHandles=[];this._globalIndex={numFeatures:null,fullExtent:null,lodStats:null};this._perfProfile={lastIndex:{total:null,numFeatures:0},lastUpdate:{cells:null,clusters:null,total:null}};this.clusters=[];this.map=b.map;this.layer=b.layer;this.setLod(b.lod);this.setTolerance(b.tolerance);this.setClusterMode(b.clusterMode);
this.setClusterRadius(b.clusterRadius);this.setSortEnabled(b.sortEnabled);this.setFilterEnabled(b.filterEnabled);this.setBufferEnabled(b.bufferEnabled);this.setUpdateEnabled(b.updateEnabled);this.setStatisticInfos(b.statisticInfos);this._load();this.loaded?this._startup():this._eventHandles.push(this.on("load",d.hitch(this,this._startup)))},destroy:function(b){this._displayFeatures(!0,b);v.forEach(this._eventHandles,function(a){a.remove()});q.clearTimeout(this._updateHandle);this._cellIndex=this._globalIndex=
this._eventHandles=this._updateHandle=this.map=this.layer=this.clusters=null},setLod:function(b){var a=this.lod;this.lod=b||this.defaults.lod;a!==this.lod&&this.update()},setTolerance:function(b){var a=this.tolerance;this.tolerance=b||this.defaults.tolerance;a!==this.tolerance&&this.update()},setClusterMode:function(b){var a=this.clusterMode;this.clusterMode=b||this.defaults.clusterMode;this._evalClusterParams();a!==this.clusterMode&&this.update()},setClusterRadius:function(b){var a=this.clusterRadius;
this.clusterRadius=null!=b?b:this.defaults.clusterRadius;this._evalClusterParams();a!==this.clusterRadius&&this.update()},setSortEnabled:function(b){var a=this.sortEnabled;this.sortEnabled=null!=b?!!b:this.defaults.sortEnabled;a!==this.sortEnabled&&this.update()},setFilterEnabled:function(b){var a=this.filterEnabled;this.filterEnabled=null!=b?!!b:this.defaults.filterEnabled;a!==this.filterEnabled&&this.update()},setBufferEnabled:function(b){var a=this.bufferEnabled;this.bufferEnabled=null!=b?!!b:
this.defaults.bufferEnabled;a!==this.bufferEnabled&&this.update()},setUpdateEnabled:function(b){var a=this.updateEnabled;(this.updateEnabled=null!=b?!!b:this.defaults.updateEnabled)&&a!==this.updateEnabled&&(this._mapLevelChange=!0,this.update())},setStatisticInfos:function(b){this.statisticInfos=b||[];this.loaded&&this._applyStatInfos(this.statisticInfos)},update:function(){this.loaded&&null==this._updateHandle&&(this._updateHandle=q.setTimeout(this._update,q.priority.HIGH))},isUpdateScheduled:function(){return null!=
this._updateHandle},getCell:function(b){return this._cellIndex[b.length][b]},getCluster:function(b){var a;v.some(this.clusters,function(c){-1<v.indexOf(c.geohashes,b)&&(a=c);return!!a});return a},getCellsInCluster:function(b){var a=[];v.forEach(b&&b.geohashes,function(b){(b=this.getCell(b))&&a.push(b)},this);return a},getFeaturesInCluster:function(b){var a=[];b=this.getCellsInCluster(b);v.forEach(b,function(b){Array.prototype.push.apply(a,b.features)});return a},getCurrentLodStats:function(){var b=
this._globalIndex.lodStats;return b&&b[this.lod]},getNumFeatures:function(){return this._globalIndex.numFeatures},getFullExtent:function(){var b=this._globalIndex.fullExtent;return b&&Infinity!==b.xmin?new r(b):null},_load:function(){this._displayFeatures(!1);this._checkLoadStatus();this.map.loaded||this._eventHandles.push(this.map.on("load",d.hitch(this,this._checkLoadStatus)));this.layer.loaded||this._eventHandles.push(this.layer.on("load",d.hitch(this,this._checkLoadStatus)))},_checkLoadStatus:function(){if(this.map.loaded&&
this.layer.loaded){var b;if("esriGeometryPoint"!==this.layer.geometryType)b=Error("GeohashAggregation is supported only for points");else{var a=this.map.spatialReference;a.isWebMercator()||4326===a.wkid||(b=Error("GeohashAggregation is supported only when map spatial reference is WGS84 or WebMercator"))}b?(this.loadError=b,this.emit("load-error",{error:b})):(this.loaded=!0,this.emit("load"))}},_startup:function(){this._evalUpdateStatus();this._processFeatures();this._processExtentChange();this._eventHandles.push(this.layer.on("update-end",
d.hitch(this,this._processFeatures)),this.layer.on("edits-complete",d.hitch(this,this._processFeatures)),this.layer.on("graphics-clear",d.hitch(this,this._processFeatures)),this.layer.on("suspend",d.hitch(this,this._evalUpdateStatus)),this.layer.on("resume",d.hitch(this,this._evalUpdateStatus)),this.map.on("extent-change",d.hitch(this,this._processExtentChange)))},_processFeatures:function(){this._indexFeatures();this.update()},_evalUpdateStatus:function(){this.setUpdateEnabled(!this.layer.suspended)},
_processExtentChange:function(b){this._mapLevelChange=!(!b||!b.levelChange);this._evalClusterParams();this.update()},_update:function(){this._updateHandle=null;if(this.updateEnabled){this.emit("update-start");if(this.clustersEnabled){var b=this.map.geographicExtent;if(b){var a=this._getIntersectingCells(b),b=this._getClusters(a.cells,b);this.clusters=b.clusters;this._applyStatInfosToClusters();var a=a.profile,b=b.profile,c=a.total+b.total;a.total=this._getElapsedTime(a.total);b.total=this._getElapsedTime(b.total);
var d=this._perfProfile.lastUpdate={};d.cells=a;d.clusters=b;d.total=this._getElapsedTime(c)}}else this.clusters=[],this._perfProfile.lastUpdate=null;a=this._mapLevelChange;this._mapLevelChange=!1;this.emit("update-end",{levelChange:this._levelChange,mapLevelChange:a})}},_displayFeatures:function(b,a){var c=this.layer,d=!b;c.suspendGraphics(d);!1!==a&&(d?c.clearNodes():c.redraw())},_indexFeatures:function(){var b=this._getTime();this._initializeIndexing();var a=0,c=this._globalIndex.fullExtent;v.forEach(this.layer.graphics,
function(b){if(b.visible){var d=b.geometry,f=this._getLngLat(d),g;f&&(g=d.getCacheValue("_geohash"),void 0===g&&(g=x.pointToGeohash(f),d.setCacheValue("_geohash",g||null)));g&&(this._addGeohashToIndex(g,b,f),a++,this._updateExtent(c,f))}},this);this._applyStatInfosToIndex();this._globalIndex.numFeatures=a;for(var d=this._globalIndex.lodStats,e=1;e<=this._maxGeohashLength;e++)d[e]=this._getLODStats(e,a);this._perfProfile.lastIndex.total=this._getElapsedTime(b,this._getTime());this._perfProfile.lastIndex.numFeatures=
a;this.emit("index-complete")},_initializeIndexing:function(){this._globalIndex={numFeatures:0,fullExtent:{xmin:Infinity,ymin:Infinity,xmax:-Infinity,ymax:-Infinity},lodStats:{}};for(var b=this._cellIndex=[],a=1;a<=this._maxGeohashLength;a++)b[a]={}},_getLngLat:function(b){if(b){var a=b.getLongitude();b=b.getLatitude();b=null!=a&&null!=b?{x:a,y:b}:null}return b},_addGeohashToIndex:function(b,a,c){for(var d=this._cellIndex,f="",g=0;g<this._maxGeohashLength;g++){var f=f+b[g],e=d[f.length],h=e[f];h||
(h=e[f]={count:0,centroid:{x:null,y:null},extent:{xmin:Infinity,ymin:Infinity,xmax:-Infinity,ymax:-Infinity},features:[],geohash:f,statistics:null});this._updateItem(h,1,c,!0);h.features.push(a)}},_getLODStats:function(b,a){var c=this._cellIndex[b],d=0,g=Infinity,e=-Infinity,h=null,k;for(k in c){var r=c[k];d++;r.count<g&&(g=r.count);r.count>e&&(e=r.count)}0<d&&(h=Number((a/d).toFixed(2)));return{lod:b,count:d,min:Infinity===g?null:g,max:-Infinity===e?null:e,avg:h}},_evalClusterParams:function(){if(this.loaded&&
"auto"===this.clusterMode){var b=this._getClusterParams(this.map.getResolutionInMeters(),this.clusterRadius,this._minClusterRadius);this._levelChange=this.lod!==b.lod;this.lod=b.lod;this.tolerance=b.tolerance}},_getClusterParams:function(b,a,c){a<c&&(a=c);b=Math.ceil(b*a);a=this._getClosestLODRange(b).max;do c=this._getCellSize(a),(c=b>=this._cellSizeScaleFactor*c||1===c)||(a+=1);while(!c);c=b/this._getCellSize(a);return{lod:a,tolerance:b,multiplier:Number(c.toFixed(2))}},_getClosestLODRange:function(b){for(var a,
c=this._maxGeohashLength;1<=c;c--)if(this._getCellSize(c)>=b){a=c;break}null==a&&(a=1);b=a+1;b>this._maxGeohashLength&&(b=this._maxGeohashLength);return{min:a,max:b}},_getCellSize:function(b){b=x.getCellSizeInMeters(b);return Math.ceil(Math.min(b.width,b.height))},_sorter:function(b,a){var c=b.centroid,d=a.centroid;return b.count>a.count?-1:b.count<a.count?1:c.x>d.x?-1:c.x<d.x?1:0},_getIntersectingCells:function(b){var a=this._getTime();b=b.expand(this._extentScaleFactor);var c=x.getIntersecting(b,
this.lod,this.bufferEnabled?this.tolerance:0);b=this._getTime();var d=[],g=this.tolerance,e=this.sortEnabled;v.forEach(c,function(a){(a=this.getCell(a))&&d.push(a)},this);g&&e&&d.sort(this._sorter);c=this._getTime();return{cells:d,profile:{findCells:this._getElapsedTime(a,b),scanAndSortCells:this._getElapsedTime(b,c),total:c-a}}},_getClusters:function(b,a){var c=this._getTime(),d=[],g={},e={findCells:0};v.forEach(b,function(a,b){var c=this._createCluster(a,g,e);c&&d.push(c)},this);this._markIntersecting(d,
a);this.filterEnabled&&(d=this._getIntersectingClusters(d));var h=this._getTime();return{clusters:d,profile:{findCellsInCluster:this._getElapsedTime(e.findCells),total:h-c}}},_markIntersecting:function(b,a){var c=a.normalize();v.forEach(b,function(a){var b=a.centroid.x,d=a.centroid.y;a.isIntersecting=v.some(c,function(a){return b>=a.xmin&&b<=a.xmax&&d>=a.ymin&&d<=a.ymax})})},_getIntersectingClusters:function(b){return v.filter(b,function(a){return a.isIntersecting})},_createCluster:function(b,a,c){if(!a[b.geohash]){var d=
[{cell:b,distance:0}];if(this.tolerance){var f=this._getTime(),g=x.getNeighborsWithinDistance(b.centroid,this.lod,this.tolerance);c.findCells+=this._getTime()-f;v.forEach(g,function(a){if(a!==b.geohash&&(a=this.getCell(a))){var c=this._calculateDistance(b.centroid,a.centroid);c<=this.tolerance&&d.push({cell:a,distance:c})}},this)}return this._mergeCells(d,a)}},_calculateDistance:function(b,a){return c.getLength(x.geographicToWebMercator(b),x.geographicToWebMercator(a))},_mergeCells:function(b,a){var c=
this._initializeCluster({},b[0].cell.geohash);v.forEach(b,function(b){var d=b.cell,f=d.geohash;b=b.distance;var g=a[f];if(g)if(b<g.distance)this._removeCellFromCluster(f,a);else return;a[f]={cluster:c,distance:b};this._updateItem(c,d.count,d.centroid);c.geohashes.push(f)},this);return c},_removeCellFromCluster:function(b,a){var c=a[b].cluster;delete a[b];var d=v.indexOf(c.geohashes,b);-1<d&&c.geohashes.splice(d,1);this._reevaluateCluster(c)},_reevaluateCluster:function(b){var a=b.geohashes;b=this._initializeCluster(b,
b.primary);v.forEach(a,function(a){var c=this.getCell(a);c&&(this._updateItem(b,c.count,c.centroid),b.geohashes.push(a))},this)},_initializeCluster:function(b,a){b.count=0;b.centroid=new k(null,null);b.geohashes=[];b.primary=a;b.statistics=null;return b},_applyStatInfos:function(b){b=this._getValidStatInfos(b);this._applyStatInfosToIndex(b);this._applyStatInfosToClusters(b)},_getValidStatInfos:function(c){var a=[];v.forEach(c,function(c){var d=c.attributeInfo;c=c.statisticType;var f="angle"===d.attributeType;
if(b.isSupportedStatisticType(c)&&(!f||"avg"===c)){var g="arithmetic"===d.rotationType;a.push({attributeCache:u.createAttributeCache(d,"type"===c),identifier:b.getStatisticId(d,c),statFunctions:b.getStatisticFunctions(c),isAngular:f,isDate:"date"===d.attributeType,isArithmetic:g})}});return a},_applyStatInfosToIndex:function(b){b=b||this._getValidStatInfos(this.statisticInfos);var a=this._cellIndex;if(a)for(var c=1;c<=this._maxGeohashLength;c++){var d=a[c],g;for(g in d)this._applyStatInfosToCell(d[g],
b)}},_applyStatInfosToCell:function(b,a){var c=this._initializeStats(b,a);v.forEach(b.features,function(b){this._calcFeatureStats(b,a,c)},this);this._summarizeStats(b,c,a)},_calcFeatureStats:function(b,a,c){b.attributes&&v.forEach(a,function(a){var d=c[a.identifier],f=a.attributeCache,f=f?b._getDataValue(f.attributeInfo,f,h):null;a.statFunctions.updateCellStat(d,f,a)})},_applyStatInfosToClusters:function(b){b=b||this._getValidStatInfos(this.statisticInfos);var a=this._clusterFieldPrefix;v.forEach(this.clusters,
function(c){var d=this._initializeStats(c,b);v.forEach(this.getCellsInCluster(c),function(a){this._calcCellStats(a,b,d)},this);this._summarizeStats(c,d,b,a);c.attributes[a+"id"]=c.primary},this)},_calcCellStats:function(b,a,c){var d=b.statistics;v.forEach(a,function(a){var b=a.identifier;a.statFunctions.updateClusterStat(c[b],d[b],a)})},_initializeStats:function(b,a){var c=b.statistics={};v.forEach(a,function(a){c[a.identifier]=a.statFunctions.initialize(a)});return c},_summarizeStats:function(b,
a,c,d){var f=b.attributes={};d=d||"";f[d+"count"]=b.count;v.forEach(c,function(b){var c=this._getStatFieldName(b,d);f[c]=b.statFunctions.summarize(a[b.identifier],b)},this)},_getStatFieldName:function(b,a){return(a||"")+b.identifier},_updateItem:function(b,a,c,d){var f=c.y,g=b.centroid,e=b.count;g.x=(e*g.x+a*c.x)/(e+a);g.y=(e*g.y+a*f)/(e+a);b.count+=a;d&&this._updateExtent(b.extent,c)},_updateExtent:function(b,a){var c=a.x,d=a.y;c<b.xmin&&(b.xmin=c);c>b.xmax&&(b.xmax=c);d<b.ymin&&(b.ymin=d);d>b.ymax&&
(b.ymax=d)},_getTime:function(){return window.performance?window.performance.now():(new Date).getTime()},_getElapsedTime:function(b,a){var c,d;d=null!=b&&null!=a?a-b:b;null!=d&&(c="millisecond",1E3<=d&&(d/=1E3,c="second",60<=d&&(d/=60,c="minute")),c={value:Number(d.toFixed(2)),unit:c});return c}});m("extend-esri")&&d.setObject("layers.clustering.GeohashAggregation",n,t);return n})},"esri/core/timerUtils":function(){define([],function(){function m(d){var e,r=d.length;for(e=0;e<r;e++)d[e]()}var n={LOW:1,
HIGH:2},d,v={};v[n.LOW]=[];v[n.HIGH]=[];var t=function(){clearTimeout(d);d=null;var e=v[n.HIGH];v[n.HIGH]=[];m(e);e=v[n.LOW];v[n.LOW]=[];m(e)};return{priority:n,callbackQueue:v,setTimeout:function(e,k){var r=[k,v[k].push(e)-1];d||(d=setTimeout(t,0));return r},clearTimeout:function(d){d&&v[d[0]].splice(d[1],1)}}})},"esri/layers/clustering/geohashUtils":function(){define("dojo/has dojo/string dojo/_base/lang dojo/_base/array ../../kernel ../../geometry/Point ../../geometry/Extent ../../SpatialReference ../../geometry/webMercatorUtils".split(" "),
function(m,n,d,v,t,e,k,r,c){function h(a){var b=a.spatialReference;if(!b)return{x:a.x,y:a.y};var c=b.isWebMercator(),d;4326===b.wkid?d={x:a.x,y:a.y}:c&&(d={x:a.getLongitude(),y:a.getLatitude()});return d}function q(a){var b=a.spatialReference,d=!(!b||!b.isWebMercator()),f;b&&4326===b.wkid?f=new k(a.toJson()):d&&(f=c.webMercatorToGeographic(a,!0));return f}function u(a,b){b.x=e.prototype._normalizeX(a.x,r.prototype._info[4326]);b.y=a.y;return b}function x(a){a=O.decimals[a].toString(2);return n.pad(a,
O.bitsPerBase32Char,"0")}function b(a,b){var c;b=b.slice();b.splice(1,0,0);for(var d=b[0],f=b[2],g=0;g<a.length;g++)Number(a[g])?b[0]=b[1]:b[2]=b[1],c=b[1]=(b[0]+b[2])/2,d=b[0],f=b[2];return{value:c,min:d,max:f}}function g(a,b,c){var d=[];b=b.slice();b.splice(1,0,0);for(var f=b[0],g=b[2],e=0;e<c;e++)a>=b[1]?(b[0]=b[1],f=1):(b[2]=b[1],f=0),b[1]=(b[0]+b[2])/2,d.push(f),f=b[0],g=b[2];return{value:d.join(""),min:f,max:g}}function a(a){var b=a*O.bitsPerBase32Char;0===b%2?a=b/=2:(a=(b+1)/2,b-=a);return{lon:a,
lat:b}}function f(a){var b=0;a=a.split("").reverse().join("");for(var c=0;c<a.length;c++)b+=Number(a[c])*Math.pow(2,c);return O.base32[b]}function l(a,b){var c={x:a.xmin,y:a.ymax},d={x:a.xmax,y:a.ymin},f={x:a.xmax,y:a.ymax};return{sw:J.pointToGeohash({x:a.xmin,y:a.ymin},b),nw:J.pointToGeohash(c,b),se:J.pointToGeohash(d,b),ne:J.pointToGeohash(f,b)}}function y(a,b,c,d,f){var g=a;do f[g]||(f[g]=!0,d.push(g)),(a=g===b)||(g=E(g,c));while(!a)}function F(a,b,c,d){var f=l(a,b);a=[];y(f.sw,f.nw,"n",a,{});
b=[];y(f.se,f.ne,"n",b,{});for(f=0;f<a.length;f++)y(a[f],b[f],"e",c,d)}function B(a){return v.filter(a,function(a){return 180===a.xmax?!0:!1})[0]}function A(a){return v.filter(a,function(a){return-180===a.xmin?!0:!1})[0]}function z(a,b,c,d){var f=J.geographicToWebMercator(a);a={x:f.x-b,y:f.y-b};b=J.webMercatorToGeographic({x:f.x+b,y:f.y+b},!0);a=J.webMercatorToGeographic(a,!0);return new k(null!=c?c:a.x,a.y,null!=d?d:b.x,b.y)}function w(a,b,c,d){var f;a=l(a,b);var g,e;"min"===d?e=180:"max"===d&&(g=
-180);var h=g;d=e;f=J.geohashToCell(a.sw).extent;b=J.geohashToCell(a.ne).extent;a=null!=h?h:f.xmin;f=f.ymin;d=null!=d?d:b.xmax;b=b.ymax;a=z({x:a,y:f},c,g,e);c=z({x:d,y:b},c,g,e);return new k(a.xmin,a.ymin,c.xmax,c.ymax)}function D(a,b,c){var d=a,f=0;do f++,(a=d===b)||(d=E(d,c));while(!a);return f}function C(a,b){var c=l(a,b),d=D(c.nw,c.ne,"e");return{rows:D(c.nw,c.sw,"s"),cols:d}}function E(a,b){var c=a.length%2,d=a.slice(-1),f=O.decimals[d],g=a.slice(0,-1);-1!=O.borders[b][c].indexOf(d)&&g&&(g=E(g,
b));return g+O.neighbors[b][c][f]}var O={base32:"0123456789bcdefghjkmnpqrstuvwxyz",decimals:function(){for(var a={},b=0;32>b;b++)a["0123456789bcdefghjkmnpqrstuvwxyz"[b]]=b;return a}(),neighbors:{n:[null,"238967debc01fg45kmstqrwxuvhjyznp"],s:[null,"bc01fg45238967deuvhjyznpkmstqrwx"],e:[null,"14365h7k9dcfesgujnmqp0r2twvyx8zb"],w:[null,"p0r21436x8zb9dcf5h7kjnmqesgutwvy"]},borders:{n:[null,"bcfguvyz"],s:[null,"0145hjnp"],e:[null,"prxz"],w:[null,"028b"]},bitsPerBase32Char:5,maxGeohashLength:12,longitudeRange:[-180,
180],latitudeRange:[-90,90]};O.neighbors.n[0]="14365h7k9dcfesgujnmqp0r2twvyx8zb";O.neighbors.s[0]="p0r21436x8zb9dcf5h7kjnmqesgutwvy";O.neighbors.e[0]="238967debc01fg45kmstqrwxuvhjyznp";O.neighbors.w[0]="bc01fg45238967deuvhjyznpkmstqrwx";O.borders.n[0]="prxz";O.borders.s[0]="028b";O.borders.e[0]="bcfguvyz";O.borders.w[0]="0145hjnp";var J={geographicToWebMercator:function(a){a=e.lngLatToXY(a.x,a.y);return{x:a[0],y:a[1]}},webMercatorToGeographic:function(a,b){var c=e.xyToLngLat(a.x,a.y,b);return{x:c[0],
y:c[1]}},geohashToCell:function(a){for(var c=[],d=0;d<a.length;d++)c.push(x(a[d]));for(var c=c.join(""),d=[],f=[],g=0;g<c.length;g++)0===g%2?d.push(c[g]):f.push(c[g]);d=d.join("");f=f.join("");d=[d,f];c=b(d[0],O.longitudeRange);d=b(d[1],O.latitudeRange);return{point:{x:c.value,y:d.value},extent:{xmin:c.min,xmax:c.max,ymin:d.min,ymax:d.max},geohash:a}},pointToCell:function(b,c){var d,e,l;c=c||O.maxGeohashLength;var k=h(b);if(k){k=u(k,k);d=a(c);l=g(k.x,O.longitudeRange,d.lon);var w=g(k.y,O.latitudeRange,
d.lat);d=l.value;e=w.value;l={xmin:l.min,xmax:l.max,ymin:w.min,ymax:w.max};for(var w=[],r=Math.ceil((d.length+e.length)/O.bitsPerBase32Char),q=0,m=0,n=0;n<r*O.bitsPerBase32Char;n++){var t=0===n%2?d[q++]:e[m++];null==t&&(t=0);w.push(t)}d=w.join("");e=O.bitsPerBase32Char;w=d.length/e;r=[];for(q=0;q<w;q++)m=d.substr(q*e,e),r.push(f(m));d=r.join("");return{point:k,extent:l,geohash:d}}},geohashToPoint:function(a){return J.geohashToCell(a).point},pointToGeohash:function(a,b){var c=J.pointToCell(a,b);return c&&
c.geohash},getCells:function(a){return v.map(a,function(a){return J.geohashToCell(a)})},getCellSize:function(b){var c=O.longitudeRange,d=O.latitudeRange,c=Math.abs(c[1]-c[0]),d=Math.abs(d[1]-d[0]);b=a(b||1);return{width:c/Math.pow(2,b.lon),height:d/Math.pow(2,b.lat)}},getCellSizeInMeters:function(a){a=J.getCellSize(a);var b=c.metersPerDegree;a.width*=b;a.height*=b;return a},getIntersecting:function(a,b,c){b=b||1;c=c||0;var d=[],f=q(a);if(f){c&&(f=J.expandExtent(a,b,c));a=f.normalize();var g={};v.forEach(a,
function(a){F(a,b,d,g)})}return d},countIntersecting:function(a,b,c){b=b||1;c=c||0;var d=0,f=q(a);if(f){c&&(f=J.expandExtent(a,b,c));a=f.normalize();if(2===a.length){d=B(a);f=A(a);c=C(d,b);var g=C(f,b);a=c.rows;c=c.cols+g.cols;d={x:d.xmin,y:d.ymax};f={x:f.xmax,y:f.ymax};d=u(d,{});f=u(f,{});d=J.pointToGeohash(d,b);b=J.pointToGeohash(f,b);d===b&&c--;b={rows:a,cols:c}}else b=C(a[0],b);d=b.cols*b.rows}return d},getChildren:function(a){a=a||"";var b=[],c;for(c in O.decimals)b.push(a+c);return b},getNeighbors:function(a){var b=
E(a,"n"),c=E(a,"s");return[b,E(b,"e"),E(b,"w"),c,E(c,"e"),E(c,"w"),E(a,"e"),E(a,"w")]},getExtentFromDistance:function(a,b){b=b||1E3;var c,d=h(a);d&&(c=z(d,b));return c},expandExtent:function(a,b,c){b=b||1;c=c||0;if(a=q(a)){if(c){a=a.normalize();if(2===a.length){var d=c;c=B(a);a=A(a);c=w(c,b,d,"min");a=w(a,b,d,"max");360<=c.getWidth()+a.getWidth()?(b=-180,a=180):(b=c.xmin,a=a.xmax);return new k(b,c.ymin,a,c.ymax)}return w(a[0],b,c)}return a}},getNeighborsWithinDistance:function(a,b,c){c=c||1E3;b=b||
1;var d=[];if(a=h(a)){c=z(a,c).normalize();var f={};v.forEach(c,function(a){F(a,b,d,f)})}return d}};m("extend-esri")&&d.setObject("layers.clustering.geohashUtils",J,t);return J})},"esri/layers/clustering/statUtils":function(){define(["dojo/_base/lang","../support/attributeUtils"],function(m,n){function d(d){return"number"===typeof d&&!isNaN(d)&&Infinity!==d&&-Infinity!==d}var v={sum:{initialize:function(){return{count:0,sum:null}},updateCellStat:function(e,k){d(k)&&(e.count++,e.sum+=k)},updateClusterStat:function(d,
k){k.count&&(d.count+=k.count,d.sum+=k.sum)},summarize:function(d){return d.sum}},avg:{initialize:function(d){return{count:0,sum:null,avg:null,sum_cosine:null,sum_sine:null}},updateCellStat:function(e,k,r){d(k)&&(e.count++,r.isAngular?(r.isArithmetic||(k=-1*k+90),e.sum_cosine+=Math.cos(k*Math.PI/180),e.sum_sine+=Math.sin(k*Math.PI/180)):e.sum+=k)},updateClusterStat:function(d,k,r){k.count&&(d.count+=k.count,r.isAngular?(d.sum_cosine+=k.sum_cosine,d.sum_sine+=k.sum_sine):d.sum+=k.sum)},summarize:function(d,
k){if(0<d.count){var e=d.count;k.isAngular?(e=180*Math.atan2(d.sum_sine/e,d.sum_cosine/e)/Math.PI,k.isArithmetic||(e=-1*(e-90)),d.avg=0>e?e+360:e):(d.avg=d.sum/e,k.isDate&&(d.avg=Math.ceil(d.avg)))}return d.avg}},type:{initialize:function(){return{uvInfos:{}}},updateCellStat:function(d,k){if(null==k||""===k||"string"===typeof k&&""===m.trim(k))k=null;var e=d.uvInfos;null==e[k]?e[k]={count:1,value:k}:e[k].count++},updateClusterStat:function(d,k){var e=d.uvInfos,c=k.uvInfos,h;for(h in c){var q=c[h];
null==e[h]?e[h]={count:q.count,value:q.value}:e[h].count+=q.count}},summarize:function(d){d=d.uvInfos;var e,r=-Infinity,c;for(e in d){var h=d[e];h.count>r?(r=h.count,c=h.value):h.count===r&&(c=null)}return c}}},t={isSupportedStatisticType:function(d){return v.hasOwnProperty(d)},getStatisticFunctions:function(d){return v[d]},getStatisticId:function(d,k){var e=n.getAttributeIdSource(d),e=e&&n.getAttributeId(e)||d.field;return k+"_"+e},getClusterField:function(d,k){return"cluster_"+t.getStatisticId(d,
k)},getStatisticHash:function(d,k){var e=[t.getStatisticId(d,k)];d.attributeType&&e.push(d.attributeType.toLowerCase());d.rotationType&&e.push(d.rotationType.toLowerCase());return e.join("_")}};return t})},"esri/tasks/RouteTask":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has ../kernel ../graphic ../request ../geometry/normalizeUtils ./Task ./RouteResult ./NAMessage ./NAServiceDescription".split(" "),function(m,n,d,v,t,e,k,r,c,h,q,u){m=m([c,u],{declaredClass:"esri.tasks.RouteTask",
_eventMap:{"solve-complete":["result"]},constructor:function(c){this._url.orig=this._url.path;this._url.path+="/solve";this._handler=n.hitch(this,this._handler);this.registerConnectEvents()},__msigns:[{n:"solve",c:3,a:[{i:0,p:["stops.features","barriers.features","polylineBarriers.features","polygonBarriers.features"]}],e:2}],_handler:function(c,b,g,a,f){try{var l=[],k=[],r=c.directions||[],m=c.routes?c.routes.features:[],u=c.stops?c.stops.features:[],n=c.barriers?c.barriers.features:[],w=c.polygonBarriers?
c.polygonBarriers.features:[],t=c.polylineBarriers?c.polylineBarriers.features:[],x=c.messages,v=d.forEach,O=d.indexOf,J=!0,K,I,X=c.routes&&c.routes.spatialReference||c.stops&&c.stops.spatialReference||c.barriers&&c.barriers.spatialReference||c.polygonBarriers&&c.polygonBarriers.spatialReference||c.polylineBarriers&&c.polylineBarriers.spatialReference;this._chk=c.checksum;v(r,function(a){l.push(K=a.routeName);k[K]={directions:a}});v(m,function(a){-1===O(l,K=a.attributes.Name)&&(l.push(K),k[K]={});
k[K].route=a});v(u,function(a){I=a.attributes;-1===O(l,K=I.RouteName||"esri.tasks.RouteTask.NULL_ROUTE_NAME")&&(l.push(K),k[K]={});"esri.tasks.RouteTask.NULL_ROUTE_NAME"!==K&&(J=!1);void 0===k[K].stops&&(k[K].stops=[]);k[K].stops.push(a)});0<u.length&&!0===J&&(k[l[0]].stops=k["esri.tasks.RouteTask.NULL_ROUTE_NAME"].stops,delete k["esri.tasks.RouteTask.NULL_ROUTE_NAME"],l.splice(d.indexOf(l,"esri.tasks.RouteTask.NULL_ROUTE_NAME"),1));var P=[];v(l,function(a,b){k[a].routeName="esri.tasks.RouteTask.NULL_ROUTE_NAME"===
a?null:a;k[a].spatialReference=X;P.push(new h(k[a]))});c=function(a){v(a,function(b,c){b.geometry&&(b.geometry.spatialReference=X);a[c]=new e(b)});return a};v(x,function(a,b){x[b]=new q(a)});var N={routeResults:P,barriers:c(n),polygonBarriers:c(w),polylineBarriers:c(t),messages:x};this._successHandler([N],"onSolveComplete",g,f)}catch(L){this._errorHandler(L,a,f)}},solve:function(c,b,d,a){var f=a.assembly;c=this._encode(n.mixin({},this._url.query,{f:"json"},c.toJson(f&&f[0]),this._chk?{checksum:this._chk}:
{}));var g=this._handler,e=this._errorHandler;return k({url:this._url.path,content:c,callbackParamName:"callback",load:function(c,f){g(c,f,b,d,a.dfd)},error:function(b){e(b,d,a.dfd)}})},onSolveComplete:function(){}});r._createWrappers(m);v("extend-esri")&&n.setObject("tasks.RouteTask",m,t);return m})},"esri/tasks/RouteResult":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has ../kernel ../graphic ./DirectionsFeatureSet".split(" "),function(m,n,d,v,t,e,k){m=m(null,{declaredClass:"esri.tasks.RouteResult",
constructor:function(r){var c=r.spatialReference,h=r.route;if(r.directions){var q=[],m=[],n=[];d.forEach(r.directions.features,function(b,a){m[a]=b.compressedGeometry;q[a]=b.strings;n[a]=b.events});r.directions.strings=q;r.directions.events=n;this.directions=new k(r.directions,m)}this.routeName=r.routeName;h&&(h.geometry&&(h.geometry.spatialReference=c),this.route=new e(h));if(r.stops){var b=this.stops=[];d.forEach(r.stops,function(d,a){d.geometry&&(d.geometry.spatialReference=c);b[d.attributes.Sequence-
1]=new e(d)})}},routeName:null,directions:null,route:null,stops:null});v("extend-esri")&&n.setObject("tasks.RouteResult",m,t);return m})},"esri/tasks/DirectionsFeatureSet":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has dojo/json ../kernel ../geometry/Extent ../geometry/Polyline ../geometry/Point ../graphic ./FeatureSet".split(" "),function(m,n,d,v,t,e,k,r,c,h,q){m=m(q,{declaredClass:"esri.tasks.DirectionsFeatureSet",constructor:function(e,r){this.routeId=e.routeId;
this.routeName=e.routeName;n.mixin(this,e.summary);this.extent=new k(this.envelope);var b=this._fromCompressedGeometry,g=this.features,a=this.extent.spatialReference,f=[];d.forEach(r,function(c,d){g[d].setGeometry(f[d]=c?b(c,a):g[d].geometry)});this.mergedGeometry=this._mergePolylinesToSinglePath(f,a);this.geometryType="esriGeometryPolyline";d.forEach(e.events,function(b,f){d.forEach(b,function(d,f){b[f]=new h(new c(d.point.x,d.point.y,a),null,{ETA:d.ETA,strings:t.stringify(d.strings),arriveTimeUTC:d.arriveTimeUTC})});
e.events[f]=b});delete this.envelope},_fromCompressedGeometry:function(c,e){var b=0,g=0,a=0,f=0,h=[],k,q,m,u,n,w,t=0,x=0,v=0;(m=c.match(/((\+|\-)[^\+\-\|]+|\|)/g))||(m=[]);0===parseInt(m[t],32)?(t=2,k=parseInt(m[t],32),t++,u=parseInt(m[t],32),t++,k&1&&(x=d.indexOf(m,"|")+1,n=parseInt(m[x],32),x++),k&2&&(v=d.indexOf(m,"|",x)+1,w=parseInt(m[v],32),v++)):(u=parseInt(m[t],32),t++);for(;t<m.length&&"|"!==m[t];)k=parseInt(m[t],32)+b,t++,b=k,q=parseInt(m[t],32)+g,t++,g=q,k=[k/u,q/u],x&&(q=parseInt(m[x],
32)+a,x++,a=q,k.push(q/n)),v&&(q=parseInt(m[v],32)+f,v++,f=q,k.push(q/w)),h.push(k);b=new r({paths:[h],hasZ:0<x,hasM:0<v});b.setSpatialReference(e);return b},_mergePolylinesToSinglePath:function(c,e){var b=[],g=!1;d.forEach(c,function(a){d.forEach(a.paths,function(c){g=g||a.hasM;b=b.concat(c)})});var a=[],f=[0,0];d.forEach(b,function(b){if(b[0]!==f[0]||b[1]!==f[1])a.push(b),f=b});return new r({paths:[a],spatialReference:e,hasM:g})}});v("extend-esri")&&n.setObject("tasks.DirectionsFeatureSet",m,e);
return m})},"esri/tasks/NAMessage":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel"],function(m,n,d,v){m=m(null,{declaredClass:"esri.tasks.NAMessage",constructor:function(d){n.mixin(this,d)}});n.mixin(m,{TYPE_INFORMATIVE:0,TYPE_PROCESS_DEFINITION:1,TYPE_PROCESS_START:2,TYPE_PROCESS_STOP:3,TYPE_WARNING:50,TYPE_ERROR:100,TYPE_EMPTY:101,TYPE_ABORT:200});d("extend-esri")&&n.setObject("tasks.NAMessage",m,v);return m})},"esri/tasks/NAServiceDescription":function(){define(["dojo/_base/declare",
"dojo/json","dojo/Deferred","dojo/_base/lang","../request"],function(m,n,d,v,t){return m(null,{declaredClass:"esri.tasks._NAServiceDescription",_sd:null,getServiceDescription:function(e,k){var r=new d;if(this._sd)r.resolve(this._sd);else if(this._url&&this._url.orig){var c=this._url.orig,h=(this._url.path.match(/\/solve$/)||[]).length?"Route":(this._url.path.match(/\/solveClosestFacility$/)||[]).length?"ClosestFacility":"ServiceAreas",q,m=function(c){t({url:c+("/"===c[c.length-1]?"":"/")+"GetTravelModes/execute",
content:{f:"json",serviceName:h},callbackParamName:"callback"}).then(function(b){var c=[],a=null;if(b&&b.results&&b.results.length)for(var d=0;d<b.results.length;d++)if("supportedTravelModes"===b.results[d].paramName){if(b.results[d].value&&b.results[d].value.features)for(var e=0;e<b.results[d].value.features.length;e++)if(b.results[d].value.features[e].attributes){var h=n.parse(b.results[d].value.features[e].attributes.TravelMode);c.push(h)}}else"defaultTravelMode"===b.results[d].paramName&&(a=b.results[d].value);
q.supportedTravelModes=c;q.defaultTravelMode=a;r.resolve(q)},function(b){console.log("Could not read from the routingUtilities service.");r.reject(b)})};t({url:c,content:{f:"json"},callbackParamName:"callback"}).then(function(d){q=d;q.supportedTravelModes||(q.supportedTravelModes=[]);for(d=0;d<q.supportedTravelModes.length;d++)q.supportedTravelModes[d].id||(q.supportedTravelModes[d].id=q.supportedTravelModes[d].itemId);k?r.resolve(q):e?m(e):10.4<=q.currentVersion?t({url:c+("/"===c[c.length-1]?"":
"/")+"retrieveTravelModes",content:{f:"json"},callbackParamName:"callback"}).then(function(b){q.supportedTravelModes=b.supportedTravelModes;q.defaultTravelMode=b.defaultTravelMode;r.resolve(q)},function(b){console.log("Could not get to the NAServer's retrieveTravelModes.");r.reject(b)}):t({url:c.substring(0,c.indexOf("/rest/")+6)+"info",content:{f:"json"},callbackParamName:"callback"}).then(function(b){b.owningSystemUrl?(c=b.owningSystemUrl,t({url:c+("/"===c[c.length-1]?"":"/")+"sharing/rest/portals/self",
content:{f:"json"},callbackParamName:"callback"}).then(function(b){b&&b.helperServices&&b.helperServices.routingUtilities&&b.helperServices.routingUtilities.url?m(b.helperServices.routingUtilities.url):(console.log("Portal does not have helperServices.routingUtilities defined."),r.resolve(q))},function(b){console.log("Could not get to the portal's self.");r.reject(b)})):r.resolve(q)},function(b){console.log("Could not get to the NAServer service description.");r.reject(b)})},function(c){r.reject(c)})}else r.reject("NA Task has no URL specified.");
r.then(v.hitch(this,function(c){this._sd=c}),v.hitch(this,function(){this._sd=null}));return r.promise},getOwningSystemUrl:function(){var e=new d;if(this._url&&this._url.orig){var k=this._url.orig;t({url:k.substring(0,k.indexOf("/rest/")+6)+"info",content:{f:"json"},callbackParamName:"callback"}).promise.always(function(d){e.resolve(d.owningSystemUrl)})}else e.resolve(void 0);return e.promise}})})},"esri/tasks/RouteParameters":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/json dojo/has ../kernel ../lang ../graphicsUtils ./NATypes".split(" "),
function(m,n,d,v,t,e,k,r){m=m(null,{declaredClass:"esri.tasks.RouteParameters",accumulateAttributes:null,attributeParameterValues:null,barriers:null,directionsLanguage:null,directionsLengthUnits:null,directionsOutputType:null,directionsStyleName:null,directionsTimeAttribute:null,doNotLocateOnRestrictedElements:!0,findBestSequence:null,ignoreInvalidLocations:null,impedanceAttribute:null,outputLines:"esriNAOutputLineTrueShape",outputGeometryPrecision:null,outputGeometryPrecisionUnits:null,outSpatialReference:null,
overrides:null,polygonBarriers:null,polylineBarriers:null,preserveFirstStop:null,preserveLastStop:null,restrictionAttributes:null,restrictUTurns:null,returnBarriers:!1,returnDirections:!1,returnPolygonBarriers:!1,returnPolylineBarriers:!1,returnRoutes:!0,returnStops:!1,returnZ:!0,startTime:null,startTimeIsUTC:null,timeWindowsAreUTC:null,stops:null,useHierarchy:null,useTimeWindows:null,travelMode:null,toJson:function(c){var h={returnDirections:this.returnDirections,returnRoutes:this.returnRoutes,returnZ:this.returnZ,
returnStops:this.returnStops,returnBarriers:this.returnBarriers,returnPolygonBarriers:this.returnPolygonBarriers,returnPolylineBarriers:this.returnPolylineBarriers,attributeParameterValues:this.attributeParameterValues&&d.toJson(this.attributeParameterValues),outSR:this.outSpatialReference?this.outSpatialReference.wkid||d.toJson(this.outSpatialReference.toJson()):null,outputLines:this.outputLines,overrides:this.overrides,findBestSequence:this.findBestSequence,preserveFirstStop:this.preserveFirstStop,
preserveLastStop:this.preserveLastStop,useTimeWindows:this.useTimeWindows,startTime:this.startTime?this.startTime.getTime():null,startTimeIsUTC:this.startTimeIsUTC,timeWindowsAreUTC:this.timeWindowsAreUTC,accumulateAttributeNames:this.accumulateAttributes?this.accumulateAttributes.join(","):null,ignoreInvalidLocations:this.ignoreInvalidLocations,impedanceAttributeName:this.impedanceAttribute,restrictionAttributeNames:this.restrictionAttributes?this.restrictionAttributes.join(","):null,restrictUTurns:this.restrictUTurns,
useHierarchy:this.useHierarchy,directionsLanguage:this.directionsLanguage,outputGeometryPrecision:this.outputGeometryPrecision,outputGeometryPrecisionUnits:this.outputGeometryPrecisionUnits,directionsLengthUnits:r.LengthUnit[this.directionsLengthUnits],directionsTimeAttributeName:this.directionsTimeAttribute,directionsStyleName:this.directionsStyleName,travelMode:"object"===typeof this.travelMode?d.toJson(this.travelMode):this.travelMode},q=this.stops;"esri.tasks.FeatureSet"===q.declaredClass&&0<
q.features.length?h.stops=d.toJson({type:"features",features:k._encodeGraphics(q.features,c&&c["stops.features"]),doNotLocateOnRestrictedElements:this.doNotLocateOnRestrictedElements}):"esri.tasks.DataLayer"===q.declaredClass?h.stops=q:"esri.tasks.DataFile"===q.declaredClass&&(h.stops=d.toJson({type:"features",url:q.url,doNotLocateOnRestrictedElements:this.doNotLocateOnRestrictedElements}));if(this.directionsOutputType)switch(this.directionsOutputType.toLowerCase()){case "complete":h.directionsOutputType=
"esriDOTComplete";break;case "complete-no-events":h.directionsOutputType="esriDOTCompleteNoEvents";break;case "instructions-only":h.directionsOutputType="esriDOTInstructionsOnly";break;case "standard":h.directionsOutputType="esriDOTStandard";break;case "summary-only":h.directionsOutputType="esriDOTSummaryOnly";break;default:h.directionsOutputType=this.directionsOutputType}q=function(e,h){return e?"esri.tasks.FeatureSet"===e.declaredClass?0<e.features.length?d.toJson({type:"features",features:k._encodeGraphics(e.features,
c&&c[h])}):null:"esri.tasks.DataLayer"===e.declaredClass?e:"esri.tasks.DataFile"===e.declaredClass?d.toJson({type:"features",url:e.url}):d.toJson(e):null};this.barriers&&(h.barriers=q(this.barriers,"barriers.features"));this.polygonBarriers&&(h.polygonBarriers=q(this.polygonBarriers,"polygonBarriers.features"));this.polylineBarriers&&(h.polylineBarriers=q(this.polylineBarriers,"polylineBarriers.features"));return e.filter(h,function(c){if(null!==c)return!0})}});v("extend-esri")&&n.setObject("tasks.RouteParameters",
m,t);return m})},"esri/tasks/NATypes":function(){define(["dojo/_base/lang","dojo/has","../kernel"],function(m,n,d){var v={esriFeet:"esriNAUFeet",esriKilometers:"esriNAUKilometers",esriMeters:"esriNAUMeters",esriMiles:"esriNAUMiles",esriNauticalMiles:"esriNAUNauticalMiles",esriYards:"esriNAUYards"},t={NONE:"esriNAOutputLineNone",STRAIGHT:"esriNAOutputLineStraight",TRUE_SHAPE:"esriNAOutputLineTrueShape",TRUE_SHAPE_WITH_MEASURE:"esriNAOutputLineTrueShapeWithMeasure"},e={ALLOW_BACKTRACK:"esriNFSBAllowBacktrack",
AT_DEAD_ENDS_ONLY:"esriNFSBAtDeadEndsOnly",NO_BACKTRACK:"esriNFSBNoBacktrack",AT_DEAD_ENDS_AND_INTERSECTIONS:"esriNFSBAtDeadEndsAndIntersections"},k={NONE:"esriNAOutputPolygonNone",SIMPLIFIED:"esriNAOutputPolygonSimplified",DETAILED:"esriNAOutputPolygonDetailed"},r={FROM_FACILITY:"esriNATravelDirectionFromFacility",TO_FACILITY:"esriNATravelDirectionToFacility"},c={LengthUnit:v,OutputLine:t,UTurn:e,OutputPolygon:k,TravelDirection:r};n("extend-esri")&&(m.setObject("tasks._NALengthUnit",v,d),m.setObject("tasks.NAOutputLine",
t,d),m.setObject("tasks.NAUTurn",e,d),m.setObject("tasks.NAOutputPolygon",k,d),m.setObject("tasks.NATravelDirection",r,d));return c})},"esri/tasks/DistanceParameters":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/json dojo/has ../kernel ../geometry/jsonUtils".split(" "),function(m,n,d,v,t,e){m=m(null,{declaredClass:"esri.tasks.DistanceParameters",geometry1:null,geometry2:null,distanceUnit:null,geodesic:null,toJson:function(){var k={},r=this.geometry1;r&&(k.geometry1=d.toJson({geometryType:e.getJsonType(r),
geometry:r}));if(r=this.geometry2)k.geometry2=d.toJson({geometryType:e.getJsonType(r),geometry:r});k.sr=d.toJson(this.geometry1.spatialReference.toJson());this.distanceUnit&&(k.distanceUnit=this.distanceUnit);this.geodesic&&(k.geodesic=this.geodesic);return k}});v("extend-esri")&&n.setObject("tasks.DistanceParameters",m,t);return m})},"esri/tasks/PrintTask":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/json dojo/_base/Deferred dojo/has ../kernel ../lang ../layerUtils ../deferredUtils ../Color ../urlUtils ./Task ../geometry/Polygon ../renderers/SimpleRenderer ../symbols/FillSymbol ./Geoprocessor ./PrintTemplate dojo/dom-attr dojo/dom-construct dojox/gfx/_base dojox/gfx/canvas dojox/json/query dojo/has!extend-esri?./PrintParameters dojo/has!extend-esri?./LegendLayer".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,a,f,l,y,F,B,A,z){m=m(x,{declaredClass:"esri.tasks.PrintTask",constructor:function(a,b){this.url=a;this.printGp=new f(this.url);this._handler=n.hitch(this,this._handler);b&&b.async&&(this.async=b.async);this._colorEvaluator=z("$..color")},_vtlExtent:null,_handler:function(a,b,c,d,f){try{var g;this.async?"esriJobSucceeded"===a.jobStatus&&this.printGp.getResultData(a.jobId,"Output_File",n.hitch(this,function(a){g=a.value;this._successHandler([g],"onComplete",c,
f)})):(g=a[0].value,this._successHandler([g],"onComplete",c,f))}catch(K){this._errorHandler(K,d,f)}},execute:function(a,b,c){var f=this._handler,g=this._errorHandler,e=a.template||new l;e.hasOwnProperty("showLabels")||(e.showLabels=!0);var k=e.exportOptions,w;k&&(w={outputSize:[k.width,k.height],dpi:k.dpi});var k=e.layoutOptions,q,m=[];if(k){this.legendAll=!1;k.legendLayers?d.forEach(k.legendLayers,function(a){var b={};b.id=a.layerId;a.subLayerIds&&(b.subLayerIds=a.subLayerIds);m.push(b)}):this.legendAll=
!0;var u,x;if("Miles"===k.scalebarUnit||"Kilometers"===k.scalebarUnit)u="esriKilometers",x="esriMiles";else if("Meters"===k.scalebarUnit||"Feet"===k.scalebarUnit)u="esriMeters",x="esriFeet";q={esriMiles:"mi",esriKilometers:"km",esriFeet:"ft",esriMeters:"m"};q={titleText:k.titleText,authorText:k.authorText,copyrightText:k.copyrightText,customTextElements:k.customTextElements,scaleBarOptions:{metricUnit:u,metricLabel:q[u],nonMetricUnit:x,nonMetricLabel:q[x]},legendOptions:{operationalLayers:m}}}u=this._getPrintDefinition(a.map,
e);a.outSpatialReference&&(u.mapOptions.spatialReference=a.outSpatialReference.toJson());a.template&&r.isDefined(a.template.showAttribution)&&(u.mapOptions.showAttribution=a.template.showAttribution);n.mixin(u,{exportOptions:w,layoutOptions:q});this.allLayerslegend&&n.mixin(u.layoutOptions,{legendOptions:{operationalLayers:this.allLayerslegend}});if(u.operationalLayers){w=u.operationalLayers;var H,y=function(a){return r.fixJson(n.mixin(a,{type:"esriSLS",cap:void 0,join:void 0,meterLimit:void 0}))},
F=RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),B=/[\u0600-\u06FF]/,z=function(a){var b=a.text,c=(a=a.font)&&a.family&&a.family.toLowerCase();b&&a&&("arial"===c||"arial unicode ms"===c)&&(a.family=F.test(b)?"Arial Unicode MS":"Arial","normal"!==a.style&&B.test(b)&&(a.family="Arial Unicode MS"))};for(q=0;q<w.length;q++)if(w[q].featureCollection&&w[q].featureCollection.layers)for(x=0;x<w[q].featureCollection.layers.length;x++){var C=w[q].featureCollection.layers[x];
C.layerDefinition&&C.layerDefinition.drawingInfo&&C.layerDefinition.drawingInfo.renderer&&C.layerDefinition.drawingInfo.renderer.symbol&&(H=C.layerDefinition.drawingInfo.renderer,"esriCLS"===H.symbol.type?H.symbol=y(H.symbol):"esriTS"===H.symbol.type?z(H.symbol):H.symbol.outline&&"esriCLS"===H.symbol.outline.type&&(H.symbol.outline=y(H.symbol.outline)));if(C.featureSet&&C.featureSet.features)for(k=0;k<C.featureSet.features.length;k++)H=C.featureSet.features[k],H.symbol&&("esriCLS"===H.symbol.type?
H.symbol=y(H.symbol):"esriTS"===H.symbol.type?z(H.symbol):H.symbol.outline&&"esriCLS"===H.symbol.outline.type&&(H.symbol.outline=y(H.symbol.outline)))}}e={Web_Map_as_JSON:v.toJson(r.fixJson(u)),Format:e.format,Layout_Template:e.layout};a.extraParameters&&(e=n.mixin(e,a.extraParameters));var D=new t(h._dfdCanceller);a=function(a,d){f(a,d,b,c,D)};u=function(a){g(a,c,D)};D._pendingDfd=this.async?this.printGp.submitJob(e,a,null,u):this.printGp.execute(e,a,u);return D},onComplete:function(){},_createMultipointLayer:function(){return{layerDefinition:{name:"multipointLayer",
geometryType:"esriGeometryMultipoint",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryMultipoint",features:[]}}},_createPolygonLayer:function(){return{layerDefinition:{name:"polygonLayer",geometryType:"esriGeometryPolygon",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPolygon",features:[]}}},_createPointLayer:function(){return{layerDefinition:{name:"pointLayer",geometryType:"esriGeometryPoint",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPoint",
features:[]}}},_createPolylineLayer:function(){return{layerDefinition:{name:"polylineLayer",geometryType:"esriGeometryPolyline",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPolyline",features:[]}}},_convertSvgSymbol:function(a){if(!(8>=e("ie")||!a.path&&"image/svg+xml"!==a.contentType)){var b,c=A.createSurface(F.create("div"),1024,1024);b="image/svg+xml"===a.contentType?c.createObject(A.Image,{src:"data:image/svg+xml;base64,"+a.imageData,width:B.pt2px(a.width),height:B.pt2px(a.height),
x:0,y:0}):c.createObject(A.Path,a.path).setFill(a.color).setStroke(a.outline);"pendingRender"in c&&c._render(!0);var d=c.rawNode.getContext("2d"),f=Math.ceil(b.getBoundingBox().width),g=Math.ceil(b.getBoundingBox().height);b=d.getImageData(b.getBoundingBox().x,b.getBoundingBox().y,f,g);d.canvas.width=f;d.canvas.height=g;d.putImageData(b,0,0);d=d.canvas.toDataURL("image/png");a={type:"esriPMS",imageData:d.substr(22,d.length),angle:a.angle,contentType:"image/png",height:a.size?a.size:B.px2pt(g),width:a.size?
f/g*a.size:B.px2pt(f),xoffset:a.xoffset,yoffset:a.yoffset};c.destroy();return a}},_convertSvgRenderer:function(a){"simple"===a.type&&a.symbol&&(a.symbol.path||"image/svg+xml"===a.symbol.contentType)?a.symbol=this._convertSvgSymbol(a.symbol):"uniqueValue"===a.type?(a.defaultSymbol&&(a.defaultSymbol.path||"image/svg+xml"===a.defaultSymbol.contentType)&&(a.defaultSymbol=this._convertSvgSymbol(a.defaultSymbol)),a.uniqueValueInfos&&d.forEach(a.uniqueValueInfos,function(a){if(a.symbol.path||"image/svg+xml"===
a.symbol.contentType)a.symbol=this._convertSvgSymbol(a.symbol)},this)):"classBreaks"===a.type&&(a.defaultSymbol&&(a.defaultSymbol.path||"image/svg+xml"===a.defaultSymbol.contentType)&&(a.defaultSymbol=this._convertSvgSymbol(a.defaultSymbol)),a.classBreakInfos&&d.forEach(a.classBreakInfos,function(a){if(a.symbol.path||"image/svg+xml"===a.symbol.contentType)a.symbol=this._convertSvgSymbol(a.symbol)},this))},_createFeatureCollection:function(a,c,f){var g=this._createPolygonLayer(),e=this._createPolylineLayer(),
h=this._createPointLayer(),l=this._createMultipointLayer(),k=this._createPointLayer();k.layerDefinition.name="textLayer";delete k.layerDefinition.drawingInfo;if("esri.layers.FeatureLayer"===a.declaredClass||"esri.layers.StreamLayer"===a.declaredClass)g.layerDefinition.name=e.layerDefinition.name=h.layerDefinition.name=l.layerDefinition.name=n.getObject("arcgisProps.title",!1,a)||a.name||a.id;var q=a.renderer&&"esri.renderer.SimpleRenderer"===a.renderer.declaredClass;if(!a.renderer||a.renderer.valueExpression||
n.isFunction(a.renderer.attributeField))delete g.layerDefinition.drawingInfo,delete e.layerDefinition.drawingInfo,delete h.layerDefinition.drawingInfo,delete l.layerDefinition.drawingInfo;else{var w=a.renderer.toJson({useLegacyRotationProperties:!0});if("temporal"===w.type){var w={latestObservationRenderer:w.latestObservationRenderer,trackLinesRenderer:w.trackRenderer,observationAger:w.observationAger,renderer:w.observationRenderer},r={};a._trackIdField&&(r.trackIdField=a._trackIdField);a._startTimeField&&
(r.startTimeField=a._startTimeField);a._endTimeField&&(r.endTimeField=a._endTimeField);g.layerDefinition.drawingInfo=w;g.layerDefinition.timeInfo=r;e.layerDefinition.drawingInfo=w;e.layerDefinition.timeInfo=r;h.layerDefinition.drawingInfo=w;h.layerDefinition.timeInfo=r;l.layerDefinition.drawingInfo=w;l.layerDefinition.timeInfo=r}else g.layerDefinition.drawingInfo.renderer=w,e.layerDefinition.drawingInfo.renderer=w,h.layerDefinition.drawingInfo.renderer=w,l.layerDefinition.drawingInfo.renderer=w}w=
a.fields;w||!a.renderer||a.renderer.valueExpression||n.isFunction(a.renderer.attributeField)||("esri.renderer.ClassBreaksRenderer"===a.renderer.declaredClass?(w=[{name:a.renderer.attributeField,type:"esriFieldTypeDouble"}],a.renderer.normalizationField&&w.push({name:a.renderer.normalizationField,type:"esriFieldTypeDouble"})):"esri.renderer.UniqueValueRenderer"===a.renderer.declaredClass&&(w=[{name:a.renderer.attributeField,type:"esriFieldTypeString"}],a.renderer.attributeField2&&w.push({name:a.renderer.attributeField2,
type:"esriFieldTypeString"}),a.renderer.attributeField3&&w.push({name:a.renderer.attributeField3,type:"esriFieldTypeString"})));w&&(g.layerDefinition.fields=w,e.layerDefinition.fields=w,h.layerDefinition.fields=w,l.layerDefinition.fields=w);w=a.graphics;a.isFeatureReductionActive&&a.isFeatureReductionActive()&&(w=a.getSingleGraphics());var r=w.length,m,u;for(u=0;u<r;u++){var t=w[u];if(!1!==t.visible&&t.geometry){m=t.toJson();m.symbol&&m.symbol.outline&&m.symbol.outline.color&&m.symbol.outline.color[3]&&
(m.symbol.outline.color[3]=255);if(a.renderer&&!m.symbol&&(n.isFunction(a.renderer.attributeField)||a.renderer.valueExpression||this._isFeatureCollectionRequired(a.renderer,a)||"esri.renderer.DotDensityRenderer"===a.renderer.declaredClass||f)){f=f||a.renderer;var v=null;try{v=f.getSymbol(t)}catch(V){}if(!v)continue;m.symbol=v.toJson();this._isFeatureCollectionRequired(f,a)&&this._applyVisualVariables(m.symbol,{renderer:f,graphic:t,symbol:v,mapResolution:c&&c.getResolutionInMeters(),mapScale:c&&c.getScale()})}m.symbol&&
(m.symbol.path||"image/svg+xml"===m.symbol.contentType?m.symbol=this._convertSvgSymbol(m.symbol):m.symbol.text&&delete m.attributes);switch(t.geometry.type){case "polygon":g.featureSet.features.push(m);break;case "polyline":e.featureSet.features.push(m);break;case "point":m.symbol&&m.symbol.text?k.featureSet.features.push(m):h.featureSet.features.push(m);break;case "multipoint":l.featureSet.features.push(m);break;case "extent":m.geometry=b.fromExtent(t.geometry).toJson(),g.featureSet.features.push(m)}}}c=
[];0<g.featureSet.features.length&&c.push(g);0<e.featureSet.features.length&&c.push(e);0<l.featureSet.features.length&&c.push(l);0<h.featureSet.features.length&&c.push(h);0<k.featureSet.features.length&&c.push(k);if(!c.length)return null;d.forEach(c,function(a){var b=d.every(a.featureSet.features,function(a){return a.symbol});if(q||b)d.forEach(a.featureSet.features,function(a){delete a.attributes}),delete a.layerDefinition.fields;b&&delete a.layerDefinition.drawingInfo});d.forEach(c,function(a){a.layerDefinition.drawingInfo&&
a.layerDefinition.drawingInfo.renderer&&this._convertSvgRenderer(a.layerDefinition.drawingInfo.renderer)},this);return{id:a.id,opacity:a.opacity,minScale:a.minScale||0,maxScale:a.maxScale||0,featureCollection:{layers:c}}},_getPrintDefinition:function(a,b){var c={operationalLayers:this._createOperationalLayers(a,b)},d=this._vtlExtent||a.extent,f=a.spatialReference;this._vtlExtent=null;a.spatialReference._isWrappable()&&(d=d._normalize(!0),f=d.spatialReference);d={mapOptions:{showAttribution:a.showAttribution,
extent:d.toJson(),spatialReference:f.toJson()}};b.preserveScale&&n.mixin(d.mapOptions,{scale:b.outScale||a.getScale()});a.timeExtent&&n.mixin(d.mapOptions,{time:[a.timeExtent.startTime.getTime(),a.timeExtent.endTime.getTime()]});f={};n.mixin(f,d,c);return f},_createOperationalLayers:function(a,b){var f,e,h,l,k=[],m=0;b.preserveScale&&(m=b.outScale||a.getScale());this.allLayerslegend=this.legendAll?[]:null;this._vtlExtent=null;var q=d.map(a.layerIds,a.getLayer,a);a._mapImageLyr&&q.push(a._mapImageLyr);
for(f=0;f<q.length;f++)if(e=q[f],e.loaded&&e.visible&&(!m||e.isVisibleAtScale(m)))switch(h=e.declaredClass,l={id:e.id,title:n.getObject("arcgisProps.title",!1,e)||e.id,opacity:e.opacity,minScale:e.minScale||0,maxScale:e.maxScale||0},l=n.mixin(l,this._getUrlAndToken(e)),e.getNode()&&y.get(e.getNode(),"data-reference")&&(l._isRefLayer=!0),h){case "esri.layers.ArcGISDynamicMapServiceLayer":var r=[];h=!!e._params.layers;if(e._params.dynamicLayers)h=v.fromJson(e._params.dynamicLayers),d.forEach(h,function(a){r.push({id:a.id,
name:a.name,layerDefinition:a});delete a.id;delete a.name;delete a.maxScale;delete a.minScale}),0===r.length&&(l.visibleLayers=[-1]);else if(e.supportsDynamicLayers){if(h||e.layerDefinitions||e.layerTimeOptions){var w=e.createDynamicLayerInfosFromLayerInfos(),t=null;h&&(t=e.visibleLayers);var t=c._getVisibleLayers(w,t),x=c._getLayersForScale(b.outScale||a.getScale(),w);d.forEach(w,function(a){if(!a.subLayerIds){var b=a.id;-1<d.indexOf(t,b)&&-1<d.indexOf(x,b)&&(a={source:a.source.toJson()},e.layerDefinitions&&
e.layerDefinitions[b]&&(a.definitionExpression=e.layerDefinitions[b]),e.layerTimeOptions&&e.layerTimeOptions[b]&&(a.layerTimeOptions=e.layerTimeOptions[b].toJson()),r.push({id:b,layerDefinition:a}))}});0===r.length&&(l.visibleLayers=[-1])}}else d.forEach(e.layerInfos,function(a){var b={id:a.id,layerDefinition:{}};e.layerDefinitions&&e.layerDefinitions[a.id]&&(b.layerDefinition.definitionExpression=e.layerDefinitions[a.id]);e.layerTimeOptions&&e.layerTimeOptions[a.id]&&(b.layerDefinition.layerTimeOptions=
e.layerTimeOptions[a.id].toJson());(b.layerDefinition.definitionExpression||b.layerDefinition.layerTimeOptions)&&r.push(b)}),h&&(l.visibleLayers=e.visibleLayers);r.length&&(l.layers=r);k.push(l);this.allLayerslegend&&this.allLayerslegend.push({id:e.id,subLayerIds:e.visibleLayers});break;case "esri.layers.ArcGISImageServiceLayer":l=n.mixin(l,{url:e.url,bandIds:e.bandIds,compressionQuality:e.compressionQuality,format:e.format,interpolation:e.interpolation});e.mosaicRule&&n.mixin(l,{mosaicRule:e.mosaicRule.toJson()});
(e.renderingRule||e.renderer)&&(h=e.getExportImageRenderingRule())&&n.mixin(l,{renderingRule:h.toJson()});k.push(l);this.allLayerslegend&&this.allLayerslegend.push({id:e.id});break;case "esri.layers.WMSLayer":l=n.mixin(l,{url:e.url,title:e.title,type:"wms",version:e.version,transparentBackground:e.imageTransparency,visibleLayers:e.visibleLayers});k.push(l);this.allLayerslegend&&this.allLayerslegend.push({id:e.id,subLayerIds:e.visibleLayers});break;case "esri.virtualearth.VETiledLayer":h=e.mapStyle;
"roadOnDemand"===h?h="Road":"aerialWithLabelsOnDemand"===h&&(h="Hybrid");l=n.mixin(l,{visibility:e.visible,type:"BingMaps"+h,culture:e.culture,key:e.bingMapsKey});k.push(l);break;case "esri.layers.OpenStreetMapLayer":l=n.mixin(l,{credits:e.copyright,type:"OpenStreetMap",url:u.getAbsoluteUrl(e.tileServers[0])});k.push(l);break;case "esri.layers.WMTSLayer":l=n.mixin(l,{url:e.url,type:"wmts",layer:e._identifier,style:e._style,format:e.format,tileMatrixSet:e._tileMatrixSetId});k.push(l);break;case "esri.layers.MapImageLayer":h=
e.getImages();d.forEach(h,function(a,b){a.visible&&a.href&&(l={id:e.id+"_image"+b,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:e.opacity*a.opacity,extent:a.extent.toJson()},"data:image/png;base64,"===a.href.substr(0,22)?l.imageData=a.href.substr(22):l.url=a.href,k.push(l))});break;case "esri.layers.VectorTileLayer":l.type="image";l.url&&delete l.url;h=this._vtlExtent||a.extent.offset(0,0);var F=b.exportOptions&&b.exportOptions.dpi||96,w={format:"png",pixelRatio:F/
96};"MAP_ONLY"!==b.layout||!b.preserveScale||b.outScale&&b.outScale!==a.getScale()||96!==F||!b.exportOptions||b.exportOptions.width%2===a.width%2&&b.exportOptions.height%2===a.height%2||(w.area={x:0,y:0,width:a.width,height:a.height},b.exportOptions.width%2!==a.width%2&&--w.area.width,b.exportOptions.height%2!==a.height%2&&--w.area.height,this._vtlExtent||(F=a.toMap({x:w.area.width,y:w.area.height}),h.update(h.xmin,F.y,F.x,h.ymax,h.spatialReference),this._vtlExtent=h));l.extent=h._normalize(!0).toJson();
h=e.takeScreenshot(w);h.isResolved()?h.then(function(a){"data:image/png;base64,"===a.dataURL.substr(0,22)&&(l.imageData=a.dataURL.substr(22))}):console.error("PrintTask: VectorTileLayer.takeScreenshot() returned an unresolved Promise");l.imageData&&k.push(l);break;case "esri.layers.WebTiledLayer":h=e.url.replace(/\$\{/g,"{");l=n.mixin(l,{type:"WebTiledLayer",urlTemplate:h,credits:e.copyright});e.subDomains&&0<e.subDomains.length&&(l.subDomains=e.subDomains);e._wmtsInfo&&(l.wmtsInfo=e._wmtsInfo);delete l.url;
k.push(l);break;default:if(e.getTileUrl||e.getImageUrl)l=n.mixin(l,{url:e.url}),k.push(l)}q=d.map(a.graphicsLayerIds,a.getLayer,a);for(f=0;f<q.length;f++)e=q[f],e.isFeatureReductionActive&&e.isFeatureReductionActive()&&(e.getSingleGraphics().length?q.splice(++f,0,e.getFeatureReductionLayer()):q[f]=e.getFeatureReductionLayer());for(f=0;f<q.length;f++)if(e=q[f],e.loaded&&e.visible&&(!m||e.isVisibleAtScale(m)))switch(h=e.declaredClass,h){case "esri.layers.FeatureLayer":case "esri.layers.LabelLayer":case "esri.layers.CSVLayer":case "esri.layers.StreamLayer":if("esri.layers.LabelLayer"===
h&&!b.showLabels||e.renderer&&"esri.renderer.HeatmapRenderer"===e.renderer.declaredClass)continue;h=null;e.url&&e.renderer&&("esri.renderer.ScaleDependentRenderer"===e.renderer.declaredClass?"scale"===e.renderer.rangeType?h=e.renderer.getRendererInfoByScale(a.getScale())&&e.renderer.getRendererInfoByScale(a.getScale()).renderer:"zoom"===e.renderer.rangeType&&(h=e.renderer.getRendererInfoByZoom(a.getZoom())&&e.renderer.getRendererInfoByZoom(a.getZoom()).renderer):h=e.renderer);if(h&&("esri.renderer.SimpleRenderer"===
h.declaredClass||"esri.renderer.TemporalRenderer"===h.declaredClass||n.isString(h.attributeField)&&e._getField(h.attributeField,!0))&&!h.valueExpression&&!this._isFeatureCollectionRequired(h,e)&&"esri.renderer.DotDensityRenderer"!==h.declaredClass&&"esri.layers.CSVLayer"!==e.declaredClass&&"esri.layers.StreamLayer"!==e.declaredClass)if(l={id:e.id,title:n.getObject("arcgisProps.title",!1,e)||e.id,opacity:e.opacity,minScale:e.minScale||0,maxScale:e.maxScale||0,layerDefinition:{drawingInfo:{renderer:h.toJson({useLegacyRotationProperties:!0})}}},
l=n.mixin(l,this._getUrlAndToken(e)),"esri.renderer.TemporalRenderer"===h.declaredClass&&(w=l.layerDefinition.drawingInfo,w.latestObservationRenderer=w.renderer.latestObservationRenderer,w.trackLinesRenderer=w.renderer.trackRenderer,w.observationAger=w.renderer.observationAger,w.renderer=w.renderer.observationRenderer,e._trackIdField&&(l.layerDefinition.timeInfo={trackIdField:e._trackIdField})),this._convertSvgRenderer(l.layerDefinition.drawingInfo.renderer),1>e.opacity||"esri.renderer.TemporalRenderer"===
h.declaredClass||this._updateLayerOpacity(l))if(e._params.source&&(h=e._params.source.toJson(),n.mixin(l.layerDefinition,{source:h})),e.getDefinitionExpression()&&n.mixin(l.layerDefinition,{definitionExpression:e.getDefinitionExpression()}),2!==e.mode)0<e.getSelectedFeatures().length&&(h=d.map(e.getSelectedFeatures(),function(a){return a.attributes[e.objectIdField]}),0<h.length&&e.getSelectionSymbol()&&n.mixin(l,{selectionObjectIds:h,selectionSymbol:e.getSelectionSymbol().toJson()}));else{h=d.map(e.getSelectedFeatures(),
function(a){return a.attributes[e.objectIdField]});if(0===h.length||!e._params.drawMode)break;n.mixin(l.layerDefinition,{objectIds:h});h=null;e.getSelectionSymbol()&&(h=new g(e.getSelectionSymbol()));n.mixin(l.layerDefinition.drawingInfo,{renderer:h&&h.toJson()})}else l=this._createFeatureCollection(e,a);else l=h&&(h.valueExpression||this._isFeatureCollectionRequired(h,e)||"esri.renderer.DotDensityRenderer"===h.declaredClass)?this._createFeatureCollection(e,a,h):this._createFeatureCollection(e,a);
if(!l)continue;k.push(l);this.allLayerslegend&&this.allLayerslegend.push({id:e.id});break;case "esri.layers._GraphicsLayer":case "esri.layers.GraphicsLayer":case "esri.layers.WFSLayer":l=this._createFeatureCollection(e,a);if(!l)continue;k.push(l);this.allLayerslegend&&this.allLayerslegend.push({id:e.id});break;case "esri.layers.ArcGISImageServiceVectorLayer":l={id:e.id,title:n.getObject("arcgisProps.title",!1,e)||e.id,opacity:e.opacity,minScale:e.minScale||0,maxScale:e.maxScale||0,visibility:e.visible,
symbolTileSize:e.symbolTileSize,layerDefinition:{drawingInfo:{renderer:e.renderer.toJson({useLegacyRotationProperties:!0})}}},l=n.mixin(l,this._getUrlAndToken(e)),e.mosaicRule&&n.mixin(l,{mosaicRule:e.mosaicRule.toJson()}),k.push(l),this.allLayerslegend&&this.allLayerslegend.push({id:e.id})}m&&d.forEach(k,function(a){a.minScale=0;a.maxScale=0});a.graphics&&0<a.graphics.graphics.length&&(l=this._createFeatureCollection(a.graphics,a))&&k.push(l);a._labels&&b.showLabels&&(l=this._createFeatureCollection(a._labels,
a))&&k.push(l);d.forEach(k,function(a,b,c){a._isRefLayer&&(delete a._isRefLayer,c.splice(b,1),c.push(a))});return k},_getUrlAndToken:function(a){return{token:a._getToken(),url:a._url?a._url.path:null}},_updateLayerOpacity:function(a){var b=this._colorEvaluator(a),b=d.filter(b,function(a){return n.isArray(a)&&4===a.length}),c=!0;if(b.length){var f=b[0][3],e;for(e=1;e<b.length;e++)if(f!==b[e][3]){c=!1;break}if(c)for(a.opacity=f/255,e=0;e<b.length;e++)b[e][3]=255}return c},_isFeatureCollectionRequired:function(a,
b){if(b&&b.isFeatureReductionActive&&b.isFeatureReductionActive())return!0;var c=!1,d=this._getVariable(a,"rotationInfo",!1);d&&(c=(c=d.field)&&n.isFunction(c)||d.valueExpression);return a.hasVisualVariables("sizeInfo")||a.hasVisualVariables("colorInfo")||a.hasVisualVariables("opacityInfo")||c},_getVariable:function(a,b,c){var d;a&&(d=(a=a.getVisualVariablesForType(b,c))&&a[0]);return d},_applyVisualVariables:function(b,c){var d=c.renderer,f=c.graphic,e=c.symbol,g=c.mapResolution,h=c.mapScale,l=e.type;
if("textsymbol"!==l&&"shieldlabelsymbol"!==l){var k=this._getVariable(d,"sizeInfo",!1),m=this._getVariable(d,"colorInfo",!1),r=this._getVariable(d,"opacityInfo",!1),w=this._getVariable(d,"rotationInfo",!1);e instanceof a&&(k=this._getVariable(d,"sizeInfo","outline")||k);g=k?d.getSize(f,{sizeInfo:k,shape:"simplemarkersymbol"===l?e.style:null,resolution:g,scale:h}):f.size;null!=g&&("simplemarkersymbol"===l?b.size=B.px2pt(g):"picturemarkersymbol"===l?(h=e.width/e.height*g,b.width=B.px2pt(h),b.height=
B.px2pt(g),0!==e.xoffset&&(b.xoffset=B.px2pt(e.xoffset/e.width*h)),0!==e.yoffset&&(b.yoffset=B.px2pt(e.yoffset/e.height*g))):"simplelinesymbol"===l?b.width=B.px2pt(g):b.outline&&(b.outline.width=B.px2pt(g)));m&&(!(e=d.getColor(f,{colorInfo:m}))||"simplemarkersymbol"!==l&&"simplelinesymbol"!==l&&"simplefillsymbol"!==l||(b.color=q.toJsonColor(e)));r&&(l=d.getOpacity(f,{opacityInfo:r}),null!=l&&b.color&&(b.color[3]=Math.round(255*l)));w&&(d=d.getRotationAngle(f,{rotationInfo:w}))&&(b.angle=-d)}}});e("extend-esri")&&
n.setObject("tasks.PrintTask",m,k);return m})},"esri/tasks/Geoprocessor":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/Deferred dojo/_base/json dojo/has dojo/io-query ../kernel ../request ../deferredUtils ../geometry/normalizeUtils ./Task ./FeatureSet ./JobInfo ./GPMessage ./LinearUnit ./DataFile ./RasterData ./Date ./ParameterValue ./GPResultImageLayer ../layers/ArcGISDynamicMapServiceLayer ../layers/MapImage".split(" "),function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,
a,f,l,y,F,B,A,z){m=m(u,{declaredClass:"esri.tasks.Geoprocessor",_eventMap:{"execute-complete":["results","messages"],"get-result-data-complete":["result"],"get-result-image-complete":["mapImage"],"get-result-image-layer-complete":["layer"],"job-cancel":["jobInfo"],"job-complete":["jobInfo"],"status-update":["jobInfo"]},constructor:function(a){this._jobUpdateHandler=n.hitch(this,this._jobUpdateHandler);this._getJobStatus=n.hitch(this,this._getJobStatus);this._getResultDataHandler=n.hitch(this,this._getResultDataHandler);
this._getResultImageHandler=n.hitch(this,this._getResultImageHandler);this._executeHandler=n.hitch(this,this._executeHandler);this._updateTimers=[];this.registerConnectEvents()},updateDelay:1E3,processSpatialReference:null,outputSpatialReference:null,outSpatialReference:null,setUpdateDelay:function(a){this.updateDelay=a},setProcessSpatialReference:function(a){this.processSpatialReference=a},setOutputSpatialReference:function(a){this._setOutSR(a)},setOutSpatialReference:function(a){this._setOutSR(a)},
__msigns:[{n:"execute",c:3,a:[{i:0,p:["*"]}],e:2,f:1},{n:"submitJob",c:4,a:[{i:0,p:["*"]}],e:3}],_setOutSR:function(a){this.outSpatialReference=this.outputSpatialReference=a},_getOutSR:function(){return this.outSpatialReference||this.outputSpatialReference},_gpEncode:function(a,b,c){for(var f in a){var e=a[f];n.isArray(e)?a[f]=t.toJson(d.map(e,function(a){return this._gpEncode({item:a},!0).item},this)):e instanceof Date&&(a[f]=e.getTime())}return this._encode(a,b,c)},_decode:function(b){var c=b.dataType,
e=new F(b);if(-1!==d.indexOf(["GPBoolean","GPDouble","GPLong","GPString"],c))return e;if("GPLinearUnit"===c)e.value=new a(e.value);else if("GPFeatureRecordSetLayer"===c||"GPRecordSet"===c)e.value=new x(e.value);else if("GPDataFile"===c)e.value=new f(e.value);else if("GPDate"===c)b=e.value,n.isString(b)?e.value=new y({date:b}):e.value=new Date(b);else if("GPRasterData"===c||"GPRasterDataLayer"===c)b=b.value.mapImage,e.value=b?new z(b):new l(e.value);else if(-1!==c.indexOf("GPMultiValue:")){var g=c.split(":")[1];
b=e.value;e.value=d.map(b,function(a){return this._decode({paramName:"_name",dataType:g,value:a}).value},this)}else console.log(this.declaredClass+" : GP Data type not handled. : "+e.dataType),e=null;return e},submitJob:function(a,b,d,f,e){var g=this._getOutSR(),h=e.assembly;a=this._gpEncode(n.mixin({},this._url.query,{f:"json","env:outSR":g?g.wkid||t.toJson(g.toJson()):null,"env:processSR":this.processSpatialReference?this.processSpatialReference.wkid||t.toJson(this.processSpatialReference.toJson()):
null},a),null,h&&h[0]);var l=this._jobUpdateHandler,k=this._errorHandler;return c({url:this._url.path+"/submitJob",content:a,callbackParamName:"callback",load:function(a,c){l(a,c,!1,b,d,e.dfd)},error:function(a){k(a,f,e.dfd)}})},_jobUpdateHandler:function(a,c,d,f,e,g){var h=a.jobId;c=new b(a);this._successHandler([c],"onStatusUpdate",e,d&&g);if(!d)switch(clearTimeout(this._updateTimers[h]),this._updateTimers[h]=null,g&&g.progress(c),a.jobStatus){case b.STATUS_SUBMITTED:case b.STATUS_EXECUTING:case b.STATUS_WAITING:case b.STATUS_NEW:var l=
this._getJobStatus;this._updateTimers[h]=setTimeout(function(){l(h,d,f,e,g)},this.updateDelay);break;default:this._successHandler([c],"onJobComplete",f,g)}},_getJobStatus:function(a,b,d,f,e){var g=this._jobUpdateHandler;c({url:this._url.path+"/jobs/"+a,content:n.mixin({},this._url.query,{f:"json"}),callbackParamName:"callback",load:function(a,c){g(a,c,b,d,f,e)},error:this._errorHandler})},_getResultDataHandler:function(a,b,c,d,f){try{var e=this._decode(a);this._successHandler([e],"onGetResultDataComplete",
c,f)}catch(K){this._errorHandler(K,d,f)}},getResultData:function(a,b,d,f){var e=this._getResultDataHandler,g=this._errorHandler,l=new v(h._dfdCanceller);l._pendingDfd=c({url:this._url.path+"/jobs/"+a+"/results/"+b,content:n.mixin({},this._url.query,{f:"json",returnType:"data"}),callbackParamName:"callback",load:function(a,b){e(a,b,d,f,l)},error:function(a){g(a,f,l)}});return l},checkJobStatus:function(a,b,d){var f=this._jobUpdateHandler,e=this._errorHandler,g=new v(h._dfdCanceller);g._pendingDfd=
c({url:this._url.path+"/jobs/"+a,content:n.mixin({},this._url.query,{f:"json"}),callbackParamName:"callback",load:function(a,c){f(a,c,!0,null,b,g)},error:function(a){e(a,d,g)}});return g},cancelJob:function(a,b,d){var f=this._errorHandler,e=new v(h._dfdCanceller);e._pendingDfd=c({url:this._url.path+"/jobs/"+a+"/cancel",content:n.mixin({},this._url.query,{f:"json"}),callbackParamName:"callback",load:n.hitch(this,function(a,c){this._successHandler([a],"onJobCancel",b,e)}),error:function(a){f(a,d,e)}});
return e},execute:function(a,b,d,f){var e=this._getOutSR(),g=f.assembly;a=this._gpEncode(n.mixin({},this._url.query,{f:"json","env:outSR":e?e.wkid||t.toJson(e.toJson()):null,"env:processSR":this.processSpatialReference?this.processSpatialReference.wkid||t.toJson(this.processSpatialReference.toJson()):null},a),null,g&&g[0]);var h=this._executeHandler,l=this._errorHandler;return c({url:this._url.path+"/execute",content:a,callbackParamName:"callback",load:function(a,c){h(a,c,b,d,f.dfd)},error:function(a){l(a,
d,f.dfd)}})},_executeHandler:function(a,b,c,d,f){try{var e=a.results,h,l,k=a.messages;h=0;for(l=e.length;h<l;h++)e[h]=this._decode(e[h]);h=0;for(l=k.length;h<l;h++)k[h]=new g(k[h]);this._successHandler([e,k],"onExecuteComplete",c,f)}catch(P){this._errorHandler(P,d,f)}},_getResultImageHandler:function(a,b,c,d,f){try{var e=this._decode(a);this._successHandler([e],"onGetResultImageComplete",c,f)}catch(K){this._errorHandler(K,d,f)}},getResultImage:function(a,b,d,f,e){var g=this._getResultImageHandler,
l=this._errorHandler;d=this._gpEncode(n.mixin({},this._url.query,{f:"json"},d.toJson()));var k=new v(h._dfdCanceller);k._pendingDfd=c({url:this._url.path+"/jobs/"+a+"/results/"+b,content:d,callbackParamName:"callback",load:function(a,b){g(a,b,f,e,k)},error:function(a){l(a,e,k)}});return k},cancelJobStatusUpdates:function(a){clearTimeout(this._updateTimers[a]);this._updateTimers[a]=null},getResultImageLayer:function(a,b,c,d){if(null==b){var f=this._url.path.indexOf("/GPServer/");a=this._url.path.substring(0,
f)+"/MapServer/jobs/"+a}else a=this._url.path+"/jobs/"+a+"/results/"+b;this._url.query&&(a+="?"+k.objectToQuery(this._url.query));b=null==b?new A(a,{imageParameters:c}):new B(a,{imageParameters:c},!0);this.onGetResultImageLayerComplete(b);d&&d(b);return b},onStatusUpdate:function(){},onJobComplete:function(){},onExecuteComplete:function(){},onGetResultDataComplete:function(){},onGetResultImageComplete:function(){},onGetResultImageLayerComplete:function(){},onJobCancel:function(){}});q._createWrappers(m);
e("extend-esri")&&n.setObject("tasks.Geoprocessor",m,r);return m})},"esri/tasks/JobInfo":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel","./GPMessage"],function(m,n,d,v,t){m=m(null,{declaredClass:"esri.tasks.JobInfo",constructor:function(d){this.messages=[];n.mixin(this,d);d=this.messages;var e,m=d.length;for(e=0;e<m;e++)d[e]=new t(d[e])},jobId:"",jobStatus:""});n.mixin(m,{STATUS_CANCELLED:"esriJobCancelled",STATUS_CANCELLING:"esriJobCancelling",STATUS_DELETED:"esriJobDeleted",
STATUS_DELETING:"esriJobDeleting",STATUS_EXECUTING:"esriJobExecuting",STATUS_FAILED:"esriJobFailed",STATUS_NEW:"esriJobNew",STATUS_SUBMITTED:"esriJobSubmitted",STATUS_SUCCEEDED:"esriJobSucceeded",STATUS_TIMED_OUT:"esriJobTimedOut",STATUS_WAITING:"esriJobWaiting"});d("extend-esri")&&n.setObject("tasks.JobInfo",m,v);return m})},"esri/tasks/GPMessage":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel"],function(m,n,d,v){m=m(null,{declaredClass:"esri.tasks.GPMessage",constructor:function(d){n.mixin(this,
d)}});n.mixin(m,{TYPE_INFORMATIVE:"esriJobMessageTypeInformative",TYPE_PROCESS_DEFINITION:"esriJobMessageTypeProcessDefinition",TYPE_PROCESS_START:"esriJobMessageTypeProcessStart",TYPE_PROCESS_STOP:"esriJobMessageTypeProcessStop",TYPE_WARNING:"esriJobMessageTypeWarning",TYPE_ERROR:"esriJobMessageTypeError",TYPE_EMPTY:"esriJobMessageTypeEmpty",TYPE_ABORT:"esriJobMessageTypeAbort"});d("extend-esri")&&n.setObject("tasks.GPMessage",m,v);return m})},"esri/tasks/LinearUnit":function(){define(["dojo/_base/declare",
"dojo/_base/lang","dojo/has","../kernel"],function(m,n,d,v){m=m(null,{declaredClass:"esri.tasks.LinearUnit",constructor:function(d){d&&n.mixin(this,d)},distance:0,units:null,toJson:function(){var d={};this.distance&&(d.distance=this.distance);this.units&&(d.units=this.units);return d}});d("extend-esri")&&n.setObject("tasks.LinearUnit",m,v);return m})},"esri/tasks/DataFile":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel"],function(m,n,d,v){m=m(null,{declaredClass:"esri.tasks.DataFile",
constructor:function(d){d&&n.mixin(this,d)},url:null,itemID:null,toJson:function(){var d={};this.url&&(d.url=this.url);this.itemID&&(d.itemID=this.itemID);return d}});d("extend-esri")&&n.setObject("tasks.DataFile",m,v);return m})},"esri/tasks/RasterData":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel"],function(m,n,d,v){m=m(null,{declaredClass:"esri.tasks.RasterData",constructor:function(d){d&&n.mixin(this,d)},url:null,format:null,itemID:null,toJson:function(){var d=
{};this.url&&(d.url=this.url);this.format&&(d.format=this.format);this.itemID&&(d.itemID=this.itemID);return d}});d("extend-esri")&&n.setObject("tasks.RasterData",m,v);return m})},"esri/tasks/Date":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/date/locale","dojo/has","../kernel"],function(m,n,d,v,t){m=m(null,{declaredClass:"esri.tasks.Date",constructor:function(e){e&&(e.format&&(this.format=e.format),this.date=d.parse(e.date,{selector:"date",datePattern:this.format}))},date:new Date,
format:"EEE MMM dd HH:mm:ss zzz yyyy",toJson:function(){return{date:d.format(this.date,{selector:"date",datePattern:this.format}),format:this.format}}});v("extend-esri")&&n.setObject("tasks.Date",m,t);return m})},"esri/tasks/ParameterValue":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel"],function(m,n,d,v){m=m(null,{declaredClass:"esri.tasks.ParameterValue",constructor:function(d){n.mixin(this,d)}});d("extend-esri")&&n.setObject("tasks.ParameterValue",m,v);return m})},
"esri/tasks/GPResultImageLayer":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/json dojo/has dojo/io-query ../kernel ../layers/ArcGISDynamicMapServiceLayer".split(" "),function(m,n,d,v,t,e,k){m=m(k,{declaredClass:"esri.tasks._GPResultImageLayer",constructor:function(d,c){c&&c.imageParameters&&c.imageParameters.extent&&(this.initialExtent=this.fullExtent=c.imageParameters.extent,this.spatialReference=this.initialExtent.spatialReference);this.getImageUrl=n.hitch(this,this.getImageUrl);
this.loaded=!0;this.onLoad(this)},getImageUrl:function(e,c,h,k){var m=e.spatialReference.wkid;k(this._url.path+"?"+t.objectToQuery(n.mixin(this._params,{f:"image",bbox:d.toJson(e.toJson()),bboxSR:m,imageSR:m,size:c+","+h})))}});v("extend-esri")&&n.setObject("tasks._GPResultImageLayer",m,e);return m})},"esri/tasks/PrintTemplate":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel"],function(m,n,d,v){m=m(null,{declaredClass:"esri.tasks.PrintTemplate",label:null,exportOptions:{width:800,
height:1100,dpi:96},layoutOptions:null,format:"PNG32",layout:"MAP_ONLY",outScale:0,preserveScale:!0,showAttribution:null,showLabels:!0});d("extend-esri")&&n.setObject("tasks.PrintTemplate",m,v);return m})},"dojox/gfx/canvas":function(){define("./_base dojo/_base/lang dojo/_base/array dojo/_base/declare dojo/_base/window dojo/dom-geometry dojo/dom ./shape ./path ./arc ./matrix ./decompose ./bezierutils".split(" "),function(m,n,d,v,t,e,k,r,c,h,q,u,x){function b(a,b,c,d,f,e,g,h,l,k){var m,q,r=b.length,
u=0;k?(q=k.l/f,u=k.i):q=b[0]/f;for(;e<g;)e+q>g&&(m={l:(e+q-g)*f,i:u},q=g-e),u%2||(a.beginPath(),a.arc(c,d,f,e,e+q,h),l&&a.stroke()),e+=q,++u,q=b[u%r]/f;return m}function g(a,b,c,d){var f=0,e=0,g,h=0;d?(g=d.l,h=d.i):g=b[0];for(;1>e;)e=x.tAtLength(a,g),1==e&&(f=x.computeLength(a),f={l:g-f,i:h}),a=x.splitBezierAtT(a,e),h%2||c.push(a[0]),a=a[1],++h,g=b[h%b.length];return f}function a(a,b,c,d){var f=[b.last.x,b.last.y].concat(c),e=!(a instanceof Array);c=4===c.length?"quadraticCurveTo":"bezierCurveTo";
var h=[];b=g(f,b.canvasDash,h,d);for(d=0;d<h.length;++d)f=h[d],e?(a.moveTo(f[0],f[1]),a[c].apply(a,f.slice(2))):(a.push("moveTo",[f[0],f[1]]),a.push(c,f.slice(2)));return b}function f(a,b,c,d,f,e,g){var h=0,l=0,k=0,m=x.distance(c,d,f,e),q=0;b=b.canvasDash;var r=c,u=d,n,t=!(a instanceof Array);g?(k=g.l,q=g.i):k+=b[0];for(;.01<Math.abs(1-l);)k>m&&(h={l:k-m,i:q},k=m),l=k/m,g=c+(f-c)*l,n=d+(e-d)*l,q++%2||(t?(a.moveTo(r,u),a.lineTo(g,n)):(a.push("moveTo",[r,u]),a.push("lineTo",[g,n]))),r=g,u=n,k+=b[q%
b.length];return h}var l=m.canvas={},y=null,F=q.multiplyPoint,B=Math.PI,A=2*B,z=B/2;u=n.extend;if(t.global.CanvasRenderingContext2D){t=t.doc.createElement("canvas").getContext("2d");var w="function"==typeof t.setLineDash,D="function"==typeof t.fillText}var C={solid:"none",shortdash:[4,1],shortdot:[1,1],shortdashdot:[4,1,1,1],shortdashdotdot:[4,1,1,1,1,1],dot:[1,3],dash:[4,3],longdash:[8,3],dashdot:[4,3,1,3],longdashdot:[8,3,1,3],longdashdotdot:[8,3,1,3,1,3]};l.Shape=v("dojox.gfx.canvas.Shape",r.Shape,
{_render:function(a){a.save();this._renderTransform(a);this._renderClip(a);this._renderShape(a);this._renderFill(a,!0);this._renderStroke(a,!0);a.restore()},_renderClip:function(a){this.canvasClip&&(this.canvasClip.render(a),a.clip())},_renderTransform:function(a){if("canvasTransform"in this){var b=this.canvasTransform;a.translate(b.dx,b.dy);a.rotate(b.angle2);a.scale(b.sx,b.sy);a.rotate(b.angle1)}},_renderShape:function(a){},_renderFill:function(a,b){if("canvasFill"in this){var c=this.fillStyle;
if("canvasFillImage"in this){var d=c.width,f=c.height,e=this.canvasFillImage.width,g=this.canvasFillImage.height,h=Math.min(d==e?1:d/e,f==g?1:f/g),l=(d-h*e)/2,k=(f-h*g)/2;y.width=d;y.height=f;var m=y.getContext("2d");m.clearRect(0,0,d,f);m.drawImage(this.canvasFillImage,0,0,e,g,l,k,h*e,h*g);this.canvasFill=a.createPattern(y,"repeat");delete this.canvasFillImage}a.fillStyle=this.canvasFill;b&&("pattern"!==c.type||0===c.x&&0===c.y||a.translate(c.x,c.y),a.fill())}else a.fillStyle="rgba(0,0,0,0.0)"},
_renderStroke:function(a,b){var c=this.strokeStyle;c?(a.strokeStyle=c.color.toString(),a.lineWidth=c.width,a.lineCap=c.cap,"number"==typeof c.join?(a.lineJoin="miter",a.miterLimit=c.join):a.lineJoin=c.join,this.canvasDash?w?(a.setLineDash(this.canvasDash),b&&a.stroke()):this._renderDashedStroke(a,b):b&&a.stroke()):b||(a.strokeStyle="rgba(0,0,0,0.0)")},_renderDashedStroke:function(a,b){},getEventSource:function(){return null},on:function(){},connect:function(){},disconnect:function(){},canvasClip:null,
setClip:function(a){this.inherited(arguments);var b=a?"width"in a?"rect":"cx"in a?"ellipse":"points"in a?"polyline":"d"in a?"path":null:null;if(a&&!b)return this;this.canvasClip=a?E(b,a):null;this.parent&&this.parent._makeDirty();return this}});var E=function(a,b){switch(a){case "ellipse":return{canvasEllipse:I({shape:b}),render:function(a){return l.Ellipse.prototype._renderShape.call(this,a)}};case "rect":return{shape:n.delegate(b,{r:0}),render:function(a){return l.Rect.prototype._renderShape.call(this,
a)}};case "path":return{canvasPath:O(b),render:function(a){this.canvasPath._renderShape(a)}};case "polyline":return{canvasPolyline:b.points,render:function(a){return l.Polyline.prototype._renderShape.call(this,a)}}}return null},O=function(a){var b=new dojox.gfx.canvas.Path;b.canvasPath=[];b._setPath(a.d);return b},J=function(a,b,c){var d=a.prototype[b];a.prototype[b]=c?function(){this.parent&&this.parent._makeDirty();d.apply(this,arguments);c.call(this);return this}:function(){this.parent&&this.parent._makeDirty();
return d.apply(this,arguments)}};J(l.Shape,"setTransform",function(){this.matrix?this.canvasTransform=m.decompose(this.matrix):delete this.canvasTransform});J(l.Shape,"setFill",function(){var a=this.fillStyle,b;if(a){if("object"==typeof a&&"type"in a){var c=this.surface.rawNode.getContext("2d");switch(a.type){case "linear":case "radial":b="linear"==a.type?c.createLinearGradient(a.x1,a.y1,a.x2,a.y2):c.createRadialGradient(a.cx,a.cy,0,a.cx,a.cy,a.r);d.forEach(a.colors,function(a){b.addColorStop(a.offset,
m.normalizeColor(a.color).toString())});break;case "pattern":y||(y=document.createElement("canvas")),c=new Image,this.surface.downloadImage(c,a.src),this.canvasFillImage=c}}else b=a.toString();this.canvasFill=b}else delete this.canvasFill});J(l.Shape,"setStroke",function(){var a=this.strokeStyle;if(a){var b=this.strokeStyle.style.toLowerCase();b in C&&(b=C[b]);if(b instanceof Array){this.canvasDash=b=b.slice();var c;for(c=0;c<b.length;++c)b[c]*=a.width;if("butt"!=a.cap){for(c=0;c<b.length;c+=2)b[c]-=
a.width,1>b[c]&&(b[c]=1);for(c=1;c<b.length;c+=2)b[c]+=a.width}}else delete this.canvasDash}else delete this.canvasDash;this._needsDash=!w&&!!this.canvasDash});J(l.Shape,"setShape");l.Group=v("dojox.gfx.canvas.Group",l.Shape,{constructor:function(){r.Container._init.call(this)},_render:function(a){a.save();this._renderTransform(a);this._renderClip(a);for(var b=0;b<this.children.length;++b)this.children[b]._render(a);a.restore()},destroy:function(){r.Container.clear.call(this,!0);l.Shape.prototype.destroy.apply(this,
arguments)}});l.Rect=v("dojox.gfx.canvas.Rect",[l.Shape,r.Rect],{_renderShape:function(a){var b=this.shape,c=Math.min(b.r,b.height/2,b.width/2),d=b.x,f=d+b.width,e=b.y,b=e+b.height,g=d+c,h=f-c,l=e+c,k=b-c;a.beginPath();a.moveTo(g,e);c?(a.arc(h,l,c,-z,0,!1),a.arc(h,k,c,0,z,!1),a.arc(g,k,c,z,B,!1),a.arc(g,l,c,B,B+z,!1)):(a.lineTo(h,e),a.lineTo(f,k),a.lineTo(g,b),a.lineTo(d,l));a.closePath()},_renderDashedStroke:function(a,c){var d=this.shape,e=Math.min(d.r,d.height/2,d.width/2),g=d.x,h=g+d.width,l=
d.y,k=l+d.height,m=g+e,q=h-e,r=l+e,u=k-e;e?(a.beginPath(),d=f(a,this,m,l,q,l),c&&a.stroke(),d=b(a,this.canvasDash,q,r,e,-z,0,!1,c,d),a.beginPath(),d=f(a,this,h,r,h,u,d),c&&a.stroke(),d=b(a,this.canvasDash,q,u,e,0,z,!1,c,d),a.beginPath(),d=f(a,this,q,k,m,k,d),c&&a.stroke(),d=b(a,this.canvasDash,m,u,e,z,B,!1,c,d),a.beginPath(),d=f(a,this,g,u,g,r,d),c&&a.stroke(),b(a,this.canvasDash,m,r,e,B,B+z,!1,c,d)):(a.beginPath(),d=f(a,this,m,l,q,l),d=f(a,this,q,l,h,u,d),d=f(a,this,h,u,m,k,d),f(a,this,m,k,g,r,d),
c&&a.stroke())}});var K=[];(function(){var a=h.curvePI4;K.push(a.s,a.c1,a.c2,a.e);for(var b=45;360>b;b+=45){var c=q.rotateg(b);K.push(F(c,a.c1),F(c,a.c2),F(c,a.e))}})();var I=function(a){var b,c,d,f=[],e=a.shape,h=q.normalize([q.translate(e.cx,e.cy),q.scale(e.rx,e.ry)]);b=F(h,K[0]);f.push([b.x,b.y]);for(e=1;e<K.length;e+=3)c=F(h,K[e]),d=F(h,K[e+1]),b=F(h,K[e+2]),f.push([c.x,c.y,d.x,d.y,b.x,b.y]);if(a._needsDash){b=[];c=f[0];for(e=1;e<f.length;++e)d=[],g(c.concat(f[e]),a.canvasDash,d),c=[f[e][4],f[e][5]],
b.push(d);a._dashedPoints=b}return f};l.Ellipse=v("dojox.gfx.canvas.Ellipse",[l.Shape,r.Ellipse],{setShape:function(){this.inherited(arguments);this.canvasEllipse=I(this);return this},setStroke:function(){this.inherited(arguments);w||(this.canvasEllipse=I(this));return this},_renderShape:function(a){var b=this.canvasEllipse,c;a.beginPath();a.moveTo.apply(a,b[0]);for(c=1;c<b.length;++c)a.bezierCurveTo.apply(a,b[c]);a.closePath()},_renderDashedStroke:function(a,b){var c=this._dashedPoints;a.beginPath();
for(var d=0;d<c.length;++d)for(var f=c[d],e=0;e<f.length;++e){var g=f[e];a.moveTo(g[0],g[1]);a.bezierCurveTo(g[2],g[3],g[4],g[5],g[6],g[7])}b&&a.stroke()}});l.Circle=v("dojox.gfx.canvas.Circle",[l.Shape,r.Circle],{_renderShape:function(a){var b=this.shape;a.beginPath();a.arc(b.cx,b.cy,b.r,0,A,1)},_renderDashedStroke:function(a,b){var c=this.shape,d=0,f,e=this.canvasDash.length;for(i=0;d<A;)f=this.canvasDash[i%e]/c.r,i%2||(a.beginPath(),a.arc(c.cx,c.cy,c.r,d,d+f,0),b&&a.stroke()),d+=f,++i}});l.Line=
v("dojox.gfx.canvas.Line",[l.Shape,r.Line],{_renderShape:function(a){var b=this.shape;a.beginPath();a.moveTo(b.x1,b.y1);a.lineTo(b.x2,b.y2)},_renderDashedStroke:function(a,b){var c=this.shape;a.beginPath();f(a,this,c.x1,c.y1,c.x2,c.y2);b&&a.stroke()}});l.Polyline=v("dojox.gfx.canvas.Polyline",[l.Shape,r.Polyline],{setShape:function(){this.inherited(arguments);var a=this.shape.points,b=a[0],c,d;this.bbox=null;this._normalizePoints();if(a.length)if("number"==typeof b)b=a;else for(b=[],d=0;d<a.length;++d)c=
a[d],b.push(c.x,c.y);else b=[];this.canvasPolyline=b;return this},_renderShape:function(a){var b=this.canvasPolyline;if(b.length){a.beginPath();a.moveTo(b[0],b[1]);for(var c=2;c<b.length;c+=2)a.lineTo(b[c],b[c+1])}},_renderDashedStroke:function(a,b){var c=this.canvasPolyline,d=0;a.beginPath();for(var e=0;e<c.length;e+=2)d=f(a,this,c[e],c[e+1],c[e+2],c[e+3],d);b&&a.stroke()}});l.Image=v("dojox.gfx.canvas.Image",[l.Shape,r.Image],{setShape:function(){this.inherited(arguments);var a=new Image;this.surface.downloadImage(a,
this.shape.src);this.canvasImage=a;return this},_renderShape:function(a){var b=this.shape;a.drawImage(this.canvasImage,b.x,b.y,b.width,b.height)}});l.Text=v("dojox.gfx.canvas.Text",[l.Shape,r.Text],{_setFont:function(){this.fontStyle?this.canvasFont=m.makeFontString(this.fontStyle):delete this.canvasFont},getTextWidth:function(){var a=this.shape,b=0,c;a.text&&(c=this.surface.rawNode.getContext("2d"),c.save(),this._renderTransform(c),this._renderFill(c,!1),this._renderStroke(c,!1),this.canvasFont&&
(c.font=this.canvasFont),b=c.measureText(a.text).width,c.restore());return b},_render:function(a){a.save();this._renderTransform(a);this._renderFill(a,!1);this._renderStroke(a,!1);this._renderShape(a);a.restore()},_renderShape:function(a){var b=this.shape;b.text&&(a.textAlign="middle"===b.align?"center":b.align,this.canvasFont&&(a.font=this.canvasFont),this.canvasFill&&a.fillText(b.text,b.x,b.y),this.strokeStyle&&(a.beginPath(),a.strokeText(b.text,b.x,b.y),a.closePath()))}});J(l.Text,"setFont");D||
l.Text.extend({getTextWidth:function(){return 0},getBoundingBox:function(){return null},_renderShape:function(){}});var X={M:"_moveToA",m:"_moveToR",L:"_lineToA",l:"_lineToR",H:"_hLineToA",h:"_hLineToR",V:"_vLineToA",v:"_vLineToR",C:"_curveToA",c:"_curveToR",S:"_smoothCurveToA",s:"_smoothCurveToR",Q:"_qCurveToA",q:"_qCurveToR",T:"_qSmoothCurveToA",t:"_qSmoothCurveToR",A:"_arcTo",a:"_arcTo",Z:"_closePath",z:"_closePath"};l.Path=v("dojox.gfx.canvas.Path",[l.Shape,c.Path],{constructor:function(){this.lastControl=
{}},setShape:function(){this.canvasPath=[];this._dashedPath=[];return this.inherited(arguments)},setStroke:function(){this.inherited(arguments);w||(this.segmented=!1,this._confirmSegmented());return this},_setPath:function(){this._dashResidue=null;this.inherited(arguments)},_updateWithSegment:function(a){var b=n.clone(this.last);this[X[a.action]](this.canvasPath,a.action,a.args,this._needsDash?this._dashedPath:null);this.last=b;this.inherited(arguments)},_renderShape:function(a){var b=this.canvasPath;
a.beginPath();for(var c=0;c<b.length;c+=2)a[b[c]].apply(a,b[c+1])},_renderDashedStroke:w?function(){}:function(a,b){var c=this._dashedPath;a.beginPath();for(var d=0;d<c.length;d+=2)a[c[d]].apply(a,c[d+1]);b&&a.stroke()},_moveToA:function(a,b,c,d){a.push("moveTo",[c[0],c[1]]);d&&d.push("moveTo",[c[0],c[1]]);for(b=2;b<c.length;b+=2)a.push("lineTo",[c[b],c[b+1]]),d&&(this._dashResidue=f(d,this,c[b-2],c[b-1],c[b],c[b+1],this._dashResidue));this.last.x=c[c.length-2];this.last.y=c[c.length-1];this.lastControl=
{}},_moveToR:function(a,b,c,d){b="x"in this.last?[this.last.x+=c[0],this.last.y+=c[1]]:[this.last.x=c[0],this.last.y=c[1]];a.push("moveTo",b);d&&d.push("moveTo",b);for(b=2;b<c.length;b+=2)a.push("lineTo",[this.last.x+=c[b],this.last.y+=c[b+1]]),d&&(this._dashResidue=f(d,this,d[d.length-1][0],d[d.length-1][1],this.last.x,this.last.y,this._dashResidue));this.lastControl={}},_lineToA:function(a,b,c,d){for(b=0;b<c.length;b+=2)d&&(this._dashResidue=f(d,this,this.last.x,this.last.y,c[b],c[b+1],this._dashResidue)),
a.push("lineTo",[c[b],c[b+1]]);this.last.x=c[c.length-2];this.last.y=c[c.length-1];this.lastControl={}},_lineToR:function(a,b,c,d){for(b=0;b<c.length;b+=2)a.push("lineTo",[this.last.x+=c[b],this.last.y+=c[b+1]]),d&&(this._dashResidue=f(d,this,d[d.length-1][0],d[d.length-1][1],this.last.x,this.last.y,this._dashResidue));this.lastControl={}},_hLineToA:function(a,b,c,d){for(b=0;b<c.length;++b)a.push("lineTo",[c[b],this.last.y]),d&&(this._dashResidue=f(d,this,d[d.length-1][0],d[d.length-1][1],c[b],this.last.y,
this._dashResidue));this.last.x=c[c.length-1];this.lastControl={}},_hLineToR:function(a,b,c,d){for(b=0;b<c.length;++b)a.push("lineTo",[this.last.x+=c[b],this.last.y]),d&&(this._dashResidue=f(d,this,d[d.length-1][0],d[d.length-1][1],this.last.x,this.last.y,this._dashResidue));this.lastControl={}},_vLineToA:function(a,b,c,d){for(b=0;b<c.length;++b)a.push("lineTo",[this.last.x,c[b]]),d&&(this._dashResidue=f(d,this,d[d.length-1][0],d[d.length-1][1],this.last.x,c[b],this._dashResidue));this.last.y=c[c.length-
1];this.lastControl={}},_vLineToR:function(a,b,c,d){for(b=0;b<c.length;++b)a.push("lineTo",[this.last.x,this.last.y+=c[b]]),d&&(this._dashResidue=f(d,this,d[d.length-1][0],d[d.length-1][1],this.last.x,this.last.y,this._dashResidue));this.lastControl={}},_curveToA:function(b,c,d,f){for(c=0;c<d.length;c+=6)b.push("bezierCurveTo",d.slice(c,c+6)),f&&(this._dashResidue=a(f,this,b[b.length-1],this._dashResidue));this.last.x=d[d.length-2];this.last.y=d[d.length-1];this.lastControl.x=d[d.length-4];this.lastControl.y=
d[d.length-3];this.lastControl.type="C"},_curveToR:function(b,c,d,f){for(c=0;c<d.length;c+=6)b.push("bezierCurveTo",[this.last.x+d[c],this.last.y+d[c+1],this.lastControl.x=this.last.x+d[c+2],this.lastControl.y=this.last.y+d[c+3],this.last.x+d[c+4],this.last.y+d[c+5]]),f&&(this._dashResidue=a(f,this,b[b.length-1],this._dashResidue)),this.last.x+=d[c+4],this.last.y+=d[c+5];this.lastControl.type="C"},_smoothCurveToA:function(b,c,d,f){for(c=0;c<d.length;c+=4){var e="C"==this.lastControl.type;b.push("bezierCurveTo",
[e?2*this.last.x-this.lastControl.x:this.last.x,e?2*this.last.y-this.lastControl.y:this.last.y,d[c],d[c+1],d[c+2],d[c+3]]);f&&(this._dashResidue=a(f,this,b[b.length-1],this._dashResidue));this.lastControl.x=d[c];this.lastControl.y=d[c+1];this.lastControl.type="C"}this.last.x=d[d.length-2];this.last.y=d[d.length-1]},_smoothCurveToR:function(b,c,d,f){for(c=0;c<d.length;c+=4){var e="C"==this.lastControl.type;b.push("bezierCurveTo",[e?2*this.last.x-this.lastControl.x:this.last.x,e?2*this.last.y-this.lastControl.y:
this.last.y,this.last.x+d[c],this.last.y+d[c+1],this.last.x+d[c+2],this.last.y+d[c+3]]);f&&(this._dashResidue=a(f,this,b[b.length-1],this._dashResidue));this.lastControl.x=this.last.x+d[c];this.lastControl.y=this.last.y+d[c+1];this.lastControl.type="C";this.last.x+=d[c+2];this.last.y+=d[c+3]}},_qCurveToA:function(b,c,d,f){for(c=0;c<d.length;c+=4)b.push("quadraticCurveTo",d.slice(c,c+4));f&&(this._dashResidue=a(f,this,b[b.length-1],this._dashResidue));this.last.x=d[d.length-2];this.last.y=d[d.length-
1];this.lastControl.x=d[d.length-4];this.lastControl.y=d[d.length-3];this.lastControl.type="Q"},_qCurveToR:function(b,c,d,f){for(c=0;c<d.length;c+=4)b.push("quadraticCurveTo",[this.lastControl.x=this.last.x+d[c],this.lastControl.y=this.last.y+d[c+1],this.last.x+d[c+2],this.last.y+d[c+3]]),f&&(this._dashResidue=a(f,this,b[b.length-1],this._dashResidue)),this.last.x+=d[c+2],this.last.y+=d[c+3];this.lastControl.type="Q"},_qSmoothCurveToA:function(b,c,d,f){for(c=0;c<d.length;c+=2){var e="Q"==this.lastControl.type;
b.push("quadraticCurveTo",[this.lastControl.x=e?2*this.last.x-this.lastControl.x:this.last.x,this.lastControl.y=e?2*this.last.y-this.lastControl.y:this.last.y,d[c],d[c+1]]);f&&(this._dashResidue=a(f,this,b[b.length-1],this._dashResidue));this.lastControl.type="Q"}this.last.x=d[d.length-2];this.last.y=d[d.length-1]},_qSmoothCurveToR:function(b,c,d,f){for(c=0;c<d.length;c+=2){var e="Q"==this.lastControl.type;b.push("quadraticCurveTo",[this.lastControl.x=e?2*this.last.x-this.lastControl.x:this.last.x,
this.lastControl.y=e?2*this.last.y-this.lastControl.y:this.last.y,this.last.x+d[c],this.last.y+d[c+1]]);f&&(this._dashResidue=a(f,this,b[b.length-1],this._dashResidue));this.lastControl.type="Q";this.last.x+=d[c];this.last.y+=d[c+1]}},_arcTo:function(b,c,f,e){c="a"==c;for(var g=0;g<f.length;g+=7){var l=f[g+5],k=f[g+6];c&&(l+=this.last.x,k+=this.last.y);var m=h.arcAsBezier(this.last,f[g],f[g+1],f[g+2],f[g+3]?1:0,f[g+4]?1:0,l,k);d.forEach(m,function(a){b.push("bezierCurveTo",a)});e&&(this._dashResidue=
a(e,this,p,this._dashResidue));this.last.x=l;this.last.y=k}this.lastControl={}},_closePath:function(a,b,c,d){a.push("closePath",[]);d&&(this._dashResidue=f(d,this,this.last.x,this.last.y,d[1][0],d[1][1],this._dashResidue));this.lastControl={}}});d.forEach("moveTo lineTo hLineTo vLineTo curveTo smoothCurveTo qCurveTo qSmoothCurveTo arcTo closePath".split(" "),function(a){J(l.Path,a)});l.TextPath=v("dojox.gfx.canvas.TextPath",[l.Shape,c.TextPath],{_renderShape:function(a){},_setText:function(){},_setFont:function(){}});
l.Surface=v("dojox.gfx.canvas.Surface",r.Surface,{constructor:function(){r.Container._init.call(this);this.pendingImageCount=0;this.makeDirty()},destroy:function(){r.Container.clear.call(this,!0);this.inherited(arguments)},setDimensions:function(a,b){this.width=m.normalizedLength(a);this.height=m.normalizedLength(b);if(!this.rawNode)return this;var c=!1;this.rawNode.width!=this.width&&(this.rawNode.width=this.width,c=!0);this.rawNode.height!=this.height&&(this.rawNode.height=this.height,c=!0);c&&
this.makeDirty();return this},getDimensions:function(){return this.rawNode?{width:this.rawNode.width,height:this.rawNode.height}:null},_render:function(a){!this.rawNode||!a&&this.pendingImageCount||(a=this.rawNode.getContext("2d"),a.clearRect(0,0,this.rawNode.width,this.rawNode.height),this.render(a),"pendingRender"in this&&(clearTimeout(this.pendingRender),delete this.pendingRender))},render:function(a){a.save();for(var b=0;b<this.children.length;++b)this.children[b]._render(a);a.restore()},makeDirty:function(){this.pendingImagesCount||
"pendingRender"in this||this._batch||(this.pendingRender=setTimeout(n.hitch(this,this._render),0))},downloadImage:function(a,b){var c=n.hitch(this,this.onImageLoad);!this.pendingImageCount++&&"pendingRender"in this&&(clearTimeout(this.pendingRender),delete this.pendingRender);a.onload=c;a.onerror=c;a.onabort=c;a.src=b},onImageLoad:function(){--this.pendingImageCount||(this.onImagesLoaded(),this._render())},onImagesLoaded:function(){},getEventSource:function(){return null},connect:function(){},disconnect:function(){},
on:function(){}});l.createSurface=function(a,b,c){if(!b&&!c){var d=e.position(a);b=b||d.w;c=c||d.h}"number"==typeof b&&(b+="px");"number"==typeof c&&(c+="px");d=new l.Surface;a=k.byId(a);var f=a.ownerDocument.createElement("canvas");f.width=m.normalizedLength(b);f.height=m.normalizedLength(c);a.appendChild(f);d.rawNode=f;d._parent=a;return d.surface=d};var P=r.Container;v={openBatch:function(){++this._batch;return this},closeBatch:function(){this._batch=0<this._batch?--this._batch:0;this._makeDirty();
return this},_makeDirty:function(){this._batch||this.surface.makeDirty()},add:function(a){this._makeDirty();return P.add.apply(this,arguments)},remove:function(a,b){this._makeDirty();return P.remove.apply(this,arguments)},clear:function(){this._makeDirty();return P.clear.apply(this,arguments)},getBoundingBox:P.getBoundingBox,_moveChildToFront:function(a){this._makeDirty();return P._moveChildToFront.apply(this,arguments)},_moveChildToBack:function(a){this._makeDirty();return P._moveChildToBack.apply(this,
arguments)}};c={createObject:function(a,b){var c=new a;c.surface=this.surface;c.setShape(b);this.add(c);return c}};u(l.Group,v);u(l.Group,r.Creator);u(l.Group,c);u(l.Surface,v);u(l.Surface,r.Creator);u(l.Surface,c);l.fixTarget=function(a,b){return!0};return l})},"dojox/gfx/shape":function(){define("./_base dojo/_base/lang dojo/_base/declare dojo/_base/kernel dojo/_base/sniff dojo/on dojo/_base/array dojo/dom-construct dojo/_base/Color ./matrix".split(" "),function(m,n,d,v,t,e,k,r,c,h){function q(b,
c){if(!u)return b.splice(c,1);var a=b.length;if(a){for(;c<a;)b[c]=b[c+1],c++;b.length--}}var u=!!t("chrome"),x=m.shape={};x.Shape=d("dojox.gfx.shape.Shape",null,{constructor:function(){this.parentMatrix=this.parent=this.bbox=this.strokeStyle=this.fillStyle=this.matrix=this.shape=this.rawNode=null;if(t("gfxRegistry")){var b=x.register(this);this.getUID=function(){return b}}},destroy:function(){t("gfxRegistry")&&x.dispose(this);this.rawNode&&"__gfxObject__"in this.rawNode&&(this.rawNode.__gfxObject__=
null);this.rawNode=null},getNode:function(){return this.rawNode},getShape:function(){return this.shape},getTransform:function(){return this.matrix},getFill:function(){return this.fillStyle},getStroke:function(){return this.strokeStyle},getParent:function(){return this.parent},getBoundingBox:function(){return this.bbox},getTransformedBoundingBox:function(){var b=this.getBoundingBox();if(!b)return null;var c=this._getRealMatrix();return[h.multiplyPoint(c,b.x,b.y),h.multiplyPoint(c,b.x+b.width,b.y),
h.multiplyPoint(c,b.x+b.width,b.y+b.height),h.multiplyPoint(c,b.x,b.y+b.height)]},getEventSource:function(){return this.rawNode},setClip:function(b){this.clip=b},getClip:function(){return this.clip},setShape:function(b){this.shape=m.makeParameters(this.shape,b);this.bbox=null;return this},setFill:function(b){if(!b)return this.fillStyle=null,this;var c=null;if("object"==typeof b&&"type"in b)switch(b.type){case "linear":c=m.makeParameters(m.defaultLinearGradient,b);break;case "radial":c=m.makeParameters(m.defaultRadialGradient,
b);break;case "pattern":c=m.makeParameters(m.defaultPattern,b)}else c=m.normalizeColor(b);this.fillStyle=c;return this},setStroke:function(b){if(!b)return this.strokeStyle=null,this;if("string"==typeof b||n.isArray(b)||b instanceof c)b={color:b};b=this.strokeStyle=m.makeParameters(m.defaultStroke,b);b.color=m.normalizeColor(b.color);return this},setTransform:function(b){this.matrix=h.clone(b?h.normalize(b):h.identity);return this._applyTransform()},_applyTransform:function(){return this},moveToFront:function(){var b=
this.getParent();b&&(b._moveChildToFront(this),this._moveToFront());return this},moveToBack:function(){var b=this.getParent();b&&(b._moveChildToBack(this),this._moveToBack());return this},_moveToFront:function(){},_moveToBack:function(){},applyRightTransform:function(b){return b?this.setTransform([this.matrix,b]):this},applyLeftTransform:function(b){return b?this.setTransform([b,this.matrix]):this},applyTransform:function(b){return b?this.setTransform([this.matrix,b]):this},removeShape:function(b){this.parent&&
this.parent.remove(this,b);return this},_setParent:function(b,c){this.parent=b;return this._updateParentMatrix(c)},_updateParentMatrix:function(b){this.parentMatrix=b?h.clone(b):null;return this._applyTransform()},_getRealMatrix:function(){for(var b=this.matrix,c=this.parent;c;)c.matrix&&(b=h.multiply(c.matrix,b)),c=c.parent;return b}});x._eventsProcessing={on:function(b,c){return e(this.getEventSource(),b,x.fixCallback(this,m.fixTarget,c))},connect:function(b,c,a){"on"==b.substring(0,2)&&(b=b.substring(2));
return this.on(b,a?n.hitch(c,a):c)},disconnect:function(b){return b.remove()}};x.fixCallback=function(b,c,a,d){d||(d=a,a=null);if(n.isString(d)){a=a||v.global;if(!a[d])throw['dojox.gfx.shape.fixCallback: scope["',d,'"] is null (scope\x3d"',a,'")'].join("");return function(f){return c(f,b)?a[d].apply(a,arguments||[]):void 0}}return a?function(f){return c(f,b)?d.apply(a,arguments||[]):void 0}:function(f){return c(f,b)?d.apply(a,arguments):void 0}};n.extend(x.Shape,x._eventsProcessing);x.Container={_init:function(){this.children=
[];this._batch=0},openBatch:function(){return this},closeBatch:function(){return this},add:function(b){var c=b.getParent();c&&c.remove(b,!0);this.children.push(b);return b._setParent(this,this._getRealMatrix())},remove:function(b,c){for(var a=0;a<this.children.length;++a)if(this.children[a]==b){c||(b.parent=null,b.parentMatrix=null);q(this.children,a);break}return this},clear:function(b){for(var c,a=0;a<this.children.length;++a)c=this.children[a],c.parent=null,c.parentMatrix=null,b&&c.destroy();this.children=
[];return this},getBoundingBox:function(){if(this.children){var b=null;k.forEach(this.children,function(c){var a=c.getBoundingBox();a&&((c=c.getTransform())&&(a=h.multiplyRectangle(c,a)),b?(b.x=Math.min(b.x,a.x),b.y=Math.min(b.y,a.y),b.endX=Math.max(b.endX,a.x+a.width),b.endY=Math.max(b.endY,a.y+a.height)):b={x:a.x,y:a.y,endX:a.x+a.width,endY:a.y+a.height})});b&&(b.width=b.endX-b.x,b.height=b.endY-b.y);return b}return null},_moveChildToFront:function(b){for(var c=0;c<this.children.length;++c)if(this.children[c]==
b){q(this.children,c);this.children.push(b);break}return this},_moveChildToBack:function(b){for(var c=0;c<this.children.length;++c)if(this.children[c]==b){q(this.children,c);this.children.unshift(b);break}return this}};x.Surface=d("dojox.gfx.shape.Surface",null,{constructor:function(){this._parent=this.rawNode=null;this._nodes=[];this._events=[]},destroy:function(){k.forEach(this._nodes,r.destroy);this._nodes=[];k.forEach(this._events,function(b){b&&b.remove()});this._events=[];this.rawNode=null;
if(t("ie"))for(;this._parent.lastChild;)r.destroy(this._parent.lastChild);else this._parent.innerHTML="";this._parent=null},getEventSource:function(){return this.rawNode},_getRealMatrix:function(){return null},isLoaded:!0,onLoad:function(b){},whenLoaded:function(b,c){var a=n.hitch(b,c);if(this.isLoaded)a(this);else e.once(this,"load",function(b){a(b)})}});n.extend(x.Surface,x._eventsProcessing);x.Rect=d("dojox.gfx.shape.Rect",x.Shape,{constructor:function(b){this.shape=m.getDefault("Rect");this.rawNode=
b},getBoundingBox:function(){return this.shape}});x.Ellipse=d("dojox.gfx.shape.Ellipse",x.Shape,{constructor:function(b){this.shape=m.getDefault("Ellipse");this.rawNode=b},getBoundingBox:function(){if(!this.bbox){var b=this.shape;this.bbox={x:b.cx-b.rx,y:b.cy-b.ry,width:2*b.rx,height:2*b.ry}}return this.bbox}});x.Circle=d("dojox.gfx.shape.Circle",x.Shape,{constructor:function(b){this.shape=m.getDefault("Circle");this.rawNode=b},getBoundingBox:function(){if(!this.bbox){var b=this.shape;this.bbox={x:b.cx-
b.r,y:b.cy-b.r,width:2*b.r,height:2*b.r}}return this.bbox}});x.Line=d("dojox.gfx.shape.Line",x.Shape,{constructor:function(b){this.shape=m.getDefault("Line");this.rawNode=b},getBoundingBox:function(){if(!this.bbox){var b=this.shape;this.bbox={x:Math.min(b.x1,b.x2),y:Math.min(b.y1,b.y2),width:Math.abs(b.x2-b.x1),height:Math.abs(b.y2-b.y1)}}return this.bbox}});x.Polyline=d("dojox.gfx.shape.Polyline",x.Shape,{constructor:function(b){this.shape=m.getDefault("Polyline");this.rawNode=b},setShape:function(b,
c){b&&b instanceof Array?(this.inherited(arguments,[{points:b}]),c&&this.shape.points.length&&this.shape.points.push(this.shape.points[0])):this.inherited(arguments,[b]);return this},_normalizePoints:function(){var b=this.shape.points,c=b&&b.length;if(c&&"number"==typeof b[0]){for(var a=[],d=0;d<c;d+=2)a.push({x:b[d],y:b[d+1]});this.shape.points=a}},getBoundingBox:function(){if(!this.bbox&&this.shape.points.length){for(var b=this.shape.points,c=b.length,a=b[0],d=a.x,e=a.y,h=a.x,k=a.y,m=1;m<c;++m)a=
b[m],d>a.x&&(d=a.x),h<a.x&&(h=a.x),e>a.y&&(e=a.y),k<a.y&&(k=a.y);this.bbox={x:d,y:e,width:h-d,height:k-e}}return this.bbox}});x.Image=d("dojox.gfx.shape.Image",x.Shape,{constructor:function(b){this.shape=m.getDefault("Image");this.rawNode=b},getBoundingBox:function(){return this.shape},setStroke:function(){return this},setFill:function(){return this}});x.Text=d(x.Shape,{constructor:function(b){this.fontStyle=null;this.shape=m.getDefault("Text");this.rawNode=b},getFont:function(){return this.fontStyle},
setFont:function(b){this.fontStyle="string"==typeof b?m.splitFontString(b):m.makeParameters(m.defaultFont,b);this._setFont();return this},getBoundingBox:function(){var b=null;this.getShape().text&&(b=m._base._computeTextBoundingBox(this));return b}});x.Creator={createShape:function(b){switch(b.type){case m.defaultPath.type:return this.createPath(b);case m.defaultRect.type:return this.createRect(b);case m.defaultCircle.type:return this.createCircle(b);case m.defaultEllipse.type:return this.createEllipse(b);
case m.defaultLine.type:return this.createLine(b);case m.defaultPolyline.type:return this.createPolyline(b);case m.defaultImage.type:return this.createImage(b);case m.defaultText.type:return this.createText(b);case m.defaultTextPath.type:return this.createTextPath(b)}return null},createGroup:function(){return this.createObject(m.Group)},createRect:function(b){return this.createObject(m.Rect,b)},createEllipse:function(b){return this.createObject(m.Ellipse,b)},createCircle:function(b){return this.createObject(m.Circle,
b)},createLine:function(b){return this.createObject(m.Line,b)},createPolyline:function(b){return this.createObject(m.Polyline,b)},createImage:function(b){return this.createObject(m.Image,b)},createText:function(b){return this.createObject(m.Text,b)},createPath:function(b){return this.createObject(m.Path,b)},createTextPath:function(b){return this.createObject(m.TextPath,{}).setText(b)},createObject:function(b,c){return null}};return x})},"dojox/gfx/path":function(){define(["./_base","dojo/_base/lang",
"dojo/_base/declare","./matrix","./shape"],function(m,n,d,v,t){t=d("dojox.gfx.path.Path",t.Shape,{constructor:function(d){this.shape=n.clone(m.defaultPath);this.segments=[];this.tbbox=null;this.absolute=!0;this.last={};this.rawNode=d;this.segmented=!1},setAbsoluteMode:function(d){this._confirmSegmented();this.absolute="string"==typeof d?"absolute"==d:d;return this},getAbsoluteMode:function(){this._confirmSegmented();return this.absolute},getBoundingBox:function(){this._confirmSegmented();return this.bbox&&
"l"in this.bbox?{x:this.bbox.l,y:this.bbox.t,width:this.bbox.r-this.bbox.l,height:this.bbox.b-this.bbox.t}:null},_getRealBBox:function(){this._confirmSegmented();if(this.tbbox)return this.tbbox;var d=this.bbox,k=this._getRealMatrix();this.bbox=null;for(var m=0,c=this.segments.length;m<c;++m)this._updateWithSegment(this.segments[m],k);k=this.bbox;this.bbox=d;return this.tbbox=k?[{x:k.l,y:k.t},{x:k.r,y:k.t},{x:k.r,y:k.b},{x:k.l,y:k.b}]:null},getLastPosition:function(){this._confirmSegmented();return"x"in
this.last?this.last:null},_applyTransform:function(){this.tbbox=null;return this.inherited(arguments)},_updateBBox:function(d,k,m){m&&(k=v.multiplyPoint(m,d,k),d=k.x,k=k.y);this.bbox&&"l"in this.bbox?(this.bbox.l>d&&(this.bbox.l=d),this.bbox.r<d&&(this.bbox.r=d),this.bbox.t>k&&(this.bbox.t=k),this.bbox.b<k&&(this.bbox.b=k)):this.bbox={l:d,b:k,r:d,t:k}},_updateWithSegment:function(d,k){var e=d.args,c=e.length,h;switch(d.action){case "M":case "L":case "C":case "S":case "Q":case "T":for(h=0;h<c;h+=2)this._updateBBox(e[h],
e[h+1],k);this.last.x=e[c-2];this.last.y=e[c-1];this.absolute=!0;break;case "H":for(h=0;h<c;++h)this._updateBBox(e[h],this.last.y,k);this.last.x=e[c-1];this.absolute=!0;break;case "V":for(h=0;h<c;++h)this._updateBBox(this.last.x,e[h],k);this.last.y=e[c-1];this.absolute=!0;break;case "m":h=0;"x"in this.last||(this._updateBBox(this.last.x=e[0],this.last.y=e[1],k),h=2);for(;h<c;h+=2)this._updateBBox(this.last.x+=e[h],this.last.y+=e[h+1],k);this.absolute=!1;break;case "l":case "t":for(h=0;h<c;h+=2)this._updateBBox(this.last.x+=
e[h],this.last.y+=e[h+1],k);this.absolute=!1;break;case "h":for(h=0;h<c;++h)this._updateBBox(this.last.x+=e[h],this.last.y,k);this.absolute=!1;break;case "v":for(h=0;h<c;++h)this._updateBBox(this.last.x,this.last.y+=e[h],k);this.absolute=!1;break;case "c":for(h=0;h<c;h+=6)this._updateBBox(this.last.x+e[h],this.last.y+e[h+1],k),this._updateBBox(this.last.x+e[h+2],this.last.y+e[h+3],k),this._updateBBox(this.last.x+=e[h+4],this.last.y+=e[h+5],k);this.absolute=!1;break;case "s":case "q":for(h=0;h<c;h+=
4)this._updateBBox(this.last.x+e[h],this.last.y+e[h+1],k),this._updateBBox(this.last.x+=e[h+2],this.last.y+=e[h+3],k);this.absolute=!1;break;case "A":for(h=0;h<c;h+=7)this._updateBBox(e[h+5],e[h+6],k);this.last.x=e[c-2];this.last.y=e[c-1];this.absolute=!0;break;case "a":for(h=0;h<c;h+=7)this._updateBBox(this.last.x+=e[h+5],this.last.y+=e[h+6],k);this.absolute=!1}var q=[d.action];for(h=0;h<c;++h)q.push(m.formatNumber(e[h],!0));if("string"==typeof this.shape.path)this.shape.path+=q.join("");else for(h=
0,c=q.length;h<c;++h)this.shape.path.push(q[h])},_validSegments:{m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,z:0},_pushSegment:function(d,k){this.tbbox=null;var e=this._validSegments[d.toLowerCase()];"number"==typeof e&&(e?k.length>=e&&(e={action:d,args:k.slice(0,k.length-k.length%e)},this.segments.push(e),this._updateWithSegment(e)):(e={action:d,args:[]},this.segments.push(e),this._updateWithSegment(e)))},_collectArgs:function(d,k){for(var e=0;e<k.length;++e){var c=k[e];"boolean"==typeof c?d.push(c?1:0):
"number"==typeof c?d.push(c):c instanceof Array?this._collectArgs(d,c):"x"in c&&"y"in c&&d.push(c.x,c.y)}},moveTo:function(){this._confirmSegmented();var d=[];this._collectArgs(d,arguments);this._pushSegment(this.absolute?"M":"m",d);return this},lineTo:function(){this._confirmSegmented();var d=[];this._collectArgs(d,arguments);this._pushSegment(this.absolute?"L":"l",d);return this},hLineTo:function(){this._confirmSegmented();var d=[];this._collectArgs(d,arguments);this._pushSegment(this.absolute?
"H":"h",d);return this},vLineTo:function(){this._confirmSegmented();var d=[];this._collectArgs(d,arguments);this._pushSegment(this.absolute?"V":"v",d);return this},curveTo:function(){this._confirmSegmented();var d=[];this._collectArgs(d,arguments);this._pushSegment(this.absolute?"C":"c",d);return this},smoothCurveTo:function(){this._confirmSegmented();var d=[];this._collectArgs(d,arguments);this._pushSegment(this.absolute?"S":"s",d);return this},qCurveTo:function(){this._confirmSegmented();var d=
[];this._collectArgs(d,arguments);this._pushSegment(this.absolute?"Q":"q",d);return this},qSmoothCurveTo:function(){this._confirmSegmented();var d=[];this._collectArgs(d,arguments);this._pushSegment(this.absolute?"T":"t",d);return this},arcTo:function(){this._confirmSegmented();var d=[];this._collectArgs(d,arguments);this._pushSegment(this.absolute?"A":"a",d);return this},closePath:function(){this._confirmSegmented();this._pushSegment("Z",[]);return this},_confirmSegmented:function(){if(!this.segmented){var d=
this.shape.path;this.shape.path=[];this._setPath(d);this.shape.path=this.shape.path.join("");this.segmented=!0}},_setPath:function(d){d=n.isArray(d)?d:d.match(m.pathSvgRegExp);this.segments=[];this.absolute=!0;this.bbox={};this.last={};if(d){for(var e="",r=[],c=d.length,h=0;h<c;++h){var q=d[h],u=parseFloat(q);isNaN(u)?(e&&this._pushSegment(e,r),r=[],e=q):r.push(u)}this._pushSegment(e,r)}},setShape:function(d){this.inherited(arguments,["string"==typeof d?{path:d}:d]);this.segmented=!1;this.segments=
[];m.lazyPathSegmentation||this._confirmSegmented();return this},_2PI:2*Math.PI});d=d("dojox.gfx.path.TextPath",t,{constructor:function(d){"text"in this||(this.text=n.clone(m.defaultTextPath));"fontStyle"in this||(this.fontStyle=n.clone(m.defaultFont))},getText:function(){return this.text},setText:function(d){this.text=m.makeParameters(this.text,"string"==typeof d?{text:d}:d);this._setText();return this},getFont:function(){return this.fontStyle},setFont:function(d){this.fontStyle="string"==typeof d?
m.splitFontString(d):m.makeParameters(m.defaultFont,d);this._setFont();return this}});return m.path={Path:t,TextPath:d}})},"dojox/gfx/arc":function(){define(["./_base","dojo/_base/lang","./matrix"],function(m,n,d){function v(c){var d=Math.cos(c);c=Math.sin(c);var e={x:d+4/3*(1-d),y:c-4/3*d*(1-d)/c};return{s:{x:d,y:-c},c1:{x:e.x,y:-e.y},c2:e,e:{x:d,y:c}}}var t=2*Math.PI,e=Math.PI/4,k=Math.PI/8,r=e+k,c=v(k);return m.arc={unitArcAsBezier:v,curvePI4:c,arcAsBezier:function(h,m,u,n,b,g,a,f){b=!!b;g=!!g;
var l=d._degToRad(n);n=m*m;var q=u*u,x=d.multiplyPoint(d.rotate(-l),{x:(h.x-a)/2,y:(h.y-f)/2}),B=x.x*x.x,A=x.y*x.y;n=Math.sqrt((n*q-n*A-q*B)/(n*A+q*B));isNaN(n)&&(n=0);n={x:n*m*x.y/u,y:-n*u*x.x/m};b==g&&(n={x:-n.x,y:-n.y});n=d.multiplyPoint([d.translate((h.x+a)/2,(h.y+f)/2),d.rotate(l)],n);m=d.normalize([d.translate(n.x,n.y),d.rotate(l),d.scale(m,u)]);n=d.invert(m);h=d.multiplyPoint(n,h);f=d.multiplyPoint(n,a,f);a=Math.atan2(h.y,h.x);n=a-Math.atan2(f.y,f.x);g&&(n=-n);0>n?n+=t:n>t&&(n-=t);u=k;f=c;
u=g?u:-u;h=[];for(b=n;0<b;b-=e)b<r&&(u=b/2,f=v(u),u=g?u:-u,b=0),x=d.normalize([m,d.rotate(a+u)]),g?(n=d.multiplyPoint(x,f.c1),l=d.multiplyPoint(x,f.c2),x=d.multiplyPoint(x,f.e)):(n=d.multiplyPoint(x,f.c2),l=d.multiplyPoint(x,f.c1),x=d.multiplyPoint(x,f.s)),h.push([n.x,n.y,l.x,l.y,x.x,x.y]),a+=2*u;return h}}})},"dojox/gfx/decompose":function(){define(["./_base","dojo/_base/lang","./matrix"],function(m,n,d){function v(c,d){return Math.abs(c-d)<=1E-6*(Math.abs(c)+Math.abs(d))}function t(c,d,e,k){if(!isFinite(c))return e;
if(!isFinite(e))return c;d=Math.abs(d);k=Math.abs(k);return(d*c+k*e)/(d+k)}function e(c){c=d.normalize(c);var e=-c.xx-c.yy,k=c.xx*c.yy-c.xy*c.yx,m=Math.sqrt(e*e-4*k),e=-(e+(0>e?-m:m))/2,k=k/e,m=c.xy/(e-c.xx),n=1,b=c.xy/(k-c.xx),g=1;v(e,k)&&(m=1,b=n=0,g=1);isFinite(m)||(m=1,n=(e-c.xx)/c.xy,isFinite(n)||(m=(e-c.yy)/c.yx,n=1,isFinite(m)||(m=1,n=c.yx/(e-c.yy))));isFinite(b)||(b=1,g=(k-c.xx)/c.xy,isFinite(g)||(b=(k-c.yy)/c.yx,g=1,isFinite(b)||(b=1,g=c.yx/(k-c.yy))));c=Math.sqrt(m*m+n*n);var a=Math.sqrt(b*
b+g*g);isFinite(m/=c)||(m=0);isFinite(n/=c)||(n=0);isFinite(b/=a)||(b=0);isFinite(g/=a)||(g=0);return{value1:e,value2:k,vector1:{x:m,y:n},vector2:{x:b,y:g}}}function k(c,d){var e=0>c.xx*c.yy||0<c.xy*c.yx?-1:1,h=d.angle1=(Math.atan2(c.yx,c.yy)+Math.atan2(-e*c.xy,e*c.xx))/2,e=Math.cos(h),h=Math.sin(h);d.sx=t(c.xx/e,e,-c.xy/h,h);d.sy=t(c.yy/e,e,c.yx/h,h);return d}function r(c,d){var e=0>c.xx*c.yy||0<c.xy*c.yx?-1:1,h=d.angle2=(Math.atan2(e*c.yx,e*c.xx)+Math.atan2(-c.xy,c.yy))/2,e=Math.cos(h),h=Math.sin(h);
d.sx=t(c.xx/e,e,c.yx/h,h);d.sy=t(c.yy/e,e,-c.xy/h,h);return d}return m.decompose=function(c){var h=d.normalize(c);c={dx:h.dx,dy:h.dy,sx:1,sy:1,angle1:0,angle2:0};if(v(h.xy,0)&&v(h.yx,0))return n.mixin(c,{sx:h.xx,sy:h.yy});if(v(h.xx*h.yx,-h.xy*h.yy))return k(h,c);if(v(h.xx*h.xy,-h.yx*h.yy))return r(h,c);var m,u=new d.Matrix2D(h);m=n.mixin(u,{dx:0,dy:0,xy:u.yx,yx:u.xy});u=e([h,m]);m=e([m,h]);u=new d.Matrix2D({xx:u.vector1.x,xy:u.vector2.x,yx:u.vector1.y,yy:u.vector2.y});m=new d.Matrix2D({xx:m.vector1.x,
xy:m.vector1.y,yx:m.vector2.x,yy:m.vector2.y});h=new d.Matrix2D([d.invert(u),h,d.invert(m)]);k(m,c);h.xx*=c.sx;h.yy*=c.sy;r(u,c);h.xx*=c.sx;h.yy*=c.sy;return n.mixin(c,{sx:h.xx,sy:h.yy})}})},"dojox/gfx/bezierutils":function(){define(["./_base"],function(m){m=m.bezierutils={};m.tAtLength=function(k,m){var c=0,h=6==k.length,n=0,r=0,t=h?v:e,b=function(e,a){for(var f=0,g=0;g<e.length-2;g+=2)f+=d(e[g],e[g+1],e[g+2],e[g+3]);g=h?d(k[0],k[1],k[4],k[5]):d(k[0],k[1],k[6],k[7]);f-g>a||n+f>m+a?(++r,f=t(e,.5),
b(f[0],a),Math.abs(n-m)<=a||b(f[1],a)):(n+=f,c+=1/(1<<r))};m&&b(k,.5);return c};var n=m.computeLength=function(e){for(var k=6==e.length,c=0,h=0;h<e.length-2;h+=2)c+=d(e[h],e[h+1],e[h+2],e[h+3]);h=k?d(e[0],e[1],e[4],e[5]):d(e[0],e[1],e[6],e[7]);.1<c-h&&(e=k?v(e,.5):t(e,.5),c=n(e[0],k),c+=n(e[1],k));return c},d=m.distance=function(d,e,c,h){return Math.sqrt((c-d)*(c-d)+(h-e)*(h-e))},v=function(d,e){var c=1-e,h=c*c,k=e*e,m=d[0],n=d[1],b=d[2],g=d[3],a=d[4],f=d[5],l=h*m+2*c*e*b+k*a,h=h*n+2*c*e*g+k*f;return[[m,
n,c*m+e*b,c*n+e*g,l,h],[l,h,c*b+e*a,c*g+e*f,a,f]]},t=function(d,e){var c=1-e,h=c*c,k=h*c,m=e*e,n=m*e,b=d[0],g=d[1],a=d[2],f=d[3],l=d[4],r=d[5],t=d[6],v=d[7],A=k*b+3*h*e*a+3*c*m*l+n*t,k=k*g+3*h*e*f+3*c*m*r+n*v;return[[b,g,c*b+e*a,c*g+e*f,h*b+2*c*e*a+m*l,h*g+2*c*e*f+m*r,A,k],[A,k,h*a+2*c*e*l+m*t,h*f+2*c*e*r+m*v,c*l+e*t,c*r+e*v,t,v]]},e=m.splitBezierAtT=function(d,e){return 6==d.length?v(d,e):t(d,e)};return m})},"dojox/json/query":function(){define(["dojo/_base/kernel","dojo/_base/lang","dojox","dojo/_base/array"],
function(m,n,d){n.getObject("json",!0,d);d.json._slice=function(d,m,e,k){var n=d.length,c=[];e=e||n;m=0>m?Math.max(0,m+n):Math.min(n,m);for(e=0>e?Math.max(0,e+n):Math.min(n,e);m<e;m+=k)c.push(d[m]);return c};d.json._find=function(d,m){function e(c){m&&(!0!==m||c instanceof Array?c[m]&&k.push(c[m]):k.push(c));for(var d in c){var n=c[d];m?n&&"object"==typeof n&&e(n):k.push(n)}}var k=[];if(m instanceof Array){if(1==m.length)return d[m[0]];for(var n=0;n<m.length;n++)k.push(d[m[n]])}else e(d);return k};
d.json._distinctFilter=function(d,m){for(var e=[],k={},n=0,c=d.length;n<c;++n){var h=d[n];m(h,n,d)&&("object"==typeof h&&h?h.__included||(h.__included=!0,e.push(h)):k[h+typeof h]||(k[h+typeof h]=!0,e.push(h)))}n=0;for(c=e.length;n<c;++n)e[n]&&delete e[n].__included;return e};return d.json.query=function(d,m){function e(c,d,b,e,a,f,h,k){return n[k].match(/[\*\?]/)||"~"==h?"/^"+n[k].substring(1,n[k].length-1).replace(/\\([btnfr\\"'])|([^\w\*\?])/g,"\\$1$2").replace(/([\*\?])/g,"[\\w\\W]$1")+("~"==h?
"$/i":"$/")+".test("+d+")":c}var k=0,n=[];d=d.replace(/"(\\.|[^"\\])*"|'(\\.|[^'\\])*'|[\[\]]/g,function(c){k+="["==c?1:"]"==c?-1:0;return"]"==c&&0<k?"`]":'"'==c.charAt(0)||"'"==c.charAt(0)?"`"+(n.push(c)-1):c});var c="";d.replace(/(\]|\)|push|pop|shift|splice|sort|reverse)\s*\(/,function(){throw Error("Unsafe function call");});d=d.replace(/([^<>=]=)([^=])/g,"$1\x3d$2").replace(/@|(\.\s*)?[a-zA-Z\$_]+(\s*:)?/g,function(c){return"."==c.charAt(0)?c:"@"==c?"$obj":(c.match(/:|^(\$|Math|true|false|null)$/)?
"":"$obj.")+c}).replace(/\.?\.?\[(`\]|[^\]])*\]|\?.*|\.\.([\w\$_]+)|\.\*/g,function(d,e,b){return(e=d.match(/^\.?\.?(\[\s*\^?\?|\^?\?|\[\s*==)(.*?)\]?$/))?(b="",d.match(/^\./)&&(c="dojox.json._find("+c,b=",true)"),c=(e[1].match(/\=/)?"dojo.map":e[1].match(/\^/)?"dojox.json._distinctFilter":"dojo.filter")+"("+c,b+",function($obj){return "+e[2]+"})"):(e=d.match(/^\[\s*([\/\\].*)\]/))?".concat().sort(function(a,b){"+e[1].replace(/\s*,?\s*([\/\\])\s*([^,\\\/]+)/g,function(b,a,c){return"var av\x3d "+c.replace(/\$obj/,
"a")+",bv\x3d "+c.replace(/\$obj/,"b")+";if(av\x3ebv||bv\x3d\x3dnull){return "+("/"==a?1:-1)+";}\nif(bv\x3eav||av\x3d\x3dnull){return "+("/"==a?-1:1)+";}\n"})+"return 0;})":(e=d.match(/^\[(-?[0-9]*):(-?[0-9]*):?(-?[0-9]*)\]/))?(c="dojox.json._slice("+c,","+(e[1]||0)+","+(e[2]||0)+","+(e[3]||1)+")"):d.match(/^\.\.|\.\*|\[\s*\*\s*\]|,/)?(c="dojox.json._find("+c,("."==d.charAt(1)?",'"+b+"'":d.match(/,/)?","+d:"")+")"):d}).replace(/(\$obj\s*((\.\s*[\w_$]+\s*)|(\[\s*`([0-9]+)\s*`\]))*)(==|~)\s*`([0-9]+)/g,
e).replace(/`([0-9]+)\s*(==|~)\s*(\$obj\s*((\.\s*[\w_$]+)|(\[\s*`([0-9]+)\s*`\]))*)/g,function(c,d,b,g,a,f,h,k){return e(c,g,a,f,h,k,b,d)});d=c+("$"==d.charAt(0)?"":"$")+d.replace(/`([0-9]+|\])/g,function(c,d){return"]"==d?"]":n[d]});for(var h=eval("1\x26\x26function($,$1,$2,$3,$4,$5,$6,$7,$8,$9){var $obj\x3d$;return "+d+"}"),q=0;q<arguments.length-1;q++)arguments[q]=arguments[q+1];return m?h.apply(this,arguments):h}})},"dojox/main":function(){define(["dojo/_base/kernel"],function(m){return m.dojox})},
"esri/tasks/PrintParameters":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel"],function(m,n,d,v){m=m(null,{declaredClass:"esri.tasks.PrintParameters",map:null,template:null,outSpatialReference:null,extraParameters:null});d("extend-esri")&&n.setObject("tasks.PrintParameters",m,v);return m})},"esri/toolbars/edit":function(){define("require dojo/_base/declare dojo/_base/lang dojo/_base/connect dojo/_base/array dojo/_base/Color dojo/has dojo/dom-construct dojo/dom-style ../kernel ../lang ../sniff ./_toolbar ./_Box ./_GraphicMover ./_VertexEditor ./TextEditor ../symbols/SimpleMarkerSymbol ../symbols/SimpleLineSymbol ../symbols/TextSymbol ../graphic".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,a,f,l,y,F,B){var A=n(x,{declaredClass:"esri.toolbars.Edit",constructor:function(a,b){this._map=a;this._tool=0;if(this._map.loaded)this._scratchGL=a.graphics;else var c=v.connect(this._map,"onLoad",this,function(){v.disconnect(c);c=null;this._scratchGL=this._map.graphics});var f=k("esri-mobile");this._defaultOptions=d.mixin({vertexSymbol:new l(l.STYLE_CIRCLE,f?20:12,new y(y.STYLE_SOLID,new e([0,0,0,.5]),1),new e([128,128,128])),ghostVertexSymbol:new l(l.STYLE_CIRCLE,
f?18:10,new y(y.STYLE_SOLID,new e([0,0,0,.5]),1),new e([255,255,255,.75])),ghostLineSymbol:new y(y.STYLE_DOT,new e([128,128,128]),2),allowDeleteVertices:!0,allowAddVertices:!0,rotateHandleOffset:f?24:16,boxLineSymbol:new y(y.STYLE_DASH,new e([64,64,64]),1),boxHandleSymbol:new l(l.STYLE_SQUARE,f?16:9,new y(y.STYLE_SOLID,new e([0,0,0,.5]),1),new e([255,255,255,.75])),textAnchorSymbol:new l(l.STYLE_CIRCLE,10,null,new e([255,0,0]))},b||{})},activate:function(a,b,c){this.deactivate();this._graphic=b;this._options=
d.mixin(d.mixin({},this._defaultOptions),c||{});var f=A.MOVE;c=A.EDIT_VERTICES;var e=A.SCALE,g=A.ROTATE,h=A.EDIT_TEXT,l=!1,k=!1,m=!1,n=this._map,q=n.spatialReference,r=b.geometry.spatialReference;this._geo=!(!q||!r||q.equals(r)||!q.isWebMercator()||4326!==r.wkid);this._isTextPoint=this._prepareTextSymbolEditing(b,a);(a&f)===f&&(l=this._enableMove(b));f=(a&e)===e;g=(a&g)===g;if(f||g)m=this._enableBoxEditing(b,f,g);(a&c)===c&&(k=this._enableVertexEditing(b));(a&h)===h&&this._enableTextEditing(b);if(!(l||
k||m))throw Error("[esri.toolbars.Edit::activate] Unable to activate the tool. Check if the tool is valid for the given geometry type.");if(this._tool=a)this._mapPanEndHandle=v.connect(n,"onPanEnd",this,this._mapPanEndHandler),this._mapExtChgHandle=v.connect(n,"onExtentChange",this,this._mapExtentChangeHandler),this.onActivate(this._tool,b);n.snappingManager&&(l||k)&&n.snappingManager._startSelectionLayerQuery()},deactivate:function(){this._isTextPoint=null;var a=this._tool,b=this._graphic;if(a){var c=
!!this._modified;this._clear();v.disconnect(this._mapPanEndHandle);v.disconnect(this._mapExtChgHandle);this._graphic=this._geo=this._mapPanEndHandle=this._mapExtChgHandle=null;this.onDeactivate(a,b,{isModified:c});this._map.snappingManager&&this._map.snappingManager._stopSelectionLayerQuery()}},refresh:function(){this._refreshMoveables(!0)},getCurrentState:function(){return{tool:this._tool,graphic:this._graphic,isModified:!!this._modified}},onActivate:function(a,b){},onDeactivate:function(a,b,c){},
onGraphicMoveStart:function(a){},onGraphicFirstMove:function(a){this._modified=!0},onGraphicMove:function(a,b){},onGraphicMoveStop:function(a,b){},onGraphicClick:function(a,b){},onVertexMoveStart:function(a,b){},onVertexFirstMove:function(a,b){this._modified=!0},onVertexMove:function(a,b,c){},onVertexMoveStop:function(a,b,c){},onVertexAdd:function(a,b){this._modified=!0},onVertexClick:function(a,b){},onVertexMouseOver:function(a,b){},onVertexMouseOut:function(a,b){},onVertexDelete:function(a,b){this._modified=
!0},onTextEditStart:function(a,b){},onTextEditEnd:function(a){},onScaleStart:function(a){},onScaleFirstMove:function(a){this._modified=!0},onScale:function(a,b){},onScaleStop:function(a,b){},onRotateStart:function(a){},onRotateFirstMove:function(a){this._modified=!0},onRotate:function(a,b){},onRotateStop:function(a,b){},_eventMap:{activate:["tool","graphic"],deactivate:["tool","graphic","info"],"graphic-move-start":["graphic"],"graphic-first-move":["graphic"],"graphic-move":["graphic","transform"],
"graphic-move-stop":["graphic","transform"],"graphic-click":["graphic","info"],"vertex-move-start":["graphic","vertexinfo"],"vertex-first-move":["graphic","vertexinfo"],"vertex-move":["graphic","vertexinfo","transform"],"vertex-move-stop":["graphic","vertexinfo","transform"],"vertex-add":["graphic","vertexinfo"],"vertex-click":["graphic","vertexinfo"],"vertex-mouse-over":["graphic","vertexinfo"],"vertex-mouse-out":["graphic","vertexinfo"],"vertex-delete":["graphic","vertexinfo"],"scale-start":["graphic"],
"scale-first-move":["graphic"],scale:["graphic","info"],"scale-stop":["graphic","info"],"rotate-start":["graphic"],"rotate-first-move":["graphic"],rotate:["graphic","info"],"rotate-stop":["graphic","info"]},_prepareTextSymbolEditing:function(a,b){if("point"===a.geometry.type||"multipoint"===a.geometry.type){var d=a.getLayer(),f=d.renderer,d=a.symbol||d._getSymbol(a);!d&&(f.hasVisualVariables("sizeInfo",!1)||f.hasVisualVariables("colorInfo",!1)||f.hasVisualVariables("opacityInfo",!1))&&f.addBreak&&
f.infos&&1===f.infos.length&&(d=f.infos[0].symbol||f.defaultSymbol);if(d&&"textsymbol"===d.type){if((b&A.SCALE)===A.SCALE||(b&A.ROTATE)===A.ROTATE||(b&A.EDIT_TEXT)===A.EDIT_TEXT){a.setSymbol(new F(d.toJson()));var e=this;this._textSymbolEditor?(this._textSymbolEditor.createForm(a),this._textSymbolEditor.show()):this._options&&this._options.textSymbolEditor?(this._textSymbolEditor=this._options.textSymbolEditor,this._textSymbolEditor.on("symbol-change",function(){e._boxEditor&&e._boxEditor.refresh()})):
m(["../dijit/SymbolEditor"],function(b){if(!e._textSymbolEditor){var d;d=e._options.textSymbolEditorHolder?r.create("div",null,e._options.textSymbolEditorHolder):r.create("div",null,e._map.root);e._textSymbolEditor=new b({graphic:a},d);b=e._textSymbolEditor.domNode.parentNode.id;c.set(e._textSymbolEditor.domNode,{position:"map_root"===b?"absolute":"relative",left:"map_root"===b?e._map.width/2-100+"px":"5px",top:"20px","z-index":50});e._textSymbolEditor.startup();e._textSymbolEditor.createForm(a);
e._textSymbolEditor.show();e._textSymbolEditor.on("symbol-change",function(){e._boxEditor&&e._boxEditor.refresh()})}})}if((b&A.MOVE)===A.MOVE||(b&A.ROTATE)===A.ROTATE||(b&A.SCALE)===A.SCALE)this._textAnchor=new B(a.geometry,this._options.textAnchorSymbol),this._scratchGL.add(this._textAnchor);return!0}}return!1},_enableMove:function(a){var b=this._map;switch(a.geometry.type){case "point":case "polyline":case "polygon":return this._graphicMover=new g(a,b,this,this._textAnchor),!0}return!1},_enableVertexEditing:function(b){var c=
this._map;switch(b.geometry.type){case "multipoint":case "polyline":case "polygon":return this._vertexEditor=a.create(b,c,this),!0}return!1},_enableBoxEditing:function(a,c,d){var f=this._map,e=a.geometry.type;return"polyline"===e||"polygon"===e||this._isTextPoint?(this._boxEditor=new b(a,f,this,c,d,this._options.uniformScaling,this._isTextPoint),!0):!1},_enableTextEditing:function(a){return this._isTextPoint?(this._textEditor=new f(a,this._map,this),v.connect(this._textEditor,"onEditStart",d.hitch(this,
function(){this._textAnchor&&(this._textAnchor.getLayer().remove(this._textAnchor),this._textAnchor=null);this._map.disableKeyboardNavigation();this._disableMove();this._disableBoxEditing()})),!0):!1},_disableMove:function(){var a=this._graphicMover;a&&(a.destroy(),this._graphicMover=null)},_disableVertexEditing:function(){var a=this._vertexEditor;a&&(a.destroy(),this._vertexEditor=null)},_disableBoxEditing:function(){var a=this._boxEditor;a&&(a.destroy(),this._boxEditor=null)},_disableTextEditing:function(){this._textEditor&&
(this._textEditor.destroy(),this._textEditor=null);this._map.enableKeyboardNavigation()},_disableSymbolEditing:function(){this._textSymbolEditor&&this._textSymbolEditor.hide()},_clear:function(){this._disableMove();this._disableVertexEditing();this._disableBoxEditing();this._disableTextEditing();this._disableSymbolEditing();this._textAnchor&&(this._textAnchor.getLayer().remove(this._textAnchor),this._textAnchor=null);this._tool=0;this._modified=!1},_mapPanEndHandler:function(){this._refreshMoveables()},
_mapExtentChangeHandler:function(a,b,c){c&&this._refreshMoveables()},_refreshMoveables:function(a){var b=t.filter([this._graphicMover,this._vertexEditor,this._boxEditor],q.isDefined);t.forEach(b,function(b){b.refresh(a)})},_beginOperation:function(a){t.forEach(this._getAffectedTools(a),function(a){a.suspend()})},_endOperation:function(a){t.forEach(this._getAffectedTools(a),function(a){a.resume()})},_getAffectedTools:function(a){var b=[];switch(a){case "MOVE":b=[this._vertexEditor,this._boxEditor];
break;case "VERTICES":b=[this._boxEditor];break;case "BOX":b=[this._vertexEditor]}return b=t.filter(b,q.isDefined)}});d.mixin(A,{MOVE:1,EDIT_VERTICES:2,SCALE:4,ROTATE:8,EDIT_TEXT:16});k("extend-esri")&&d.setObject("toolbars.Edit",A,h);return A})},"esri/toolbars/_toolbar":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel","../Evented"],function(m,n,d,v,t){m=m([t],{declaredClass:"esri.toolbars._Toolbar",constructor:function(d){this.map=d},_cursors:{move:"pointer","move-v":"pointer",
"move-gv":"pointer",box0:"nw-resize",box1:"n-resize",box2:"ne-resize",box3:"e-resize",box4:"se-resize",box5:"s-resize",box6:"sw-resize",box7:"w-resize",box8:"pointer"},_deactivateMapTools:function(d,k,m,c){var e=this.map;d&&(this._mapNavState={isDoubleClickZoom:e.isDoubleClickZoom,isClickRecenter:e.isClickRecenter,isPan:e.isPan,isRubberBandZoom:e.isRubberBandZoom,isKeyboardNavigation:e.isKeyboardNavigation,isScrollWheelZoom:e.isScrollWheelZoom},e.disableDoubleClickZoom(),e.disableClickRecenter(),
e.disablePan(),e.disableRubberBandZoom(),e.disableKeyboardNavigation());k&&e.hideZoomSlider();m&&e.hidePanArrows();c&&e.graphics.disableMouseEvents()},_activateMapTools:function(d,k,m,c){var e=this.map,n=this._mapNavState;d&&n&&(n.isDoubleClickZoom&&e.enableDoubleClickZoom(),n.isClickRecenter&&e.enableClickRecenter(),n.isPan&&e.enablePan(),n.isRubberBandZoom&&e.enableRubberBandZoom(),n.isKeyboardNavigation&&e.enableKeyboardNavigation(),n.isScrollWheelZoom&&e.enableScrollWheelZoom());k&&e.showZoomSlider();
m&&e.showPanArrows();c&&e.graphics.enableMouseEvents()},_deactivateScrollWheel:function(){var d=this.map;this._scrollWheelState={isScrollWheelZoom:d.isScrollWheelZoom,isScrollWheelPan:d.isScrollWheelPan};d.disableScrollWheelZoom();d.disableScrollWheelPan()},_activateScrollWheel:function(){var d=this.map,k=this._scrollWheelState;k&&(k.isScrollWheelZoom&&d.enableScrollWheelZoom(),k.isScrollWheelPan&&d.enableScrollWheelPan())}});d("extend-esri")&&n.setObject("toolbars._Toolbar",m,v);return m})},"esri/toolbars/_Box":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/connect dojo/_base/Color dojo/has dojo/dom-style dojox/gfx/Moveable dojox/gfx/matrix ../kernel ../lang ../geometry/Point ../geometry/Polyline ../symbols/SimpleMarkerSymbol ../geometry/webMercatorUtils ../geometry/jsonUtils ../graphic".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,a,f){m=m(null,{declaredClass:"esri.toolbars._Box",constructor:function(a,b,c,d,f,e,g){this._graphic=a;this._map=b;this._toolbar=c;this._scale=d;this._rotate=f;this._defaultEventArgs={};this._scaleEvent="Scale";this._rotateEvent="Rotate";this._uniformScaling=e;a=c._options;this._markerSymbol=a.boxHandleSymbol;this._lineSymbol=a.boxLineSymbol;this._moveStartHandler=n.hitch(this,this._moveStartHandler);this._firstMoveHandler=n.hitch(this,this._firstMoveHandler);
this._moveStopHandler=n.hitch(this,this._moveStopHandler);this._moveHandler=n.hitch(this,this._moveHandler);this._isTextPoint=g;this._init()},destroy:function(){this._cleanUp();this._graphic=this._map=this._toolbar=this._markerSymbol=this._lineSymbol=null},refresh:function(){this._draw()},suspend:function(){d.forEach(this._getAllGraphics(),function(a){a.hide()})},resume:function(){d.forEach(this._getAllGraphics(),function(a){a.show()});this._draw()},_init:function(){this._draw()},_cleanUp:function(){this._connects&&
d.forEach(this._connects,v.disconnect);var a=this._toolbar._scratchGL;this._anchors&&d.forEach(this._anchors,function(b){a.remove(b.graphic);(b=b.moveable)&&b.destroy()});this._box&&a.remove(this._box);this._box=this._anchors=this._connects=null},_draw:function(){if(this._graphic.getDojoShape()){var a=this._map,b=this._toolbar._scratchGL,c=this._getBoxCoords(),e=new x(a.spatialReference),g=n.clone(d.filter(c,function(a,b){return 8!==b&&0===b%2}));g[0]&&g.push([g[0][0],g[0][1]]);e.addPath(g);this._rotate&&
e.addPath([c[1],c[8]]);this._box?this._box.setGeometry(e):(this._box=new f(e,this._lineSymbol),b.add(this._box));this._anchors?d.forEach(this._anchors,function(b,d){this._scale||(d=8);var f=new u(c[d],a.spatialReference);b.graphic.setGeometry(f);var f=b.moveable,e=b.graphic.getDojoShape();e&&(f?e!==f.shape&&(f.destroy(),b.moveable=this._getMoveable(b.graphic,d)):b.moveable=this._getMoveable(b.graphic,d))},this):(this._anchors=[],this._connects=[],d.forEach(c,function(c,d){if(this._scale||!(8>d)){c=
new u(c,a.spatialReference);var e=new f(c,this._markerSymbol);this._isTextPoint&&1===d%2&&e.hide();b.add(e);this._anchors.push({graphic:e,moveable:this._getMoveable(e,d)})}},this))}else this._cleanUp()},_getBoxCoords:function(a){var b=this._map,c,f=[],e,g,h;if(this._isTextPoint){c=this._graphic.getNode().getBoundingClientRect();var l=b.__container.getBoundingClientRect();c=[{x:c.left-l.left,y:c.top-l.top},{x:c.right-l.left,y:c.top-l.top},{x:c.right-l.left,y:c.bottom-l.top},{x:c.left-l.left,y:c.bottom-
l.top}]}else c=this._getTransformedBoundingBox(this._graphic);d.forEach(c,function(c,d,l){e=c;(g=l[d+1])||(g=l[0]);h={x:(e.x+g.x)/2,y:(e.y+g.y)/2};a||(e=b.toMap(e),h=b.toMap(h));f.push([e.x,e.y]);f.push([h.x,h.y])});this._rotate&&(c=n.clone(f[1]),c=a?{x:c[0],y:c[1]}:b.toScreen({x:c[0],y:c[1],spatialReference:b.spatialReference}),c.y-=this._toolbar._options.rotateHandleOffset,a||(c=b.toMap(c)),f.push([c.x,c.y]));return f},_getTransformedBoundingBox:function(a){var b=this._map,c=a.geometry.getExtent(),
d=a.geometry.spatialReference;a=new u(c.xmin,c.ymax,d);c=new u(c.xmax,c.ymin,d);a=b.toScreen(a);c=b.toScreen(c);return[{x:a.x,y:a.y},{x:c.x,y:a.y},{x:c.x,y:c.y},{x:a.x,y:c.y}]},_getAllGraphics:function(){var a=[this._box];this._anchors&&d.forEach(this._anchors,function(b){a.push(b.graphic)});return a=d.filter(a,q.isDefined)},_getMoveable:function(a,b){var c=a.getDojoShape();if(c){var d=new r(c);d._index=b;this._connects.push(v.connect(d,"onMoveStart",this._moveStartHandler));this._connects.push(v.connect(d,
"onFirstMove",this._firstMoveHandler));this._connects.push(v.connect(d,"onMoveStop",this._moveStopHandler));d.onMove=this._moveHandler;(c=c.getEventSource())&&k.set(c,"cursor",this._toolbar._cursors["box"+b]);return d}},_moveStartHandler:function(a){this._toolbar["on"+(8===a.host._index?this._rotateEvent:this._scaleEvent)+"Start"](this._graphic)},_firstMoveHandler:function(a){this._toolbar._deactivateScrollWheel();var b=a.host._index,f=this._wrapOffset=a.host.shape._wrapOffsets[0]||0,e=this._graphic.getLayer()._getTransform(),
g;a=d.map(this._getBoxCoords(!0),function(a){return{x:a[0]+f,y:a[1]}});g=this._isTextPoint?this._map.toScreen(this._graphic.geometry):{x:a[1].x,y:a[3].y};this._centerCoord=c.multiplyPoint(c.invert(e),g);if(8===b)g=c.multiplyPoint(c.invert(e),a[1]),this._isTextPoint&&(this._centerCoord=this._deNormalizePoint(this._centerCoord,g)),this._startLine=[this._centerCoord,g],this._moveLine=n.clone(this._startLine);else if(g=c.multiplyPoint(c.invert(e),a[b]),e=c.multiplyPoint(c.invert(e),a[(b+4)%8]),this._isTextPoint&&
(this._centerCoord=this._deNormalizePoint(this._centerCoord,g)),this._firstMoverToAnchor=Math.sqrt((g.x-this._centerCoord.x)*(g.x-this._centerCoord.x)+(g.y-this._centerCoord.y)*(g.y-this._centerCoord.y)),this._startBox=e,this._startBox.width=a[4].x-a[0].x,this._startBox.height=a[4].y-a[0].y,this._moveBox=n.clone(this._startBox),this._xfactor=g.x>e.x?1:-1,this._yfactor=g.y>e.y?1:-1,1===b||5===b)this._xfactor=0;else if(3===b||7===b)this._yfactor=0;this._toolbar._beginOperation("BOX");this._toolbar["on"+
(8===b?this._rotateEvent:this._scaleEvent)+"FirstMove"](this._graphic)},_moveHandler:function(a,b){var d=a.host._index,f=this._defaultEventArgs,e,g,h,l;f.angle=0;f.scaleX=1;f.scaleY=1;if(8===d)e=this._startLine,g=this._moveLine,h=g[1],h.x+=b.dx,h.y+=b.dy,h=this._getAngle(e,g),this._isTextPoint&&(h+=this._graphic.symbol.angle),g=c.rotategAt(h,e[0]),this._graphic.getDojoShape().setTransform(g),f.transform=g,f.angle=h,f.around=e[0];else{e=this._startBox;g=this._moveBox;g.width+=b.dx*this._xfactor;g.height+=
b.dy*this._yfactor;this._uniformScaling||this._isTextPoint?(e=g.x+this._xfactor*g.width,g=g.y+this._yfactor*g.height,e=Math.sqrt((e-this._centerCoord.x)*(e-this._centerCoord.x)+(g-this._centerCoord.y)*(g-this._centerCoord.y)),this._scaleRatio=h=l=e/this._firstMoverToAnchor,e=this._centerCoord):(h=g.width/e.width,l=g.height/e.height,e={x:e.x,y:e.y});if(isNaN(h)||Infinity===h||-Infinity===h)h=1;if(isNaN(l)||Infinity===l||-Infinity===l)l=1;g=c.scaleAt(h,l,e);if(this._isTextPoint){var k=c.rotategAt(this._graphic.symbol.angle,
e);this._graphic.getDojoShape().setTransform([k,g])}else this._graphic.getDojoShape().setTransform(g);f.transform=g;f.scaleX=h;f.scaleY=l;f.around=e}this._toolbar["on"+(8===d?this._rotateEvent:this._scaleEvent)](this._graphic,f)},_moveStopHandler:function(b){this._toolbar._activateScrollWheel();var c=this._graphic,d=this._toolbar,f=d._geo?g.geographicToWebMercator(c.geometry):c.geometry,e=f.spatialReference,h=c.getDojoShape(),l=h.getTransform(),k=c.getLayer()._getTransform();this._isTextPoint?(c=
this._graphic.symbol,8===b.host._index?c.angle+=this._getAngle(this._startLine,this._moveLine):c.font.setSize(Math.round(c.font.size*this._scaleRatio*100)/100),this._graphic.setSymbol(c)):(f=f.toJson(),this._updateSegments(f.paths||f.rings,l,k,e),h.setTransform(null),f=a.fromJson(f),c.setGeometry(d._geo?g.webMercatorToGeographic(f,!0):f));this._draw();this._startLine=this._moveLine=this._startBox=this._moveBox=this._xfactor=this._yfactor=null;d._endOperation("BOX");this._defaultEventArgs.transform=
l;d["on"+(8===b.host._index?this._rotateEvent:this._scaleEvent)+"Stop"](this._graphic,this._defaultEventArgs)},_updateSegments:function(a,b,f,e){var g=this._map,h=this._wrapOffset||0;d.forEach(a,function(a){d.forEach(a,function(a){this._updatePoint(a,e,h,c,g,f,b)},this)},this)},_updatePoint:function(a,b,c,d,f,e,g){b=f.toScreen({x:a[0],y:a[1],spatialReference:b},!0);b.x+=c;b=d.multiplyPoint([e,g,d.invert(e)],b);b.x-=c;c=f.toMap(b);a[0]=c.x;a[1]=c.y},_getAngle:function(a,b){return 180*Math.atan2(b[0].y-
b[1].y,b[0].x-b[1].x)/Math.PI-180*Math.atan2(a[0].y-a[1].y,a[0].x-a[1].x)/Math.PI},_deNormalizePoint:function(a,b){var c=this._map._getFrameWidth();if(-1===c)return a;for(var d={x:a.x,y:a.y};Math.abs(d.x-b.x)>=c;)d.x=d.x<b.x?d.x+c:d.x-c;var f=Math.abs(d.x-b.x);Math.abs(d.x-b.x+c)<f?d.x+=c:Math.abs(d.x-b.x-c)<f&&(d.x-=c);return d}});e("extend-esri")&&n.setObject("toolbars._Box",m,h);return m})},"dojox/gfx/Moveable":function(){define("dojo/_base/lang dojo/_base/declare dojo/_base/array dojo/_base/event dojo/topic dojo/touch dojo/dom-class dojo/_base/window ./Mover dojo/mouse".split(" "),
function(m,n,d,v,t,e,k,r,c,h){return n("dojox.gfx.Moveable",null,{constructor:function(d,h){this.shape=d;this.delay=h&&0<h.delay?h.delay:0;this.mover=h&&h.mover?h.mover:c;this.leftButtonOnly=h&&h.leftButtonOnly;this.events=[this.shape.on(e.press,m.hitch(this,"onMouseDown"))]},destroy:function(){d.forEach(this.events,function(c){c.remove()});this.events=this.shape=null},onMouseDown:function(c){this.delay?(this.events.push(this.shape.on(e.move,m.hitch(this,"onMouseMove")),this.shape.on(e.release,m.hitch(this,
"onMouseUp"))),this._lastX=c.clientX,this._lastY=c.clientY):this.leftButtonOnly&&!h.isLeft(c)||new this.mover(this.shape,c,this);v.stop(c)},onMouseMove:function(c){var d=c.clientY;if(Math.abs(c.clientX-this._lastX)>this.delay||Math.abs(d-this._lastY)>this.delay)this.onMouseUp(c),new this.mover(this.shape,c,this);v.stop(c)},onMouseUp:function(c){this.events.pop().remove()},onMoveStart:function(c){t.publish("/gfx/move/start",c);k.add(r.body(),"dojoMove")},onMoveStop:function(c){t.publish("/gfx/move/stop",
c);k.remove(r.body(),"dojoMove")},onFirstMove:function(c){},onMove:function(c,d,e){this.onMoving(c,d,e);this.shape.applyLeftTransform(d);this.onMoved(c,d)},onMoving:function(c,d){},onMoved:function(c,d){}})})},"dojox/gfx/Mover":function(){define("dojo/_base/lang dojo/_base/array dojo/_base/declare dojo/on dojo/touch dojo/_base/event".split(" "),function(m,n,d,v,t,e){return d("dojox.gfx.Mover",null,{constructor:function(d,n,c){this.shape=d;this.lastX=n.clientX;this.lastY=n.clientY;d=this.host=c;n=
document;c=v(n,t.move,m.hitch(this,"onFirstMove"));this.events=[v(n,t.move,m.hitch(this,"onMouseMove")),v(n,t.release,m.hitch(this,"destroy")),v(n,"dragstart",m.hitch(e,"stop")),v(n,"selectstart",m.hitch(e,"stop")),c];if(d&&d.onMoveStart)d.onMoveStart(this)},onMouseMove:function(d){var k=d.clientX,c=d.clientY;this.host.onMove(this,{dx:k-this.lastX,dy:c-this.lastY},d);this.lastX=k;this.lastY=c;e.stop(d)},onFirstMove:function(){this.host.onFirstMove(this);this.events.pop().remove()},destroy:function(){n.forEach(this.events,
function(d){d.remove()});var d=this.host;if(d&&d.onMoveStop)d.onMoveStop(this);this.events=this.shape=null}})})},"esri/toolbars/_GraphicMover":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/connect dojo/_base/json dojo/dom-style dojox/gfx/Moveable dojox/gfx/Mover dojox/gfx/matrix ../kernel ../PointerEvents ../sniff ../geometry/webMercatorUtils ../geometry/ScreenPoint ../geometry/Point".split(" "),function(m,n,d,v,t,e,k,r,c,h,q,u,x,b){var g=m(null,{declaredClass:"esri.toolbars._GraphicMover",
constructor:function(a,b,c,d){this.graphic=a;this.map=b;this.toolbar=c;this.tempPt=d;this._enableGraphicMover();this._moved=!1},refresh:function(a){var b=this.graphic.getDojoShape();!b||!a&&b._hostGraphic||(this._disableGraphicMover(),this._enableGraphicMover())},destroy:function(){this._disableGraphicMover()},hasMoved:function(){return this._moved},_enableGraphicMover:function(){var a=this.graphic,b=a.getDojoShape();b&&(b._hostGraphic=a,this._moveable=new e(b,{mover:g.Mover}),this._moveStartHandle=
d.connect(this._moveable,"onMoveStart",this,this._moveStartHandler),this._firstMoveHandle=d.connect(this._moveable,"onFirstMove",this,this._firstMoveHandler),this._movingHandle=d.connect(this._moveable,"onMoving",this,this._movingHandler),this._moveStopHandle=d.connect(this._moveable,"onMoveStop",this,this._moveStopHandler),(a=b.getEventSource())&&t.set(a,"cursor",this.toolbar._cursors.move))},_disableGraphicMover:function(){var a=this._moveable;if(a){d.disconnect(this._moveStartHandle);d.disconnect(this._firstMoveHandle);
d.disconnect(this._movingHandle);d.disconnect(this._moveStopHandle);var b=a.shape;b&&(b._hostGraphic=null,(b=b.getEventSource())&&t.set(b,"cursor","inherit"));a.destroy()}this._moveable=null},_moveStartHandler:function(){var a=this.graphic,b=this.map;this._startTx=a.getDojoShape().getTransform();"point"===this.graphic.geometry.type&&b.snappingManager&&b.snappingManager._setUpSnapping();this.toolbar.onGraphicMoveStart(a)},_firstMoveHandler:function(){this.toolbar._beginOperation("MOVE");this.toolbar.onGraphicFirstMove(this.graphic)},
_movingHandler:function(a,b,c){a=a.shape.getTransform();b=this.map;var d;q("esri-pointer")?d=b.navigationManager.pointerEvents._processTouchEvent(c,c):c&&"pointermove"===c.type&&(d=h.prototype._processTouchEvent.call({map:b},c,c));d&&b.snappingManager&&b.snappingManager._onSnappingMouseMoveHandler(d);this.tempPt&&this.tempPt.getDojoShape().setTransform(a);this.toolbar.onGraphicMove(this.graphic,a)},_moveStopHandler:function(a){var c=this.graphic,d=this.toolbar,e=this.map,g=d._geo?u.geographicToWebMercator(c.geometry):
c.geometry,h=g.type,k=c.getDojoShape(),m=k.getTransform();if(v.toJson(m)!==v.toJson(this._startTx)){this._moved=!0;switch(h){case "point":var h=[m,r.invert(this._startTx)],n;e.snappingManager&&(n=e.snappingManager._snappingPoint);g=n||e.toMap(r.multiplyPoint(h,e.toScreen(g,!0)));e.snappingManager&&e.snappingManager._killOffSnapping();break;case "polyline":g=this._updatePolyGeometry(g,g.paths,m);break;case "polygon":g=this._updatePolyGeometry(g,g.rings,m)}k.setTransform(null);c.setGeometry(d._geo?
u.webMercatorToGeographic(g,!0):g);this.tempPt&&this.tempPt.setGeometry(new b(c.geometry.toJson()))}else this._moved=!1;d._endOperation("MOVE");d.onGraphicMoveStop(c,m);this._moved||(a=a.__e,e=this.map.position,a=new x(a.pageX-e.x,a.pageY-e.y),d.onGraphicClick(c,{screenPoint:a,mapPoint:this.map.toMap(a)}))},_updatePolyGeometry:function(a,b,c){var d=this.map,f=a.getPoint(0,0),d=d.toMap(d.toScreen(f).offset(c.dx,c.dy));c=d.x-f.x;for(var f=d.y-f.y,e,g,h,d=0;d<b.length;d++)for(g=b[d],e=0;e<g.length;e++)h=
a.getPoint(d,e),a.setPoint(d,e,h.offset(c,f));return a}});g.Mover=m(k,{declaredClass:"esri.toolbars._Mover",constructor:function(a,b,c){this.__e=b}});q("extend-esri")&&(n.setObject("toolbars._GraphicMover",g,c),n.setObject("toolbars._Mover",g.Mover,c));return g})},"esri/toolbars/_VertexEditor":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/connect dojo/_base/array dojo/has dijit/Menu dijit/MenuItem ../kernel ./_VertexMover ../geometry/Point ../geometry/jsonUtils dojo/i18n!../nls/jsapi".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u){var x=m(null,{declaredClass:"esri.toolbars._GraphicVertexEditor",constructor:function(b,c,a){this.graphic=b;this.map=c;this.toolbar=a;b=a._options;this._symbol1=b.vertexSymbol;this._symbol2=b.ghostVertexSymbol;c=b.ghostLineSymbol;this._lineStroke={style:c.style,width:c.width,color:c.color};this._canDel=b.allowDeleteVertices;this._canAdd=b.allowAddVertices;this._addControllers()},destroy:function(){this._removeControllers()},refresh:function(b){b?(this._removeControllers(),
this._addControllers()):(this._refresh(this._vertexMovers),this._refresh(this._mpVertexMovers))},suspend:function(){this._suspended||this._removeControllers();this._suspended=!0},resume:function(){this._suspended&&this._addControllers();this._suspended=!1},_addControllers:function(){this._firstMoveHandle=d.connect(c,"onFirstMove",this,this._firstMoveHandler);this._moveStopHandle=d.connect(c,"onMoveStop",this,this._moveStopHandler);this._vertexMovers=this._add(this._getSegments(this.graphic.geometry),
this._symbol1);this._canAdd&&(this._mpVertexMovers=this._add(this._getMidpointSegments(this.graphic.geometry),this._symbol2,!0));var b=this._getGraphicsLayer();this._mouseOverHandle=d.connect(b,"onMouseOver",this,this._mouseOverHandler);this._mouseOutHandle=d.connect(b,"onMouseOut",this,this._mouseOutHandler);this._canDel&&(this._ctxMenu=new e({style:"font-size: 12px; margin-left: 5px; margin-top: 5px;"}),b=this._ctxDelete=new k({label:u.toolbars.edit.deleteLabel,iconClass:"vertexDeleteIcon",style:"outline: none;"}),
this._deleteHandle=d.connect(b,"onClick",this,this._deleteHandler),this._ctxMenu.addChild(b),this._ctxMenu.startup())},_removeControllers:function(){d.disconnect(this._firstMoveHandle);d.disconnect(this._moveStopHandle);d.disconnect(this._mouseOverHandle);d.disconnect(this._mouseOutHandle);d.disconnect(this._deleteHandle);this._ctxMenu&&(this._ctxDelete=null,this._unbindCtxNode(),this._ctxMenu.destroyRecursive());this._remove(this._vertexMovers);this._remove(this._mpVertexMovers);this._vertexMovers=
this._mpVertexMovers=null},_add:function(b,d,a){var f,e,g=this.graphic,h=[];for(f=0;f<b.length;f++){var k=b[f],m=[];for(e=0;e<k.length;e++)m.push(new c(k[e],d,g,f,e,k.length,this,a));h.push(m)}return h},_remove:function(b){b&&v.forEach(b,function(b){v.forEach(b,function(a){a.destroy()})})},_refresh:function(b){b&&v.forEach(b,function(b){v.forEach(b,function(a){a.refresh()})})},_isNew:function(b){return-1===v.indexOf(this._vertexMovers[b.segIndex],b)?!0:!1},_getGraphicsLayer:function(){return this.toolbar._scratchGL},
_deleteHandler:function(b){b=this._selectedMover;this._updateRelatedGraphic(b,b.relatedGraphic,b.graphic.geometry,b.segIndex,b.ptIndex,b.segLength,!1,!0);this._canAdd&&this._deleteMidpoints(b);this._deleteVertex(b);this.toolbar._endOperation("VERTICES")},_mouseOverHandler:function(b){b=b.graphic;var c=this._findMover(b);c&&(this.toolbar.onVertexMouseOver(this.graphic,c._getInfo()),c._placeholder||(this._selectedMover=c,this._canDel&&this._bindCtxNode(b.getDojoShape().getNode())))},_mouseOutHandler:function(b){if(b=
this._findMover(b.graphic))this.toolbar.onVertexMouseOut(this.graphic,b._getInfo())},_bindCtxNode:function(b){this._unbindCtxNode();this._ctxDelete.set("disabled",this._selectedMover.segLength<=this.minLength?!0:!1);this._ctxMenu.bindDomNode(b);this._bindNode=b},_unbindCtxNode:function(){var b=this._bindNode;b&&this._ctxMenu.unBindDomNode(b)},_findMover:function(b){var c,a=[];c=this._mpVertexMovers;v.forEach(this._vertexMovers,function(b){a=a.concat(b)});c&&v.forEach(c,function(b){a=a.concat(b)});
for(c=0;c<a.length;c++){var d=a[c];if(d.graphic===b)return d}},_firstMoveHandler:function(b){!this._isNew(b)&&this._canAdd&&this._hideRelatedMidpoints(b);this.toolbar._beginOperation("VERTICES")},_moveStopHandler:function(b,c){var a=this._isNew(b);c&&(c.dx||c.dy)?(this._updateRelatedGraphic(b,b.relatedGraphic,b.graphic.geometry,b.segIndex,b.ptIndex,b.segLength,a),this._canAdd&&(a?this._addMidpoints(b):(this._repositionRelatedMidpoints(b),this._showRelatedMidpoints(b))),this.toolbar._endOperation("VERTICES")):
!a&&this._canAdd&&this._showRelatedMidpoints(b)},_showRelatedMidpoints:function(b){var c=this._getAdjacentMidpoints(b.ptIndex,b.segLength),a=this._mpVertexMovers[b.segIndex];for(b=0;b<c.length;b++){var d=a[c[b]];d.graphic.show();d.refresh()}},_hideRelatedMidpoints:function(b){var c=this._getAdjacentMidpoints(b.ptIndex,b.segLength),a=this._mpVertexMovers[b.segIndex];for(b=0;b<c.length;b++)a[c[b]].graphic.hide()},_repositionRelatedMidpoints:function(b){var c,a=this._getAdjacentMidpoints(b.ptIndex,b.segLength),
d=this._mpVertexMovers[b.segIndex];for(c=0;c<a.length;c++){var e=this._getAdjacentVertices(a[c],b.segLength),k=b.relatedGraphic.geometry.getPoint(b.segIndex,e[0]),e=b.relatedGraphic.geometry.getPoint(b.segIndex,e[1]),k=new h({x:(k.x+e.x)/2,y:(k.y+e.y)/2,spatialReference:k.spatialReference.toJson()});d[a[c]].graphic.setGeometry(k)}},_addMidpoints:function(b){var d=b.segIndex,a=b.ptIndex,e=b.segLength,l=a+1,k,m=e+1;this._mpVertexMovers[d].splice(a,1);var n=this._vertexMovers[d];for(k=0;k<l;k++)n[k].segLength+=
1;for(k=l;k<n.length;k++)n[k].ptIndex+=1,n[k].segLength+=1;b.ptIndex=l;b.segLength=n.length+1;n.splice(l,0,b);b.graphic.setSymbol(this._symbol1);n=this._mpVertexMovers[d];for(k=0;k<a;k++)n[k].segLength+=1;for(k=a;k<e-1;k++)n[k].ptIndex+=1,n[k].segLength+=1;l=this._getAdjacentVertices(a,m);d=this._getAdjacentVertices(a+1,m);e=b.relatedGraphic.geometry.getPoint(b.segIndex,l[0]);k=b.relatedGraphic.geometry.getPoint(b.segIndex,l[1]);l=new h({x:(e.x+k.x)/2,y:(e.y+k.y)/2,spatialReference:e.spatialReference.toJson()});
e=b.relatedGraphic.geometry.getPoint(b.segIndex,d[0]);k=b.relatedGraphic.geometry.getPoint(b.segIndex,d[1]);d=new h({x:(e.x+k.x)/2,y:(e.y+k.y)/2,spatialReference:e.spatialReference.toJson()});e=new c(l,this._symbol2,this.graphic,b.segIndex,a,m,this,!0);b=new c(d,this._symbol2,this.graphic,b.segIndex,a+1,m,this,!0);n.splice(a,0,e,b)},_deleteVertex:function(b){var c,a=b.ptIndex,d=this._vertexMovers[b.segIndex];for(c=0;c<a;c++)--d[c].segLength;for(c=a+1;c<d.length;c++){var e=d[c];--e.ptIndex;--e.segLength}d.splice(a,
1);c=b._getInfo();b.destroy();this.toolbar.onVertexDelete(this.graphic,c)}});n.mixin(x,{create:function(b,c,a){switch(b.geometry.type){case "multipoint":return new x.MultipointVertexEditor(b,c,a);case "polyline":return new x.PolylineVertexEditor(b,c,a);case "polygon":return new x.PolygonVertexEditor(b,c,a)}}});x.MultipointVertexEditor=m(x,{declaredClass:"esri.toolbars._MultipointVertexEditor",minLength:1,constructor:function(){this._moveStartHandle=d.connect(c,"onMoveStart",this,this._moveStartHandler);
d.disconnect(this._firstMoveHandle)},destroy:function(){this.inherited(arguments);d.disconnect(this._moveStartHandle)},_getSegments:function(b){var c=b.points,a=[],d=b.spatialReference;for(b=0;b<c.length;b++){var e=c[b];a.push(new h({x:e[0],y:e[1],spatialReference:d.toJson()}))}return[a]},_getMidpointSegments:function(b){return[]},_getControlPoints:function(b,c,a,d,e){return[]},_getGraphicsLayer:function(){return this.graphic._graphicsLayer},_mouseOverHandler:function(b){var c=b.graphic;if(b=this._findMover(b))this.toolbar.onVertexMouseOver(c,
b._getInfo()),this._selectedMover=b,this._canDel&&this._bindCtxNode(b.graphic.getDojoShape().getNode())},_mouseOutHandler:function(b){var c=b.graphic;if(b=this._findMover(b))this.toolbar.onVertexMouseOut(c,b._getInfo())},_findMover:function(b){var c=[].concat(this._vertexMovers[0]),a=b.target;for(b=0;b<c.length;b++){var d=c[b];if(d.graphic.getDojoShape().getNode()===a)return d}},_moveStartHandler:function(b){var c=b.ptIndex,a=b.segLength-1,d=b.relatedGraphic.geometry.points;b=d.splice(c,1);d.push(b[0]);
d=this._vertexMovers[0];for(b=a;b>c;b--)--d[b].ptIndex;b=d.splice(c,1);d.push(b[0]);b[0].ptIndex=a},_moveStopHandler:function(b){this._updateRelatedGraphic(b,b.relatedGraphic,b.graphic.geometry,b.segIndex,b.ptIndex,b.segLength);this.toolbar._endOperation("VERTICES")},_updateRelatedGraphic:function(b,c,a,d,e,h,k,m){b=c.geometry;m?b.removePoint(e):b.setPoint(e,a);c.setGeometry(b)},_deleteMidpoints:function(b){}});x.PolylineVertexEditor=m(x,{declaredClass:"esri.toolbars._PolylineVertexEditor",minLength:2,
_getSegments:function(b){var c,a,d=b.paths,e=[];for(c=0;c<d.length;c++){var h=d[c],k=[];for(a=0;a<h.length;a++)k.push(b.getPoint(c,a));e.push(k)}return e},_getMidpointSegments:function(b){var c,a,d=b.paths,e=[],k=b.spatialReference;for(c=0;c<d.length;c++){var m=d[c],n=[];for(a=0;a<m.length-1;a++){var q=b.getPoint(c,a),t=b.getPoint(c,a+1),q=new h({x:(q.x+t.x)/2,y:(q.y+t.y)/2,spatialReference:k.toJson()});n.push(q)}e.push(n)}return e},_getControlPoints:function(b,c,a,d,e){var f=this.map,g,h;this._isNew(b)?
(b=d,d+=1,0<=b&&(g=f.toScreen(c.getPoint(a,b))),d<=e&&(h=f.toScreen(c.getPoint(a,d)))):(b=d-1,d+=1,0<=b&&(g=f.toScreen(c.getPoint(a,b))),d<e&&(h=f.toScreen(c.getPoint(a,d))));return[g,h]},_getAdjacentMidpoints:function(b,c){var a=[],d=b-1;0<=d&&a.push(d);b<c-1&&a.push(b);return a},_getAdjacentVertices:function(b,c){return[b,b+1]},_deleteMidpoints:function(b){var d=this._mpVertexMovers[b.segIndex],a=d.length-1,e=this._getAdjacentMidpoints(b.ptIndex,b.segLength).sort(),l,k=e[0];for(l=0;l<k;l++)--d[l].segLength;
for(l=k+1;l<d.length;l++){var m=d[l];--m.ptIndex;--m.segLength}if(1===e.length)d.splice(k,1)[0].destroy();else for(m=this._getAdjacentVertices(k,a),l=b.relatedGraphic.geometry.getPoint(b.segIndex,m[0]),m=b.relatedGraphic.geometry.getPoint(b.segIndex,m[1]),l=new h({x:(l.x+m.x)/2,y:(l.y+m.y)/2,spatialReference:l.spatialReference.toJson()}),b=new c(l,this._symbol2,this.graphic,b.segIndex,k,a,this,!0),d=d.splice(k,e.length,b),l=0;l<d.length;l++)d[l].destroy()},_updateRelatedGraphic:function(b,c,a,d,e,
h,k,m){b=c.geometry;k?b.insertPoint(d,e+1,q.fromJson(a.toJson())):m?b.removePoint(d,e):b.setPoint(d,e,q.fromJson(a.toJson()));c.setGeometry(b)}});x.PolygonVertexEditor=m(x,{declaredClass:"esri.toolbars._PolygonVertexEditor",minLength:3,_getSegments:function(b){var c,a,d=b.rings,e=[];for(c=0;c<d.length;c++){var h=d[c],k=[];for(a=0;a<h.length-1;a++)k.push(b.getPoint(c,a));e.push(k)}return e},_getMidpointSegments:function(b){var c,a,d=b.rings,e=[],k=b.spatialReference;for(c=0;c<d.length;c++){var m=d[c],
n=[];for(a=0;a<m.length-1;a++){var q=b.getPoint(c,a),t=b.getPoint(c,a+1),q=new h({x:(q.x+t.x)/2,y:(q.y+t.y)/2,spatialReference:k.toJson()});n.push(q)}e.push(n)}return e},_getControlPoints:function(b,c,a,d,e){var f=this.map;this._isNew(b)?b=d:(b=d-1,b=0>b?(e+b)%e:b);d=(d+1)%e;e=f.toScreen(c.getPoint(a,b));c=f.toScreen(c.getPoint(a,d));return[e,c]},_getAdjacentMidpoints:function(b,c){var a=b-1;return[0>a?(c+a)%c:a,b]},_getAdjacentVertices:function(b,c){return[b,(b+1)%c]},_deleteMidpoints:function(b){var d=
b.ptIndex,a=this._mpVertexMovers[b.segIndex],e=a.length-1,k=this._getAdjacentMidpoints(d,b.segLength).sort(),m,n;n=k[0];var q=k[k.length-1];if(0===d)for(m=this._getAdjacentVertices(e-1,e),d=b.relatedGraphic.geometry.getPoint(b.segIndex,m[0]),m=b.relatedGraphic.geometry.getPoint(b.segIndex,m[1]),d=new h({x:(d.x+m.x)/2,y:(d.y+m.y)/2,spatialReference:d.spatialReference.toJson()}),b=new c(d,this._symbol2,this.graphic,b.segIndex,e-1,e,this,!0),a.splice(q,1,b)[0].destroy(),a.splice(n,1)[0].destroy(),k=
0;k<a.length-1;k++)n=a[k],--n.ptIndex,--n.segLength;else{m=this._getAdjacentVertices(n,e);d=b.relatedGraphic.geometry.getPoint(b.segIndex,m[0]);m=b.relatedGraphic.geometry.getPoint(b.segIndex,m[1]);d=new h({x:(d.x+m.x)/2,y:(d.y+m.y)/2,spatialReference:d.spatialReference.toJson()});b=new c(d,this._symbol2,this.graphic,b.segIndex,n,e,this,!0);q=a.splice(n,k.length,b);for(k=0;k<q.length;k++)q[k].destroy();for(k=0;k<n;k++)--a[k].segLength;for(k=n+1;k<a.length;k++)n=a[k],--n.ptIndex,--n.segLength}},_updateRelatedGraphic:function(b,
c,a,d,e,h,k,m){b=c.geometry;k?b.insertPoint(d,e+1,q.fromJson(a.toJson())):m?(b.removePoint(d,e),0===e&&b.setPoint(d,h-1,q.fromJson(b.getPoint(d,0).toJson()))):(b.setPoint(d,e,q.fromJson(a.toJson())),0===e&&b.setPoint(d,h,q.fromJson(a.toJson())));c.setGeometry(b)}});t("extend-esri")&&(n.setObject("toolbars._GraphicVertexEditor",x,r),n.setObject("toolbars._MultipointVertexEditor",x.MultipointVertexEditor,r),n.setObject("toolbars._PolylineVertexEditor",x.PolylineVertexEditor,r),n.setObject("toolbars._PolygonVertexEditor",
x.PolygonVertexEditor,r));return x})},"dijit/Menu":function(){define("require dojo/_base/array dojo/_base/declare dojo/dom dojo/dom-attr dojo/dom-geometry dojo/dom-style dojo/keys dojo/_base/lang dojo/on dojo/sniff dojo/_base/window dojo/window ./popup ./DropDownMenu dojo/ready".split(" "),function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,a){q("dijit-legacy-requires")&&a(0,function(){m(["dijit/MenuItem","dijit/PopupMenuItem","dijit/CheckedMenuItem","dijit/MenuSeparator"])});return d("dijit.Menu",g,{constructor:function(){this._bindings=
[]},targetNodeIds:[],selector:"",contextMenuForWindow:!1,leftClickToOpen:!1,refocus:!0,postCreate:function(){this.contextMenuForWindow?this.bindDomNode(this.ownerDocumentBody):n.forEach(this.targetNodeIds,this.bindDomNode,this);this.inherited(arguments)},_iframeContentWindow:function(a){return x.get(this._iframeContentDocument(a))||this._iframeContentDocument(a).__parent__||a.name&&document.frames[a.name]||null},_iframeContentDocument:function(a){return a.contentDocument||a.contentWindow&&a.contentWindow.document||
a.name&&document.frames[a.name]&&document.frames[a.name].document||null},bindDomNode:function(a){a=v.byId(a,this.ownerDocument);var b;if("iframe"==a.tagName.toLowerCase()){var d=a;b=this._iframeContentWindow(d);b=u.body(b.document)}else b=a==u.body(this.ownerDocument)?this.ownerDocument.documentElement:a;var e={node:a,iframe:d};t.set(a,"_dijitMenu"+this.id,this._bindings.push(e));var f=c.hitch(this,function(a){var b=this.selector,c=b?function(a){return h.selector(b,a)}:function(a){return a},e=this;
return[h(a,c(this.leftClickToOpen?"click":"contextmenu"),function(a){a.stopPropagation();a.preventDefault();(new Date).getTime()<e._lastKeyDown+500||e._scheduleOpen(this,d,{x:a.pageX,y:a.pageY},a.target)}),h(a,c("keydown"),function(a){if(93==a.keyCode||a.shiftKey&&a.keyCode==r.F10||e.leftClickToOpen&&a.keyCode==r.SPACE)a.stopPropagation(),a.preventDefault(),e._scheduleOpen(this,d,null,a.target),e._lastKeyDown=(new Date).getTime()})]});e.connects=b?f(b):[];d&&(e.onloadHandler=c.hitch(this,function(){var a=
this._iframeContentWindow(d),a=u.body(a.document);e.connects=f(a)}),d.addEventListener?d.addEventListener("load",e.onloadHandler,!1):d.attachEvent("onload",e.onloadHandler))},unBindDomNode:function(a){var b;try{b=v.byId(a,this.ownerDocument)}catch(A){return}a="_dijitMenu"+this.id;if(b&&t.has(b,a)){for(var c=t.get(b,a)-1,d=this._bindings[c],e;e=d.connects.pop();)e.remove();(e=d.iframe)&&(e.removeEventListener?e.removeEventListener("load",d.onloadHandler,!1):e.detachEvent("onload",d.onloadHandler));
t.remove(b,a);delete this._bindings[c]}},_scheduleOpen:function(a,b,c,d){this._openTimer||(this._openTimer=this.defer(function(){delete this._openTimer;this._openMyself({target:d,delegatedTarget:a,iframe:b,coords:c})},1))},_openMyself:function(a){function c(){r.refocus&&u&&u.focus();b.close(r)}var d=a.target,f=a.iframe,g=a.coords,h=!g;this.currentTarget=a.delegatedTarget;if(g){if(f){a=e.position(f,!0);var d=this._iframeContentWindow(f),d=e.docScroll(d.document),m=k.getComputedStyle(f),n=k.toPixelValue,
t=(q("ie")&&q("quirks")?0:n(f,m.paddingLeft))+(q("ie")&&q("quirks")?n(f,m.borderLeftWidth):0),f=(q("ie")&&q("quirks")?0:n(f,m.paddingTop))+(q("ie")&&q("quirks")?n(f,m.borderTopWidth):0);g.x+=a.x+t-d.x;g.y+=a.y+f-d.y}}else g=e.position(d,!0),g.x+=10,g.y+=10;var r=this,f=this._focusManager.get("prevNode");a=this._focusManager.get("curNode");var u=!a||v.isDescendant(a,this.domNode)?f:a;b.open({popup:this,x:g.x,y:g.y,onExecute:c,onCancel:c,orient:this.isLeftToRight()?"L":"R"});this.focus();h||this.defer(function(){this._cleanUp(!0)});
this._onBlur=function(){this.inherited("_onBlur",arguments);b.close(this)}},destroy:function(){n.forEach(this._bindings,function(a){a&&this.unBindDomNode(a.node)},this);this.inherited(arguments)}})})},"esri/toolbars/_VertexMover":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/connect dojo/sniff dojo/dom-style dojox/gfx/Moveable ../kernel ../PointerEvents ../sniff ../geometry/Point ../graphic ../geometry/webMercatorUtils".split(" "),function(m,n,d,v,t,e,k,r,c,h,q,u){m=m(null,{declaredClass:"esri.toolbars.VertexMover",
constructor:function(c,b,d,a,e,h,k,m){this.point=c;this.symbol=b;this.relatedGraphic=d;this.segIndex=a;this.ptIndex=e;this.segLength=h;this.editor=k;this.map=k.map;this._scratchGL=k.toolbar._scratchGL;this._placeholder=m||!1;this._type=d.geometry.type;this._init();this._enable()},refresh:function(c){if(c||this._needRefresh())this._disable(),this._enable()},destroy:function(){this._disable();this.graphic&&this._scratchGL.remove(this.graphic);this.point=this.symbol=this.graphic=this.relatedGraphic=
this.segIndex=this.ptIndex=this.segLength=this.editor=this.map=this._scratchGL=null},_init:function(){var c=new h(this.point.toJson()),c=new q(c,this.symbol);switch(this._type){case "multipoint":c._shape=this.relatedGraphic.getDojoShape().children[this.ptIndex];break;case "polyline":case "polygon":this._scratchGL.add(c)}this.graphic=c},_enable:function(){var c=this.graphic.getDojoShape();c&&(c._hasMover=!0,this._moveable=this._getMoveable(c),(c=c.getEventSource())&&t.set(c,"cursor",this.editor.toolbar._cursors[this._placeholder?
"move-gv":"move-v"]))},_disable:function(){var c=this._moveable;if(c){d.disconnect(this._startHandle);d.disconnect(this._firstHandle);d.disconnect(this._movingHandle);d.disconnect(this._stopHandle);var b=c.shape;b&&(b=b.getEventSource())&&t.set(b,"cursor","inherit");c.destroy();this._moveable=null}},_needRefresh:function(){var c=this.graphic.getDojoShape(),b=!1;if(c)switch(this._type){case "multipoint":var d=this.relatedGraphic.getDojoShape();d&&(d=d.children[this.ptIndex],c!==d&&(this.graphic._shape=
d,b=!0));break;case "polyline":case "polygon":b=!c._hasMover}return b},_getMoveable:function(h){h=new e(h,v("mac")&&v("ff")&&!c("esri-touch")&&{leftButtonOnly:!0});this._startHandle=d.connect(h,"onMoveStart",this,this._moveStartHandler);this._firstHandle=d.connect(h,"onFirstMove",this,this._firstMoveHandler);this._movingHandle=d.connect(h,"onMoving",this,this._movingHandler);this._stopHandle=d.connect(h,"onMoveStop",this,this._moveStopHandler);return h},_getPtIndex:function(){return this.ptIndex+
(this._placeholder?1:0)},_getInfo:function(){return{graphic:this.graphic,isGhost:this._placeholder,segmentIndex:this.segIndex,pointIndex:this._getPtIndex()}},_moveStartHandler:function(c){var b=this.map;b.snappingManager&&b.snappingManager._setUpSnapping();this.editor.toolbar._deactivateScrollWheel();c.shape.moveToFront();this.constructor.onMoveStart(this);this.editor.toolbar.onVertexMoveStart(this.relatedGraphic,this._getInfo())},_firstMoveHandler:function(c){var b=c.shape,d=this._getControlEdges(),
a=this._scratchGL._div,e,h=[],k=c.host.shape._wrapOffsets[0]||0;for(e=0;e<d.length;e++){var m=d[e];m.x1+=k;m.x2+=k;h.push([a.createLine({x1:m.x1,y1:m.y1,x2:m.x2,y2:m.y2}).setStroke(this.editor._lineStroke),m.x1,m.y1,m.x2,m.y2])}b._lines=h;c.shape.moveToFront();this.constructor.onFirstMove(this);this.editor.toolbar.onVertexFirstMove(this.relatedGraphic,this._getInfo())},_movingHandler:function(d,b,e){b=this.map;var a;c("esri-pointer")?a=b.navigationManager.pointerEvents._processTouchEvent(e,e):e&&
"pointermove"===e.type&&(a=r.prototype._processTouchEvent.call({map:b},e,e));a&&b.snappingManager&&b.snappingManager._onSnappingMouseMoveHandler(a);e=d.shape;d=e.getTransform();e=e._lines;for(a=0;a<e.length;a++)b=e[a],b[0].setShape({x1:b[1]+d.dx,y1:b[2]+d.dy,x2:b[3],y2:b[4]});this.editor.toolbar.onVertexMove(this.relatedGraphic,this._getInfo(),d)},_moveStopHandler:function(c){c=c.shape;var b=this.editor.toolbar,d=c.getTransform(),a=this.map,e=this.graphic,h=b._geo?u.geographicToWebMercator(e.geometry):
e.geometry;b._activateScrollWheel();var k,m=c._lines;if(m){for(k=0;k<m.length;k++)m[k][0].removeShape();c._lines=null}k=!1;var m=!0,n=this._getInfo();d&&(d.dx||d.dy)?this._placeholder&&(this._placeholder=!1,k=!0):m=!1;var q;a.snappingManager&&(q=a.snappingManager._snappingPoint);q=q||a.toMap(a.toScreen(h).offset(d.dx,d.dy));a.snappingManager&&a.snappingManager._killOffSnapping();c.setTransform(null);e.setGeometry(b._geo?u.webMercatorToGeographic(q,!0):q);this.constructor.onMoveStop(this,d);b.onVertexMoveStop(this.relatedGraphic,
n,d);if(!m)b.onVertexClick(this.relatedGraphic,n);if(k)b.onVertexAdd(this.relatedGraphic,this._getInfo())},_getControlEdges:function(){var c=this.map,b=this.relatedGraphic.geometry,d=this.segIndex,a=this.ptIndex,e=this.segLength,h=this._scratchGL._getTransform(),k=h.dx,h=h.dy,m=c.toScreen(this.graphic.geometry),c=m.x-k,m=m.y-h,n=[],b=this.editor._getControlPoints(this,b,d,a,e);b[0]&&n.push({x1:c,y1:m,x2:b[0].x-k,y2:b[0].y-h});b[1]&&n.push({x1:c,y1:m,x2:b[1].x-k,y2:b[1].y-h});return n}});c("extend-esri")&&
n.setObject("toolbars.VertexMover",m,k);n.mixin(m,{onMoveStart:function(){},onFirstMove:function(){},onMoveStop:function(){}});return m})},"esri/toolbars/TextEditor":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/connect dojo/_base/event dojo/has dojo/dom-construct dojo/dom-class dojo/dom-style dojo/keys ../kernel".split(" "),function(m,n,d,v,t,e,k,r,c,h){m=m(null,{declaredClass:"esri.toolbars.TextEditor",constructor:function(c,d,e){this._graphic=c;this._map=d;this._toolbar=e;this._enable(this._graphic)},
destroy:function(){this._disable()},onEditStart:function(){},onEditEnd:function(){},_enable:function(c){this._editBox?(d.disconnect(this._addEditBoxHandler),this._addEditBoxHandler=null):(this._map.navigationManager.setImmediateClick(!0),this._addEditBoxHandler=d.connect(c.getLayer(),"onDblClick",this,function(e){this._map.navigationManager.setImmediateClick(!1);e.graphic==c&&(v.stop(e),d.disconnect(this._addEditBoxHandler),this._addEditBoxHandler=null,this._addTextBox(c))}))},_disable:function(){this._applyEdit();
this._addEditBoxHandler&&(d.disconnect(this._addEditBoxHandler),this._addEditBoxHandler=null);this._removeTextBox();this.onEditEnd(this._graphic);this._toolbar.onTextEditEnd(this._graphic)},_addTextBox:function(h,m){if(!this._editBox){var q;h.symbol.text||(h.symbol.text="Tempt text",h.setSymbol(h.symbol),q="");var b=this._createInputTextStyle(h,this._map);""!==q&&(q=m||h.symbol.text);this._editBox=e.create("input",{type:"text",value:q});r.set(this._editBox,b);k.add(this._editBox,"esriTextEditorInput");
this._map.container.appendChild(this._editBox);this._editBox.focus();this._editBoxKeyHandler=d.connect(this._editBox,"onkeyup",n.hitch(this,function(a){a.keyCode!=c.ENTER&&a.keyCode!==c.TAB||this._disable()}));this._editBoxBlurHandler=d.connect(this._editBox,"onblur",n.hitch(this,function(a){this._disable()}));h.symbol.text="";h.setSymbol(h.symbol);h.hide();var g=this._editBox;this._disableBoxHandler||(this._disableBoxHandler=this._map.on("zoom-start",n.hitch(this,function(){this._disable()})));this._moveBoxHandler=
this._map.on("pan",function(a){r.set(g,{left:this._editBoxLeft+a.delta.x+"px",top:this._editBoxTop+a.delta.y+"px"})});this._moveBoxStartHandler=this._map.on("pan-start",function(){this._editBoxLeft=parseFloat(r.get(g,"left"));this._editBoxTop=parseFloat(r.get(g,"top"))});this.onEditStart(h,this._editBox);this._toolbar.onTextEditStart(h,this._editBox)}},_removeTextBox:function(){this._editBoxBlurHandler&&(d.disconnect(this._editBoxBlurHandler),this._editBoxBlurHandler=null);this._editBox&&(this._editBox.parentNode.removeChild(this._editBox),
this._editBox=null);this._disableBoxHandler&&(this._disableBoxHandler.remove(),this._disableBoxHandler=null);this._moveBoxHandler&&(this._moveBoxHandler.remove(),this._moveBoxHandler=null);this._moveBoxStartHandler&&(this._moveBoxStartHandler.remove(),this._moveBoxStartHandler=null);this._editBoxKeyHandler&&(d.disconnect(this._editBoxKeyHandler),this._editBoxKeyHandler=null)},_createInputTextStyle:function(c,d){var e=c.getDojoShape().getTransformedBoundingBox(),b=c.symbol.font;return{"font-family":b.family,
"font-size":b.size+"px","font-style":b.style,"font-variant":b.variant,"font-weight":b.weight,left:e[0].x+"px",top:e[0].y+"px",width:Math.abs(e[0].x-e[1].x)/Math.cos(c.symbol.angle/180*Math.PI)+"px"}},_applyEdit:function(){if(this._editBox)if(this._editBox.value){this._graphic.show();var c=this._graphic.symbol;c.text=this._editBox.value;this._graphic.setSymbol(c)}else this._graphic.getLayer().remove(this._graphic)}});t("extend-esri")&&n.setObject("toolbars.TextEditor",m,h);return m})},"esri/toolbars/draw":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/connect dojo/_base/Color dojo/_base/window dojo/has dojo/sniff dojo/keys dojo/dom-construct dojo/dom-style dojo/dom-geometry ../kernel ../sniff ./_toolbar ../symbols/SimpleMarkerSymbol ../symbols/SimpleLineSymbol ../symbols/SimpleFillSymbol ../graphic ../geometry/jsonUtils ../geometry/webMercatorUtils ../geometry/Polyline ../geometry/Polygon ../geometry/Multipoint ../geometry/Rect dojo/i18n!../nls/jsapi".split(" "),
function(m,n,d,v,t,e,k,r,c,h,q,u,x,b,g,a,f,l,y,F,B,A,z,w,D,C){var E=m(g,{declaredClass:"esri.toolbars.Draw",_eventMap:{"draw-complete":!0,"draw-end":["geometry"]},constructor:function(b,c){this.markerSymbol=new a(a.STYLE_SOLID,10,new f(f.STYLE_SOLID,new t([255,0,0]),2),new t([0,0,0,.25]));this.lineSymbol=new f(f.STYLE_SOLID,new t([255,0,0]),2);this.fillSymbol=new l(l.STYLE_SOLID,new f(f.STYLE_SOLID,new t([255,0,0]),2),new t([0,0,0,.25]));this._points=[];this._mouse=!k("esri-touch")&&!k("esri-pointer");
this._defaultOptions={showTooltips:!0,drawTime:75,tolerance:8,tooltipOffset:15};this._options=n.mixin(n.mixin({},this._defaultOptions),c||{});if(r("ios")||r("android"))this._options.showTooltips=!1;this._onKeyDownHandler=n.hitch(this,this._onKeyDownHandler);this._onMouseDownHandler=n.hitch(this,this._onMouseDownHandler);this._onMouseUpHandler=n.hitch(this,this._onMouseUpHandler);this._onClickHandler=n.hitch(this,this._onClickHandler);this._onMouseMoveHandler=n.hitch(this,this._onMouseMoveHandler);
this._onMouseDragHandler=n.hitch(this,this._onMouseDragHandler);this._onDblClickHandler=n.hitch(this,this._onDblClickHandler);this._updateTooltip=n.hitch(this,this._updateTooltip);this._hideTooltip=n.hitch(this,this._hideTooltip);this._redrawGraphic=n.hitch(this,this._redrawGraphic)},_geometryType:null,respectDrawingVertexOrder:!1,setRespectDrawingVertexOrder:function(a){this.respectDrawingVertexOrder=a},setMarkerSymbol:function(a){this.markerSymbol=a},setLineSymbol:function(a){this.lineSymbol=a},
setFillSymbol:function(a){this.fillSymbol=a},activate:function(a,b){this._geometryType&&this.deactivate();var c=this.map,d=v.connect,e=E;this._options=n.mixin(n.mixin({},this._options),b||{});c.navigationManager.setImmediateClick(!1);switch(a){case e.ARROW:case e.LEFT_ARROW:case e.RIGHT_ARROW:case e.UP_ARROW:case e.DOWN_ARROW:case e.TRIANGLE:case e.CIRCLE:case e.ELLIPSE:case e.RECTANGLE:this._deactivateMapTools(!0,!1,!1,!0);this._onClickHandler_connect=d(c,"onClick",this._onClickHandler);this._mouse?
(this._onMouseDownHandler_connect=d(c,"onMouseDown",this._onMouseDownHandler),this._onMouseDragHandler_connect=d(c,"onMouseDrag",this._onMouseDragHandler),this._onMouseUpHandler_connect=d(c,"onMouseUp",this._onMouseUpHandler)):(this._onMouseDownHandler2_connect=d(c,"onMouseDragStart",this._onMouseDownHandler),this._onMouseDragHandler2_connect=d(c,"onMouseDrag",this._onMouseDragHandler),this._onMouseUpHandler2_connect=d(c,"onMouseDragEnd",this._onMouseUpHandler));k("esri-touch")&&!k("esri-pointer")&&
(this._onMouseDownHandler2_connect=d(c,"onSwipeStart",this._onMouseDownHandler),this._onMouseDragHandler2_connect=d(c,"onSwipeMove",this._onMouseDragHandler),this._onMouseUpHandler2_connect=d(c,"onSwipeEnd",this._onMouseUpHandler));break;case e.POINT:this._onClickHandler_connect=d(c,"onClick",this._onClickHandler);break;case e.LINE:case e.EXTENT:case e.FREEHAND_POLYLINE:case e.FREEHAND_POLYGON:this._deactivateMapTools(!0,!1,!1,!0);this._mouse?(this._onMouseDownHandler_connect=d(c,"onMouseDown",this._onMouseDownHandler),
this._onMouseDragHandler_connect=d(c,"onMouseDrag",this._onMouseDragHandler),this._onMouseUpHandler_connect=d(c,"onMouseUp",this._onMouseUpHandler)):(this._onMouseDownHandler_connect=d(c,"onMouseDragStart",this._onMouseDownHandler),this._onMouseDragHandler_connect=d(c,"onMouseDrag",this._onMouseDragHandler),this._onMouseUpHandler_connect=d(c,"onMouseDragEnd",this._onMouseUpHandler));k("esri-touch")&&!k("esri-pointer")&&(this._onMouseDownHandler2_connect=d(c,"onSwipeStart",this._onMouseDownHandler),
this._onMouseDragHandler2_connect=d(c,"onSwipeMove",this._onMouseDragHandler),this._onMouseUpHandler2_connect=d(c,"onSwipeEnd",this._onMouseUpHandler));break;case e.POLYLINE:case e.POLYGON:case e.MULTI_POINT:c.navigationManager.setImmediateClick(!0);this._onClickHandler_connect=d(c,"onClick",this._onClickHandler);this._onDblClickHandler_connect=d(c,"onDblClick",this._onDblClickHandler);this._dblClickZoom=c.isDoubleClickZoom;c.disableDoubleClickZoom();break;default:console.error("Unsupported geometry type: "+
a);return}this._onKeyDown_connect=d(c,"onKeyDown",this._onKeyDownHandler);this._redrawConnect=d(c,"onExtentChange",this._redrawGraphic);this._geometryType=a;this._toggleTooltip(!0);c.snappingManager&&"freehandpolyline"!==this._geometryType&&"freehandpolygon"!==this._geometryType&&(c.snappingManager._startSelectionLayerQuery(),c.snappingManager._setUpSnapping());this.onActivate(this._geometryType)},deactivate:function(){var a=this.map;this._clear();var b=v.disconnect;b(this._onMouseMoveHandler_connect);
b(this._onMouseDownHandler_connect);b(this._onMouseDragHandler_connect);b(this._onMouseUpHandler_connect);b(this._onMouseDownHandler2_connect);b(this._onMouseDragHandler2_connect);b(this._onMouseUpHandler2_connect);b(this._onClickHandler_connect);b(this._onDblClickHandler_connect);b(this._onKeyDown_connect);b(this._redrawConnect);this._onMouseDownHandler_connect=this._onMouseMoveHandler_connect=this._onMouseDragHandler_connect=this._onMouseUpHandler_connect=this._onMouseDownHandler2_connect=this._onMouseDragHandler2_connect=
this._onMouseUpHandler2_connect=this._onClickHandler_connect=this._onDblClickHandler_connect=this._onKeyDown_connect=this._redrawConnect=null;a.snappingManager&&(a.snappingManager._stopSelectionLayerQuery(),a.snappingManager._killOffSnapping());switch(this._geometryType){case E.CIRCLE:case E.ELLIPSE:case E.TRIANGLE:case E.ARROW:case E.LEFT_ARROW:case E.RIGHT_ARROW:case E.UP_ARROW:case E.DOWN_ARROW:case E.RECTANGLE:case E.LINE:case E.EXTENT:case E.FREEHAND_POLYLINE:case E.FREEHAND_POLYGON:this._activateMapTools(!0,
!1,!1,!0);break;case E.POLYLINE:case E.POLYGON:case E.MULTI_POINT:this._dblClickZoom&&a.enableDoubleClickZoom()}b=this._geometryType;this._geometryType=null;a.navigationManager.setImmediateClick(!1);this._toggleTooltip(!1);this.onDeactivate(b)},_clear:function(){this._graphic&&this.map.graphics.remove(this._graphic,!0);this._tGraphic&&this.map.graphics.remove(this._tGraphic,!0);this._graphic=this._tGraphic=null;this.map.snappingManager&&this.map.snappingManager._setGraphic(null);this._points=[]},
finishDrawing:function(){var a,b=this._points,c=this.map.spatialReference,e=E,b=b.slice(0,b.length);switch(this._geometryType){case e.POLYLINE:if(!this._graphic||2>b.length)return;a=new A(c);a.addPath([].concat(b));break;case e.POLYGON:if(!this._graphic||3>b.length)return;a=new z(c);b=[].concat(b,[b[0].offset(0,0)]);z.prototype.isClockwise(b)||this.respectDrawingVertexOrder||(console.debug(this.declaredClass+" :  Polygons drawn in anti-clockwise direction will be reversed to be clockwise."),b.reverse());
a.addRing(b);break;case e.MULTI_POINT:a=new w(c),d.forEach(b,function(b){a.addPoint(b)})}v.disconnect(this._onMouseMoveHandler_connect);this._clear();this._setTooltipMessage(0);this._drawEnd(a)},_drawEnd:function(a){if(a){var b=this.map.spatialReference,c;this.onDrawEnd(a);b&&(b.isWebMercator()?c=B.webMercatorToGeographic(a,!0):4326===b.wkid&&(c=F.fromJson(a.toJson())));this.onDrawComplete({geometry:a,geographicGeometry:c})}},_normalizeRect:function(a,b,c){var d=a.x;a=a.y;var e=b.x;b=b.y;return{x:Math.min(d,
e),y:Math.max(a,b),width:Math.abs(d-e),height:Math.abs(a-b),spatialReference:c}},_onMouseDownHandler:function(a){this._dragged=!1;var b;this.map.snappingManager&&(b=this.map.snappingManager._snappingPoint);var c=b||a.mapPoint,d=E;b=this.map;var e=b.spatialReference;this._points.push(c.offset(0,0));switch(this._geometryType){case d.LINE:this._graphic=b.graphics.add(new y(new A({paths:[[[c.x,c.y],[c.x,c.y]]],spatialReference:e}),this.lineSymbol),!0);b.snappingManager&&b.snappingManager._setGraphic(this._graphic);
break;case d.FREEHAND_POLYLINE:this._oldPoint=a.screenPoint;c=new A(e);c.addPath(this._points);this._graphic=b.graphics.add(new y(c,this.lineSymbol),!0);b.snappingManager&&b.snappingManager._setGraphic(this._graphic);break;case d.CIRCLE:case d.ELLIPSE:case d.TRIANGLE:case d.ARROW:case d.LEFT_ARROW:case d.RIGHT_ARROW:case d.UP_ARROW:case d.DOWN_ARROW:case d.RECTANGLE:case d.FREEHAND_POLYGON:this._oldPoint=a.screenPoint,c=new z(e),c.addRing(this._points),this._graphic=b.graphics.add(new y(c,this.fillSymbol),
!0),b.snappingManager&&b.snappingManager._setGraphic(this._graphic)}k("esri-touch")&&a.preventDefault();if(1===this._points.length)this.onDrawStart()},_onMouseMoveHandler:function(a){var b;this.map.snappingManager&&(b=this.map.snappingManager._snappingPoint);var c=this._points[this._points.length-1];a=b||a.mapPoint;b=this._tGraphic;var d=b.geometry;switch(this._geometryType){case E.POLYLINE:case E.POLYGON:d.setPoint(0,0,{x:c.x,y:c.y}),d.setPoint(0,1,{x:a.x,y:a.y}),b.setGeometry(d)}},_onMouseDragHandler:function(a){if(this._graphic||
this._points.length)if(k("esri-touch")&&!this._points.length)a.preventDefault();else{this._dragged=!0;var b;this.map.snappingManager&&(b=this.map.snappingManager._snappingPoint);var c=this._points[0],d=b||a.mapPoint,e=this.map,f=e.spatialReference;b=this._graphic;var g=E,h=e.toScreen(c),l=e.toScreen(d),m=[],m=l.x-h.x,l=l.y-h.y,q=Math.sqrt(m*m+l*l);switch(this._geometryType){case g.CIRCLE:this._hideTooltip();b.geometry=z.createCircle({center:h,r:q,numberOfPoints:60,map:e});b.setGeometry(b.geometry);
break;case g.ELLIPSE:this._hideTooltip();b.geometry=z.createEllipse({center:h,longAxis:m,shortAxis:l,numberOfPoints:60,map:e});b.setGeometry(b.geometry);break;case g.TRIANGLE:this._hideTooltip();m=[[0,-q],[.8660254037844386*q,.5*q],[-.8660254037844386*q,.5*q],[0,-q]];b.geometry=this._toPolygon(m,h.x,h.y);b.setGeometry(b.geometry);break;case g.ARROW:this._hideTooltip();c=l/q;e=m/q;d=.25*e*q;f=.25*q/(l/m);q*=.25*c;m=[[m,l],[m-d*(1+24/f),l+24*e-q],[m-d*(1+12/f),l+12*e-q],[-12*c,12*e],[12*c,-12*e],[m-
d*(1-12/f),l-12*e-q],[m-d*(1-24/f),l-24*e-q],[m,l]];b.geometry=this._toPolygon(m,h.x,h.y);b.setGeometry(b.geometry);break;case g.LEFT_ARROW:this._hideTooltip();m=0>=m?[[m,0],[.75*m,l],[.75*m,.5*l],[0,.5*l],[0,-.5*l],[.75*m,-.5*l],[.75*m,-l],[m,0]]:[[0,0],[.25*m,l],[.25*m,.5*l],[m,.5*l],[m,-.5*l],[.25*m,-.5*l],[.25*m,-l],[0,0]];b.geometry=this._toPolygon(m,h.x,h.y);b.setGeometry(b.geometry);break;case g.RIGHT_ARROW:this._hideTooltip();m=0<=m?[[m,0],[.75*m,l],[.75*m,.5*l],[0,.5*l],[0,-.5*l],[.75*m,
-.5*l],[.75*m,-l],[m,0]]:[[0,0],[.25*m,l],[.25*m,.5*l],[m,.5*l],[m,-.5*l],[.25*m,-.5*l],[.25*m,-l],[0,0]];b.geometry=this._toPolygon(m,h.x,h.y);b.setGeometry(b.geometry);break;case g.UP_ARROW:this._hideTooltip();m=0>=l?[[0,l],[-m,.75*l],[-.5*m,.75*l],[-.5*m,0],[.5*m,0],[.5*m,.75*l],[m,.75*l],[0,l]]:[[0,0],[-m,.25*l],[-.5*m,.25*l],[-.5*m,l],[.5*m,l],[.5*m,.25*l],[m,.25*l],[0,0]];b.geometry=this._toPolygon(m,h.x,h.y);b.setGeometry(b.geometry);break;case g.DOWN_ARROW:this._hideTooltip();m=0<=l?[[0,l],
[-m,.75*l],[-.5*m,.75*l],[-.5*m,0],[.5*m,0],[.5*m,.75*l],[m,.75*l],[0,l]]:[[0,0],[-m,.25*l],[-.5*m,.25*l],[-.5*m,l],[.5*m,l],[.5*m,.25*l],[m,.25*l],[0,0]];b.geometry=this._toPolygon(m,h.x,h.y);b.setGeometry(b.geometry);break;case g.RECTANGLE:this._hideTooltip();m=[[0,0],[m,0],[m,l],[0,l],[0,0]];b.geometry=this._toPolygon(m,h.x,h.y);b.setGeometry(b.geometry);break;case g.LINE:b.setGeometry(n.mixin(b.geometry,{paths:[[[c.x,c.y],[d.x,d.y]]]}));break;case g.EXTENT:b&&e.graphics.remove(b,!0);b=new D(this._normalizeRect(c,
d,f));b._originOnly=!0;this._graphic=e.graphics.add(new y(b,this.fillSymbol),!0);e.snappingManager&&e.snappingManager._setGraphic(this._graphic);break;case g.FREEHAND_POLYLINE:this._hideTooltip();if(!1===this._canDrawFreehandPoint(a)){k("esri-touch")&&a.preventDefault();return}this._points.push(a.mapPoint.offset(0,0));b.geometry._insertPoints([d.offset(0,0)],0);b.setGeometry(b.geometry);break;case g.FREEHAND_POLYGON:this._hideTooltip();if(!1===this._canDrawFreehandPoint(a)){k("esri-touch")&&a.preventDefault();
return}this._points.push(a.mapPoint.offset(0,0));b.geometry._insertPoints([d.offset(0,0)],0);b.setGeometry(b.geometry)}k("esri-touch")&&a.preventDefault()}},_canDrawFreehandPoint:function(a){if(!this._oldPoint)return!1;var b=this._oldPoint.x-a.screenPoint.x,c=this._oldPoint.y-a.screenPoint.y,d=this._options.tolerance;if((0>b?-1*b:b)<d&&(0>c?-1*c:c)<d)return!1;b=new Date;if(b-this._startTime<this._options.drawTime)return!1;this._startTime=b;this._oldPoint=a.screenPoint;return!0},_onMouseUpHandler:function(a){if(this._dragged&&
this._graphic){0===this._points.length&&this._points.push(a.mapPoint.offset(0,0));var b;this.map.snappingManager&&(b=this.map.snappingManager._snappingPoint);var c=this._points[0];b=b||a.mapPoint;var d=this.map.spatialReference,e=E,f;switch(this._geometryType){case e.CIRCLE:case e.ELLIPSE:case e.TRIANGLE:case e.ARROW:case e.LEFT_ARROW:case e.RIGHT_ARROW:case e.UP_ARROW:case e.DOWN_ARROW:case e.RECTANGLE:f=this._graphic.geometry;break;case e.LINE:f=new A({paths:[[[c.x,c.y],[b.x,b.y]]],spatialReference:d});
break;case e.EXTENT:f=(new D(this._normalizeRect(c,b,d))).getExtent();break;case e.FREEHAND_POLYLINE:f=new A(d);f.addPath([].concat(this._points,[b.offset(0,0)]));break;case e.FREEHAND_POLYGON:f=new z(d),c=[].concat(this._points,[b.offset(0,0),this._points[0].offset(0,0)]),z.prototype.isClockwise(c)||this.respectDrawingVertexOrder||(console.debug(this.declaredClass+" :  Polygons drawn in anti-clockwise direction will be reversed to be clockwise."),c.reverse()),f.addRing(c)}k("esri-touch")&&a.preventDefault();
this._clear();this._drawEnd(f)}else this._clear()},_onClickHandler:function(a){var b;this.map.snappingManager&&(b=this.map.snappingManager._snappingPoint);a=b||a.mapPoint;b=this.map;var c=b.toScreen(a),d=E;this._points.push(a.offset(0,0));switch(this._geometryType){case d.POINT:this.onDrawStart();this._drawEnd(a.offset(0,0));this._setTooltipMessage(0);break;case d.POLYLINE:1===this._points.length?(c=new A(b.spatialReference),c.addPath(this._points),this._graphic=b.graphics.add(new y(c,this.lineSymbol),
!0),b.snappingManager&&b.snappingManager._setGraphic(this._graphic),this._onMouseMoveHandler_connect=v.connect(b,"onMouseMove",this._onMouseMoveHandler),this._tGraphic=b.graphics.add(new y(new A({paths:[[[a.x,a.y],[a.x,a.y]]],spatialReference:b.spatialReference}),this.lineSymbol),!0),this.onDrawStart()):(this._graphic.geometry._insertPoints([a.offset(0,0)],0),this._graphic.setGeometry(this._graphic.geometry).setSymbol(this.lineSymbol),b=this._tGraphic,c=b.geometry,c.setPoint(0,0,a.offset(0,0)),c.setPoint(0,
1,a.offset(0,0)),b.setGeometry(c));break;case d.POLYGON:1===this._points.length?(c=new z(b.spatialReference),c.addRing(this._points),this._graphic=b.graphics.add(new y(c,this.fillSymbol),!0),b.snappingManager&&b.snappingManager._setGraphic(this._graphic),this._onMouseMoveHandler_connect=v.connect(b,"onMouseMove",this._onMouseMoveHandler),this._tGraphic=b.graphics.add(new y(new A({paths:[[[a.x,a.y],[a.x,a.y]]],spatialReference:b.spatialReference}),this.fillSymbol),!0),this.onDrawStart()):(this._graphic.geometry._insertPoints([a.offset(0,
0)],0),this._graphic.setGeometry(this._graphic.geometry).setSymbol(this.fillSymbol),b=this._tGraphic,c=b.geometry,c.setPoint(0,0,a.offset(0,0)),c.setPoint(0,1,a.offset(0,0)),b.setGeometry(c));break;case d.MULTI_POINT:a=this._points;1===a.length?(c=new w(b.spatialReference),c.addPoint(a[a.length-1]),this._graphic=b.graphics.add(new y(c,this.markerSymbol),!0),b.snappingManager&&b.snappingManager._setGraphic(this._graphic),this.onDrawStart()):(this._graphic.geometry.addPoint(a[a.length-1]),this._graphic.setGeometry(this._graphic.geometry).setSymbol(this.markerSymbol));
break;case d.ARROW:this._addShape([[0,0],[-24,24],[-24,12],[-96,12],[-96,-12],[-24,-12],[-24,-24],[0,0]],c.x,c.y);break;case d.LEFT_ARROW:this._addShape([[0,0],[24,24],[24,12],[96,12],[96,-12],[24,-12],[24,-24],[0,0]],c.x,c.y);break;case d.RIGHT_ARROW:this._addShape([[0,0],[-24,24],[-24,12],[-96,12],[-96,-12],[-24,-12],[-24,-24],[0,0]],c.x,c.y);break;case d.UP_ARROW:this._addShape([[0,0],[-24,24],[-12,24],[-12,96],[12,96],[12,24],[24,24],[0,0]],c.x,c.y);break;case d.DOWN_ARROW:this._addShape([[0,
0],[-24,-24],[-12,-24],[-12,-96],[12,-96],[12,-24],[24,-24],[0,0]],c.x,c.y);break;case d.TRIANGLE:this._addShape([[0,-48],[41.56921938165306,24],[-41.56921938165306,24],[0,-48]],c.x,c.y);break;case d.RECTANGLE:this._addShape([[0,-96],[96,-96],[96,0],[0,0],[0,-96]],c.x-48,c.y+48);break;case d.CIRCLE:this._clear();this.onDrawStart();this._drawEnd(z.createCircle({center:c,r:48,numberOfPoints:60,map:b}));break;case d.ELLIPSE:this._clear(),this.onDrawStart(),this._drawEnd(z.createEllipse({center:c,longAxis:48,
shortAxis:24,numberOfPoints:60,map:b}))}this._setTooltipMessage(this._points.length)},_addShape:function(a,b,c){this._setTooltipMessage(0);this._clear();this.onDrawStart();this._drawEnd(this._toPolygon(a,b,c))},_toPolygon:function(a,b,c){var e=this.map,f=new z(e.spatialReference);f.addRing(d.map(a,function(a){return e.toMap({x:a[0]+b,y:a[1]+c})}));return f},_onDblClickHandler:function(a){var b,c=this._points,e=this.map.spatialReference,f=E;k("esri-touch")&&c.push(a.mapPoint);var g=c[c.length-1],h=
c[c.length-2],c=g&&h&&g.x===h.x&&g.y===h.y?c.slice(0,c.length-1):c.slice(0,c.length);switch(this._geometryType){case f.POLYLINE:if(!this._graphic||2>c.length){v.disconnect(this._onMouseMoveHandler_connect);this._clear();this._onClickHandler(a);return}b=new A(e);b.addPath([].concat(c));break;case f.POLYGON:if(!this._graphic||2>c.length){v.disconnect(this._onMouseMoveHandler_connect);this._clear();this._onClickHandler(a);return}b=new z(e);a=[].concat(c,[c[0].offset(0,0)]);z.prototype.isClockwise(a)||
this.respectDrawingVertexOrder||(console.debug(this.declaredClass+" :  Polygons drawn in anti-clockwise direction will be reversed to be clockwise."),a.reverse());b.addRing(a);break;case f.MULTI_POINT:b=new w(e),d.forEach(c,function(a){b.addPoint(a)})}v.disconnect(this._onMouseMoveHandler_connect);this._clear();this._setTooltipMessage(0);this._drawEnd(b)},_onKeyDownHandler:function(a){a.keyCode===c.ESCAPE&&(v.disconnect(this._onMouseMoveHandler_connect),this._clear(),this._setTooltipMessage(0))},
_toggleTooltip:function(a){this._options.showTooltips&&(a?this._tooltip||(this._tooltip=h.create("div",{"class":"esriMapTooltip"},this.map.container),u.isBodyLtr()||q.set(this._tooltip,"direction","rtl"),this._tooltip.style.display="none",this._tooltip.style.position="fixed",this._setTooltipMessage(0),this._onTooltipMouseEnterHandler_connect=v.connect(this.map,"onMouseOver",this._updateTooltip),this._onTooltipMouseLeaveHandler_connect=v.connect(this.map,"onMouseOut",this._hideTooltip),this._onTooltipMouseMoveHandler_connect=
v.connect(this.map,"onMouseMove",this._updateTooltip)):this._tooltip&&(v.disconnect(this._onTooltipMouseEnterHandler_connect),v.disconnect(this._onTooltipMouseLeaveHandler_connect),v.disconnect(this._onTooltipMouseMoveHandler_connect),h.destroy(this._tooltip),this._tooltip=null))},_hideTooltip:function(){var a=this._tooltip;a&&(a.style.display="none")},_setTooltipMessage:function(a){var b=this._tooltip;if(b){var c="";switch(this._geometryType){case E.POINT:c=C.toolbars.draw.addPoint;break;case E.ARROW:case E.LEFT_ARROW:case E.RIGHT_ARROW:case E.UP_ARROW:case E.DOWN_ARROW:case E.TRIANGLE:case E.RECTANGLE:case E.CIRCLE:case E.ELLIPSE:c=
C.toolbars.draw.addShape;break;case E.LINE:case E.EXTENT:case E.FREEHAND_POLYLINE:case E.FREEHAND_POLYGON:c=C.toolbars.draw.freehand;break;case E.POLYLINE:case E.POLYGON:c=C.toolbars.draw.start;1===a?c=C.toolbars.draw.resume:2<=a&&(c=C.toolbars.draw.complete);break;case E.MULTI_POINT:c=C.toolbars.draw.addMultipoint,1<=a&&(c=C.toolbars.draw.finish)}b.innerHTML=c}},_updateTooltip:function(a){var b=this._tooltip;if(b){var c;a.clientX||a.pageY?(c=a.clientX,a=a.clientY):(c=a.clientX+e.body().scrollLeft-
e.body().clientLeft,a=a.clientY+e.body().scrollTop-e.body().clientTop);b.style.display="none";q.set(b,{left:c+this._options.tooltipOffset+"px",top:a+"px"});b.style.display=""}},_redrawGraphic:function(a,b,c,d){if(c||this.map.wrapAround180)(a=this._graphic)&&a.setGeometry(a.geometry),(a=this._tGraphic)&&a.setGeometry(a.geometry)},onActivate:function(){},onDeactivate:function(){},onDrawComplete:function(){},onDrawStart:function(){},onDrawEnd:function(){}});n.mixin(E,{POINT:"point",MULTI_POINT:"multipoint",
LINE:"line",EXTENT:"extent",POLYLINE:"polyline",POLYGON:"polygon",FREEHAND_POLYLINE:"freehandpolyline",FREEHAND_POLYGON:"freehandpolygon",ARROW:"arrow",LEFT_ARROW:"leftarrow",RIGHT_ARROW:"rightarrow",UP_ARROW:"uparrow",DOWN_ARROW:"downarrow",TRIANGLE:"triangle",CIRCLE:"circle",ELLIPSE:"ellipse",RECTANGLE:"rectangle"});k("extend-esri")&&n.setObject("toolbars.Draw",E,x);return E})},"esri/tasks/ProjectParameters":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/json dojo/has ../kernel ../lang ../geometry/jsonUtils".split(" "),
function(m,n,d,v,t,e,k,r){m=m(null,{declaredClass:"esri.tasks.ProjectParameters",geometries:null,outSR:null,transformation:null,transformForward:null,toJson:function(){var c=d.map(this.geometries,function(c){return c.toJson()}),e={};e.outSR=this.outSR.wkid||v.toJson(this.outSR.toJson());e.inSR=this.geometries[0].spatialReference.wkid||v.toJson(this.geometries[0].spatialReference.toJson());e.geometries=v.toJson({geometryType:r.getJsonType(this.geometries[0]),geometries:c});this.transformation&&(e.transformation=
this.transformation.wkid||v.toJson(this.transformation));k.isDefined(this.transformForward)&&(e.transformForward=this.transformForward);return e}});t("extend-esri")&&n.setObject("tasks.ProjectParameters",m,e);return m})},"url:dijit/templates/Menu.html":'\x3ctable class\x3d"dijit dijitMenu dijitMenuPassive dijitReset dijitMenuTable" role\x3d"menu" tabIndex\x3d"${tabIndex}"\r\n\t   cellspacing\x3d"0"\x3e\r\n\t\x3ctbody class\x3d"dijitReset" data-dojo-attach-point\x3d"containerNode"\x3e\x3c/tbody\x3e\r\n\x3c/table\x3e\r\n',
"url:dijit/templates/MenuItem.html":'\x3ctr class\x3d"dijitReset" data-dojo-attach-point\x3d"focusNode" role\x3d"menuitem" tabIndex\x3d"-1"\x3e\r\n\t\x3ctd class\x3d"dijitReset dijitMenuItemIconCell" role\x3d"presentation"\x3e\r\n\t\t\x3cspan role\x3d"presentation" class\x3d"dijitInline dijitIcon dijitMenuItemIcon" data-dojo-attach-point\x3d"iconNode"\x3e\x3c/span\x3e\r\n\t\x3c/td\x3e\r\n\t\x3ctd class\x3d"dijitReset dijitMenuItemLabel" colspan\x3d"2" data-dojo-attach-point\x3d"containerNode,textDirNode"\r\n\t\trole\x3d"presentation"\x3e\x3c/td\x3e\r\n\t\x3ctd class\x3d"dijitReset dijitMenuItemAccelKey" style\x3d"display: none" data-dojo-attach-point\x3d"accelKeyNode"\x3e\x3c/td\x3e\r\n\t\x3ctd class\x3d"dijitReset dijitMenuArrowCell" role\x3d"presentation"\x3e\r\n\t\t\x3cspan data-dojo-attach-point\x3d"arrowWrapper" style\x3d"visibility: hidden"\x3e\r\n\t\t\t\x3cspan class\x3d"dijitInline dijitIcon dijitMenuExpand"\x3e\x3c/span\x3e\r\n\t\t\t\x3cspan class\x3d"dijitMenuExpandA11y"\x3e+\x3c/span\x3e\r\n\t\t\x3c/span\x3e\r\n\t\x3c/td\x3e\r\n\x3c/tr\x3e\r\n',
"url:dijit/templates/MenuSeparator.html":'\x3ctr class\x3d"dijitMenuSeparator" role\x3d"separator"\x3e\r\n\t\x3ctd class\x3d"dijitMenuSeparatorIconCell"\x3e\r\n\t\t\x3cdiv class\x3d"dijitMenuSeparatorTop"\x3e\x3c/div\x3e\r\n\t\t\x3cdiv class\x3d"dijitMenuSeparatorBottom"\x3e\x3c/div\x3e\r\n\t\x3c/td\x3e\r\n\t\x3ctd colspan\x3d"3" class\x3d"dijitMenuSeparatorLabelCell"\x3e\r\n\t\t\x3cdiv class\x3d"dijitMenuSeparatorTop dijitMenuSeparatorLabel"\x3e\x3c/div\x3e\r\n\t\t\x3cdiv class\x3d"dijitMenuSeparatorBottom"\x3e\x3c/div\x3e\r\n\t\x3c/td\x3e\r\n\x3c/tr\x3e\r\n',
"url:dijit/templates/Tooltip.html":'\x3cdiv class\x3d"dijitTooltip dijitTooltipLeft" id\x3d"dojoTooltip" data-dojo-attach-event\x3d"mouseenter:onMouseEnter,mouseleave:onMouseLeave"\r\n\t\x3e\x3cdiv class\x3d"dijitTooltipConnector" data-dojo-attach-point\x3d"connectorNode"\x3e\x3c/div\r\n\t\x3e\x3cdiv class\x3d"dijitTooltipContainer dijitTooltipContents" data-dojo-attach-point\x3d"containerNode" role\x3d\'alert\'\x3e\x3c/div\r\n\x3e\x3c/div\x3e\r\n',"url:dijit/form/templates/Select.html":'\x3ctable class\x3d"dijit dijitReset dijitInline dijitLeft"\r\n\tdata-dojo-attach-point\x3d"_buttonNode,tableNode,focusNode,_popupStateNode" cellspacing\x3d\'0\' cellpadding\x3d\'0\'\r\n\trole\x3d"listbox" aria-haspopup\x3d"true"\r\n\t\x3e\x3ctbody role\x3d"presentation"\x3e\x3ctr role\x3d"presentation"\r\n\t\t\x3e\x3ctd class\x3d"dijitReset dijitStretch dijitButtonContents" role\x3d"presentation"\r\n\t\t\t\x3e\x3cdiv class\x3d"dijitReset dijitInputField dijitButtonText"  data-dojo-attach-point\x3d"containerNode,textDirNode" role\x3d"presentation"\x3e\x3c/div\r\n\t\t\t\x3e\x3cdiv class\x3d"dijitReset dijitValidationContainer"\r\n\t\t\t\t\x3e\x3cinput class\x3d"dijitReset dijitInputField dijitValidationIcon dijitValidationInner" value\x3d"\x26#935; " type\x3d"text" tabIndex\x3d"-1" readonly\x3d"readonly" role\x3d"presentation"\r\n\t\t\t/\x3e\x3c/div\r\n\t\t\t\x3e\x3cinput type\x3d"hidden" ${!nameAttrSetting} data-dojo-attach-point\x3d"valueNode" value\x3d"${value}" aria-hidden\x3d"true"\r\n\t\t/\x3e\x3c/td\r\n\t\t\x3e\x3ctd class\x3d"dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer"\r\n\t\t\tdata-dojo-attach-point\x3d"titleNode" role\x3d"presentation"\r\n\t\t\t\x3e\x3cinput class\x3d"dijitReset dijitInputField dijitArrowButtonInner" value\x3d"\x26#9660; " type\x3d"text" tabIndex\x3d"-1" readonly\x3d"readonly" role\x3d"presentation"\r\n\t\t\t\t${_buttonInputDisabled}\r\n\t\t/\x3e\x3c/td\r\n\t\x3e\x3c/tr\x3e\x3c/tbody\r\n\x3e\x3c/table\x3e\r\n',
"url:dijit/form/templates/TextBox.html":'\x3cdiv class\x3d"dijit dijitReset dijitInline dijitLeft" id\x3d"widget_${id}" role\x3d"presentation"\r\n\t\x3e\x3cdiv class\x3d"dijitReset dijitInputField dijitInputContainer"\r\n\t\t\x3e\x3cinput class\x3d"dijitReset dijitInputInner" data-dojo-attach-point\x3d\'textbox,focusNode\' autocomplete\x3d"off"\r\n\t\t\t${!nameAttrSetting} type\x3d\'${type}\'\r\n\t/\x3e\x3c/div\r\n\x3e\x3c/div\x3e\r\n',"url:dijit/form/templates/ValidationTextBox.html":'\x3cdiv class\x3d"dijit dijitReset dijitInline dijitLeft"\r\n\tid\x3d"widget_${id}" role\x3d"presentation"\r\n\t\x3e\x3cdiv class\x3d\'dijitReset dijitValidationContainer\'\r\n\t\t\x3e\x3cinput class\x3d"dijitReset dijitInputField dijitValidationIcon dijitValidationInner" value\x3d"\x26#935; " type\x3d"text" tabIndex\x3d"-1" readonly\x3d"readonly" role\x3d"presentation"\r\n\t/\x3e\x3c/div\r\n\t\x3e\x3cdiv class\x3d"dijitReset dijitInputField dijitInputContainer"\r\n\t\t\x3e\x3cinput class\x3d"dijitReset dijitInputInner" data-dojo-attach-point\x3d\'textbox,focusNode\' autocomplete\x3d"off"\r\n\t\t\t${!nameAttrSetting} type\x3d\'${type}\'\r\n\t/\x3e\x3c/div\r\n\x3e\x3c/div\x3e\r\n',
"url:dijit/templates/Calendar.html":'\x3cdiv class\x3d"dijitCalendarContainer dijitInline" role\x3d"presentation" aria-labelledby\x3d"${id}_mddb ${id}_year"\x3e\r\n\t\x3cdiv class\x3d"dijitReset dijitCalendarMonthContainer" role\x3d"presentation"\x3e\r\n\t\t\x3cdiv class\x3d\'dijitReset dijitCalendarArrow dijitCalendarDecrementArrow\' data-dojo-attach-point\x3d"decrementMonth"\x3e\r\n\t\t\t\x3cimg src\x3d"${_blankGif}" alt\x3d"" class\x3d"dijitCalendarIncrementControl dijitCalendarDecrease" role\x3d"presentation"/\x3e\r\n\t\t\t\x3cspan data-dojo-attach-point\x3d"decreaseArrowNode" class\x3d"dijitA11ySideArrow"\x3e-\x3c/span\x3e\r\n\t\t\x3c/div\x3e\r\n\t\t\x3cdiv class\x3d\'dijitReset dijitCalendarArrow dijitCalendarIncrementArrow\' data-dojo-attach-point\x3d"incrementMonth"\x3e\r\n\t\t\t\x3cimg src\x3d"${_blankGif}" alt\x3d"" class\x3d"dijitCalendarIncrementControl dijitCalendarIncrease" role\x3d"presentation"/\x3e\r\n\t\t\t\x3cspan data-dojo-attach-point\x3d"increaseArrowNode" class\x3d"dijitA11ySideArrow"\x3e+\x3c/span\x3e\r\n\t\t\x3c/div\x3e\r\n\t\t\x3cdiv data-dojo-attach-point\x3d"monthNode" class\x3d"dijitInline"\x3e\x3c/div\x3e\r\n\t\x3c/div\x3e\r\n\t\x3ctable cellspacing\x3d"0" cellpadding\x3d"0" role\x3d"grid" data-dojo-attach-point\x3d"gridNode"\x3e\r\n\t\t\x3cthead\x3e\r\n\t\t\t\x3ctr role\x3d"row"\x3e\r\n\t\t\t\t${!dayCellsHtml}\r\n\t\t\t\x3c/tr\x3e\r\n\t\t\x3c/thead\x3e\r\n\t\t\x3ctbody data-dojo-attach-point\x3d"dateRowsNode" data-dojo-attach-event\x3d"ondijitclick: _onDayClick" class\x3d"dijitReset dijitCalendarBodyContainer"\x3e\r\n\t\t\t\t${!dateRowsHtml}\r\n\t\t\x3c/tbody\x3e\r\n\t\x3c/table\x3e\r\n\t\x3cdiv class\x3d"dijitReset dijitCalendarYearContainer" role\x3d"presentation"\x3e\r\n\t\t\x3cdiv class\x3d"dijitCalendarYearLabel"\x3e\r\n\t\t\t\x3cspan data-dojo-attach-point\x3d"previousYearLabelNode" class\x3d"dijitInline dijitCalendarPreviousYear" role\x3d"button"\x3e\x3c/span\x3e\r\n\t\t\t\x3cspan data-dojo-attach-point\x3d"currentYearLabelNode" class\x3d"dijitInline dijitCalendarSelectedYear" role\x3d"button" id\x3d"${id}_year"\x3e\x3c/span\x3e\r\n\t\t\t\x3cspan data-dojo-attach-point\x3d"nextYearLabelNode" class\x3d"dijitInline dijitCalendarNextYear" role\x3d"button"\x3e\x3c/span\x3e\r\n\t\t\x3c/div\x3e\r\n\t\x3c/div\x3e\r\n\x3c/div\x3e\r\n',
"url:dijit/form/templates/Button.html":'\x3cspan class\x3d"dijit dijitReset dijitInline" role\x3d"presentation"\r\n\t\x3e\x3cspan class\x3d"dijitReset dijitInline dijitButtonNode"\r\n\t\tdata-dojo-attach-event\x3d"ondijitclick:__onClick" role\x3d"presentation"\r\n\t\t\x3e\x3cspan class\x3d"dijitReset dijitStretch dijitButtonContents"\r\n\t\t\tdata-dojo-attach-point\x3d"titleNode,focusNode"\r\n\t\t\trole\x3d"button" aria-labelledby\x3d"${id}_label"\r\n\t\t\t\x3e\x3cspan class\x3d"dijitReset dijitInline dijitIcon" data-dojo-attach-point\x3d"iconNode"\x3e\x3c/span\r\n\t\t\t\x3e\x3cspan class\x3d"dijitReset dijitToggleButtonIconChar"\x3e\x26#x25CF;\x3c/span\r\n\t\t\t\x3e\x3cspan class\x3d"dijitReset dijitInline dijitButtonText"\r\n\t\t\t\tid\x3d"${id}_label"\r\n\t\t\t\tdata-dojo-attach-point\x3d"containerNode"\r\n\t\t\t\x3e\x3c/span\r\n\t\t\x3e\x3c/span\r\n\t\x3e\x3c/span\r\n\t\x3e\x3cinput ${!nameAttrSetting} type\x3d"${type}" value\x3d"${value}" class\x3d"dijitOffScreen"\r\n\t\tdata-dojo-attach-event\x3d"onclick:_onClick"\r\n\t\ttabIndex\x3d"-1" aria-hidden\x3d"true" data-dojo-attach-point\x3d"valueNode"\r\n/\x3e\x3c/span\x3e\r\n',
"url:dijit/form/templates/DropDownButton.html":'\x3cspan class\x3d"dijit dijitReset dijitInline"\r\n\t\x3e\x3cspan class\x3d\'dijitReset dijitInline dijitButtonNode\'\r\n\t\tdata-dojo-attach-event\x3d"ondijitclick:__onClick" data-dojo-attach-point\x3d"_buttonNode"\r\n\t\t\x3e\x3cspan class\x3d"dijitReset dijitStretch dijitButtonContents"\r\n\t\t\tdata-dojo-attach-point\x3d"focusNode,titleNode,_arrowWrapperNode,_popupStateNode"\r\n\t\t\trole\x3d"button" aria-haspopup\x3d"true" aria-labelledby\x3d"${id}_label"\r\n\t\t\t\x3e\x3cspan class\x3d"dijitReset dijitInline dijitIcon"\r\n\t\t\t\tdata-dojo-attach-point\x3d"iconNode"\r\n\t\t\t\x3e\x3c/span\r\n\t\t\t\x3e\x3cspan class\x3d"dijitReset dijitInline dijitButtonText"\r\n\t\t\t\tdata-dojo-attach-point\x3d"containerNode"\r\n\t\t\t\tid\x3d"${id}_label"\r\n\t\t\t\x3e\x3c/span\r\n\t\t\t\x3e\x3cspan class\x3d"dijitReset dijitInline dijitArrowButtonInner"\x3e\x3c/span\r\n\t\t\t\x3e\x3cspan class\x3d"dijitReset dijitInline dijitArrowButtonChar"\x3e\x26#9660;\x3c/span\r\n\t\t\x3e\x3c/span\r\n\t\x3e\x3c/span\r\n\t\x3e\x3cinput ${!nameAttrSetting} type\x3d"${type}" value\x3d"${value}" class\x3d"dijitOffScreen" tabIndex\x3d"-1"\r\n\t\tdata-dojo-attach-event\x3d"onclick:_onClick" data-dojo-attach-point\x3d"valueNode" aria-hidden\x3d"true"\r\n/\x3e\x3c/span\x3e\r\n',
"url:dijit/form/templates/DropDownBox.html":'\x3cdiv class\x3d"dijit dijitReset dijitInline dijitLeft"\r\n\tid\x3d"widget_${id}"\r\n\trole\x3d"combobox"\r\n\taria-haspopup\x3d"true"\r\n\tdata-dojo-attach-point\x3d"_popupStateNode"\r\n\t\x3e\x3cdiv class\x3d\'dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer\'\r\n\t\tdata-dojo-attach-point\x3d"_buttonNode" role\x3d"presentation"\r\n\t\t\x3e\x3cinput class\x3d"dijitReset dijitInputField dijitArrowButtonInner" value\x3d"\x26#9660; " type\x3d"text" tabIndex\x3d"-1" readonly\x3d"readonly" role\x3d"button presentation" aria-hidden\x3d"true"\r\n\t\t\t${_buttonInputDisabled}\r\n\t/\x3e\x3c/div\r\n\t\x3e\x3cdiv class\x3d\'dijitReset dijitValidationContainer\'\r\n\t\t\x3e\x3cinput class\x3d"dijitReset dijitInputField dijitValidationIcon dijitValidationInner" value\x3d"\x26#935; " type\x3d"text" tabIndex\x3d"-1" readonly\x3d"readonly" role\x3d"presentation"\r\n\t/\x3e\x3c/div\r\n\t\x3e\x3cdiv class\x3d"dijitReset dijitInputField dijitInputContainer"\r\n\t\t\x3e\x3cinput class\x3d\'dijitReset dijitInputInner\' ${!nameAttrSetting} type\x3d"${type}" autocomplete\x3d"off"\r\n\t\t\tdata-dojo-attach-point\x3d"textbox,focusNode" role\x3d"textbox"\r\n\t/\x3e\x3c/div\r\n\x3e\x3c/div\x3e\r\n',
"url:esri/dijit/templates/Directions.html":'\x3cdiv class\x3d"${options.theme}" role\x3d"presentation"\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"_widgetContainer" class\x3d"${_css.widgetContainerClass}" role\x3d"presentation"\x3e\r\n        \x3cdiv class\x3d"${_css.stopsContainerClass}" role\x3d"presentation"\x3e\r\n            \x3cdiv id\x3d"search-source-container" class\x3d"${_css.searchSourceContainerClass}" data-dojo-attach-point\x3d"_searchSourceContainerNode"\x3e\r\n                \x3cdiv data-dojo-attach-point\x3d"_searchSourceSelectorContainer"\x3e\x3c/div\x3e\r\n            \x3c/div\x3e\r\n            \x3cdiv class\x3d"${_css.stopsTableContainerClass}"\x3e\r\n                \x3ctable class\x3d"${_css.stopsClass}" data-dojo-attach-point\x3d"_dndNode"\x3e\x3c/table\x3e\r\n                \x3cdiv class\x3d"${_css.stopsTableCoverClass}" data-dojo-attach-point\x3d"_stopsTableCover"\x3e\x3c/div\x3e\r\n            \x3c/div\x3e\r\n            \x3cdiv class\x3d"${_css.clearClass}"\x3e\x3c/div\x3e\r\n            \x3cdiv class\x3d"${_css.stopsButtonContainerClass}"\x3e\r\n                \x3cdiv class\x3d"${_css.stopsAddDestinationClass}"\x3e\r\n                    \x3cdiv tabindex\x3d"0" role\x3d"button" data-dojo-attach-point\x3d"_activateButtonNode" title\x3d"${_i18n.widgets.directions.activate}" class\x3d"${_css.activateButtonClass} ${_css.stopsButtonClass} ${_css.stopsButtonTabClass} ${_css.stopsPressedButtonClass}" data-blur-on-click\x3d"true"\x3e\x3c/div\x3e\r\n                    \x3cdiv tabindex\x3d"0" role\x3d"button" data-dojo-attach-point\x3d"_lineBarrierButtonNode" title\x3d"${_i18n.widgets.directions.lineBarrier}" class\x3d"${_css.lineBarrierButtonClass} ${_css.stopsButtonClass} ${_css.stopsButtonTabClass}" data-blur-on-click\x3d"true"\x3e\x3c/div\x3e\r\n                    \x3cdiv role\x3d"button" tabindex\x3d"0" class\x3d"${_css.linkButtonClass} ${_css.stopsAddDestinationBtnClass}" data-dojo-attach-point\x3d"_addDestinationNode" data-blur-on-click\x3d"true"\x3e${_i18n.widgets.directions.addDestination}\x3c/div\x3e\r\n                \x3c/div\x3e\r\n                \x3cdiv class\x3d"${_css.travelModesContainerClass}" data-dojo-attach-point\x3d"_travelModeContainerNode"\x3e\r\n                    \x3cdiv data-dojo-attach-point\x3d"_travelModeSelectorContainer"\x3e\x3c/div\x3e\r\n                \x3c/div\x3e\r\n                \x3cdiv tabindex\x3d"0" role\x3d"button" class\x3d"${_css.linkButtonClass} startTimeMenuButton" data-blur-on-click\x3d"true" data-dojo-attach-point\x3d"_startTimeButtonNodeContainer"\x3e\r\n                    \x3cdiv data-dojo-attach-point\x3d"_startTimeButtonNode"\x3e\r\n                        \x3cspan data-dojo-attach-point\x3d"_startTimeButtonLabel"\x3e${_i18n.widgets.directions.leaveNow}\x3c/span\x3e\r\n                        \x3cdiv data-dojo-attach-point\x3d"_startTimeDDLArrow" class\x3d"esriDirectionsDDLArrow"\x3e\x3c/div\x3e\r\n                    \x3c/div\x3e\r\n                    \x3cdiv class\x3d"startTimeMenu" data-dojo-attach-point\x3d"_startTimeMenu"\x3e\r\n                        \x3cul role\x3d"menu"\x3e\r\n                            \x3cli data-dojo-attach-point\x3d"_startTimeMenuLeaveNow" tabindex\x3d"0" class\x3d"esriRouteZoom startTimeMenuItem" role\x3d"menuitemradio" aria-checked\x3d"true"\x3e${_i18n.widgets.directions.leaveNow}\x3c/li\x3e\r\n                            \x3cli data-dojo-attach-point\x3d"_startTimeMenuDepartAt" tabindex\x3d"0" class\x3d"esriRouteZoom startTimeMenuItem" role\x3d"menuitemradio"\x3e${_i18n.widgets.directions.departAt}\x3c/li\x3e\r\n                            \x3cli data-dojo-attach-point\x3d"_startTimeMenuNone" tabindex\x3d"0" class\x3d"esriRouteZoom startTimeMenuItem" role\x3d"menuitemradio"\x3e${_i18n.widgets.directions.noStartTime}\x3c/li\x3e\r\n                        \x3c/ul\x3e\r\n                    \x3c/div\x3e\r\n                \x3c/div\x3e\r\n                \x3cdiv tabindex\x3d"0" role\x3d"button" class\x3d"${_css.linkButtonClass} ${_css.stopsOptionsButtonClass}" data-dojo-attach-point\x3d"_optionsButtonNode" data-blur-on-click\x3d"true"\x3e${_i18n.widgets.directions.showOptions}\x3c/div\x3e\r\n            \t\x3cdiv class\x3d"${_css.clearClass}"\x3e\x3c/div\x3e\r\n                \x3cdiv class\x3d"departAtContainer" data-dojo-attach-point\x3d"_departAtContainer"\x3e\r\n                    \x3cdiv id\x3d"${id}_directionsDepartAtTime" data-dojo-attach-point\x3d"_departAtTimeContainer"\x3e\x3c/div\x3e\r\n                    \x3cdiv id\x3d"${id}_directionsDepartAtDate" data-dojo-attach-point\x3d"_departAtDateContainer"\x3e\x3c/div\x3e\r\n                \x3c/div\x3e\r\n            \x3c/div\x3e\r\n            \x3cdiv role\x3d"presentation" class\x3d"${_css.stopsOptionsMenuClass}" data-dojo-attach-point\x3d"_optionsMenuNode"\x3e\r\n                \x3cdiv class\x3d"${_css.stopsOptionsCheckboxesClass}"\x3e\r\n                    \x3cul\x3e\r\n                        \x3cli class\x3d"${_css.stopsFindOptimalOrderClass}" data-dojo-attach-point\x3d"_findOptimalOrderItemNode"\x3e\x3cinput tabindex\x3d"0" data-dojo-attach-point\x3d"_findOptimalOrderNode" type\x3d"checkbox" id\x3d"${id}_find_optimal_order" /\x3e\x3clabel for\x3d"${id}_find_optimal_order"\x3e${_i18n.widgets.directions.findOptimalOrder}\x3c/label\x3e\x3c/li\x3e\r\n                        \x3cli class\x3d"${_css.stopsReturnToStartClass}" data-dojo-attach-point\x3d"_returnToStartItemNode"\x3e\x3cinput tabindex\x3d"0" data-dojo-attach-point\x3d"_returnToStartNode" type\x3d"checkbox" id\x3d"${id}_stopsReturnToStart" /\x3e\x3clabel for\x3d"${id}_stopsReturnToStart"\x3e${_i18n.widgets.directions.returnToStart}\x3c/label\x3e\x3c/li\x3e\r\n                        \x3cli class\x3d"${_css.stopsUseTrafficClass}" data-dojo-attach-point\x3d"_useTrafficItemNode" title\x3d"${_i18n.widgets.directions.trafficLabelLive}"\x3e\r\n                            \x3cinput tabindex\x3d"0" data-dojo-attach-point\x3d"_useTrafficNode" type\x3d"checkbox" id\x3d"${id}_stopsUseTraffic" /\x3e\x3clabel for\x3d"${id}_stopsUseTraffic"\x3e${_i18n.widgets.directions.useTraffic}\x3c/label\x3e\r\n                            \x3ca data-dojo-attach-point\x3d"_trafficAvailabilityButton" style\x3d"display: none;" href\x3d"http://www.arcgis.com/home/item.html?id\x3db7a893e8e1e04311bd925ea25cb8d7c7" target\x3d"_blank"\x3e\x3cdiv class\x3d"esriTrafficAvailabilityButton" title\x3d"${_i18n.widgets.directions.seeTrafficAvailability}"\x3e\x3c/div\x3e\x3c/a\x3e\r\n                        \x3c/li\x3e\r\n                    \x3c/ul\x3e\r\n                \x3c/div\x3e\r\n                \x3cdiv class\x3d"${_css.stopsOptionsToggleContainerClass}"\x3e\r\n                    \x3cdiv class\x3d"${_css.stopsOptionsUnitsContainerClass}"  data-dojo-attach-point\x3d"_agolDistanceUnitsNode"\x3e\r\n                        \x3cdiv tabindex\x3d"0" role\x3d"button" class\x3d"${_css.stopsOptionsUnitsMiClass} ${_css.stopsButtonClass}" data-dojo-attach-point\x3d"_useMilesNode" data-blur-on-click\x3d"true"\x3e${_i18n.widgets.directions.units.esriMiles.abbr}\x3c/div\x3e\r\n                        \x3cdiv tabindex\x3d"0" role\x3d"button" class\x3d"${_css.stopsOptionsUnitsKmClass} ${_css.stopsButtonClass} ${_css.stopsButtonTabLastClass} ${_css.stopsPressedButtonClass}" data-dojo-attach-point\x3d"_useKilometersNode" data-blur-on-click\x3d"true"\x3e${_i18n.widgets.directions.units.esriKilometers.abbr}\x3c/div\x3e\r\n                        \x3cdiv class\x3d"${_css.clearClass}"\x3e\x3c/div\x3e\r\n                    \x3c/div\x3e\r\n                    \x3cdiv class\x3d"${_css.clearClass}"\x3e\x3c/div\x3e\r\n                \x3c/div\x3e\r\n                \x3cdiv class\x3d"${_css.clearClass}"\x3e\x3c/div\x3e\r\n            \x3c/div\x3e\r\n            \x3cdiv class\x3d"${_css.stopsGetDirectionsContainerClass}"\x3e\r\n                \x3cdiv class\x3d"getDirectionsBtnContainer"\x3e\r\n                    \x3cdiv tabindex\x3d"0" role\x3d"button" class\x3d"${_css.stopsButtonClass} ${_css.stopsGetDirectionsClass} esriDisabledDirectionsButton" data-dojo-attach-point\x3d"_getDirectionsButtonNode" data-blur-on-click\x3d"true"\x3e${_i18n.widgets.directions.getDirections}\x3c/div\x3e\r\n                    \x3cdiv tabindex\x3d"0" role\x3d"button" class\x3d"${_css.linkButtonClass} ${_css.stopsClearDirectionsClass}" data-dojo-attach-point\x3d"_clearDirectionsButtonNode" data-blur-on-click\x3d"true"\x3e${_i18n.widgets.directions.clearDirections}\x3c/div\x3e\r\n                \x3c/div\x3e\r\n                \x3cdiv class\x3d"savePrintBtnContainer" data-dojo-attach-point\x3d"_savePrintBtnContainer"\x3e\r\n                    \x3cdiv tabindex\x3d"0" role\x3d"button" class\x3d"${_css.resultsSaveClass} ${_css.stopsButtonClass} ${_css.stopsButtonTabClass}" data-blur-on-click\x3d"true" data-dojo-attach-point\x3d"_saveMenuButton" title\x3d"${_i18n.widgets.directions.saveTitle}" \x3e\x3c/div\x3e\r\n                    \x3cdiv tabindex\x3d"0" role\x3d"button" class\x3d"${_css.resultsPrintClass} ${_css.stopsButtonClass} ${_css.stopsButtonTabClass}" data-blur-on-click\x3d"true" data-dojo-attach-point\x3d"_printButton" title\x3d"${_i18n.widgets.directions.print}" \x3e\x3c/div\x3e\r\n                \x3c/div\x3e\r\n            \x3c/div\x3e\r\n            \x3cdiv role\x3d"presentation" class\x3d"${_css.stopsOptionsMenuClass} esriSaveContainer" data-dojo-attach-point\x3d"_saveMenuNode"\x3e\r\n                \x3cdiv class\x3d"esriLayerNameLabel"\x3e${_i18n.widgets.directions.layerName}\x3c/div\x3e\r\n                \x3cinput type\x3d"text" data-dojo-attach-point\x3d"_outputLayerContainer"\x3e\r\n                \x3cdiv data-dojo-attach-point\x3d"_folderSelectorContainer"\x3e\x3c/div\x3e\r\n                \x3cdiv tabindex\x3d"0" role\x3d"button" class\x3d"${_css.stopsButtonClass} esriSaveButton esriDisabledDirectionsButton" data-dojo-attach-point\x3d"_saveButton" data-blur-on-click\x3d"true"\x3e${_i18n.widgets.directions.save}\x3c/div\x3e\r\n                \x3cdiv tabindex\x3d"0" role\x3d"button" class\x3d"esriLinkButton esriSaveAsButton" data-dojo-attach-point\x3d"_saveAsButton" data-blur-on-click\x3d"true"\x3e${_i18n.widgets.directions.saveAs}\x3c/div\x3e\r\n            \x3c/div\x3e\r\n    \t\x3c/div\x3e\r\n    \t\x3cdiv class\x3d"${_css.clearClass}"\x3e\x3c/div\x3e\r\n    \t\x3cdiv data-dojo-attach-point\x3d"_msgNode" role\x3d"presentation"\x3e\x3c/div\x3e\r\n    \t\x3cdiv class\x3d"${_css.resultsContainerClass}" role\x3d"presentation"\x3e\r\n        \t\x3cdiv class\x3d"${_css.routesContainerClass}" data-dojo-attach-point\x3d"_resultsNode" role\x3d"presentation"\x3e\x3c/div\x3e\r\n    \t\x3c/div\x3e\r\n    \x3c/div\x3e\r\n\x3c/div\x3e',
"url:esri/dijit/Search/templates/Search.html":'\x3cdiv role\x3d"presentation" class\x3d"${theme}"\x3e\r\n  \x3cdiv role\x3d"presentation" class\x3d"${css.searchGroup}" data-dojo-attach-point\x3d"containerNode"\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"expandNode" class\x3d"${css.searchExpandContainer}"\x3e\r\n      \x3cdiv class\x3d"${css.searchAnimateContainer}"\x3e\r\n        \x3cdiv role\x3d"button" title\x3d"${_i18n.widgets.Search.main.searchIn}" id\x3d"${id}_menu_button" class\x3d"${css.searchBtn} ${css.searchToggle}" tabindex\x3d"0" data-dojo-attach-point\x3d"sourcesBtnNode"\x3e\r\n          \x3cspan aria-hidden\x3d"true" role\x3d"presentation" class\x3d"${css.searchToggleIcon}"\x3e\x3c/span\x3e\x3cspan class\x3d"${css.searchSourceName}" data-dojo-attach-point\x3d"sourceNameNode"\x3e\x3c/span\x3e\r\n        \x3c/div\x3e\r\n        \x3cdiv class\x3d"${css.searchInputGroup}"\x3e\r\n          \x3cform data-dojo-attach-point\x3d"formNode"\x3e\r\n            \x3cinput maxlength\x3d"${maxLength}" autocomplete\x3d"off" type\x3d"text" tabindex\x3d"0" class\x3d"${css.searchInput}" value\x3d"${value}" aria-haspopup\x3d"true" id\x3d"${id}_input" data-dojo-attach-point\x3d"inputNode" role\x3d"textbox"\x3e\r\n          \x3c/form\x3e\r\n          \x3cdiv role\x3d"button" class\x3d"${css.searchClear}" tabindex\x3d"0" data-dojo-attach-point\x3d"clearNode"\x3e\x3cspan aria-hidden\x3d"true" class\x3d"${css.searchClearIcon}"\x3e\x3c/span\x3e\x3cspan aria-hidden\x3d"true" class\x3d"${css.searchSpinner}"\x3e\x3c/span\x3e\r\n          \x3c/div\x3e\r\n          \x3cdiv data-dojo-attach-point\x3d"suggestionsNode" class\x3d"${css.searchMenu} ${css.suggestionsMenu}"\x3e\x3c/div\x3e\r\n        \x3c/div\x3e\r\n      \x3c/div\x3e\r\n    \x3c/div\x3e\r\n    \x3cdiv role\x3d"button" title\x3d"${_i18n.widgets.Search.main.searchButtonTitle}" class\x3d"${css.searchBtn} ${css.searchSubmit}" tabindex\x3d"0" data-dojo-attach-point\x3d"submitNode"\x3e\r\n      \x3cspan aria-hidden\x3d"true" role\x3d"presentation" class\x3d"${css.searchIcon}"\x3e\x3c/span\x3e\r\n      \x3cspan class\x3d"${css.searchButtonText}"\x3e${_i18n.widgets.Search.main.searchButtonTitle}\x3c/span\x3e\r\n    \x3c/div\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"sourcesNode" class\x3d"${css.searchMenu} ${css.sourcesMenu}"\x3e\x3c/div\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"noResultsMenuNode" class\x3d"${css.searchMenu} ${css.searchNoResultsMenu}"\x3e\x3c/div\x3e\r\n    \x3cdiv class\x3d"${css.searchClearFloat}"\x3e\x3c/div\x3e\r\n  \x3c/div\x3e\r\n\x3c/div\x3e',
"*now":function(m){m(['dojo/i18n!*preload*esri/dijit/nls/Directions*["ar","az","ca","cs","da","de-de","el","en-gb","en-us","es-es","fi-fi","fr-fr","he-il","hu","it-it","ja-jp","ko-kr","nl-nl","nb","pl","pt-br","pt-pt","ro","ru","sk","sl","sv","th","tr","zh-tw","zh-cn","ROOT"]'])},"*noref":1}});
define("esri/dijit/Directions","require dojo/_base/declare dojo/_base/lang dojo/_base/kernel dojo/_base/array dojo/_base/Color dijit/a11yclick dijit/_TemplatedMixin dijit/form/Select dijit/form/ValidationTextBox dijit/form/DateTextBox dijit/form/TimeTextBox dojo/store/Memory dojo/data/ObjectStore dojo/keys dojo/has dojo/on dojo/mouse dojo/dom dojo/dom-geometry dojo/dom-style dojo/dom-class dojo/dom-attr dojo/query dojo/number dojo/i18n!../nls/jsapi dojo/text!./templates/Directions.html ./Search dojo/dom-construct dojo/promise/all dojo/Deferred dojo/dnd/Source dojo/json ../kernel ../urlUtils ../graphic ../units ../TimeExtent ../InfoTemplate ../SpatialReference ../layers/ArcGISDynamicMapServiceLayer ../layers/GraphicsLayer ../geometry/webMercatorUtils ../geometry/geodesicUtils ../arcgis/utils ../geometry/Point ../geometry/Extent ../geometry/Polyline ../geometry/mathUtils ../symbols/SimpleMarkerSymbol ../symbols/PictureMarkerSymbol ../symbols/CartographicLineSymbol ../symbols/TextSymbol ../renderers/UniqueValueRenderer ../symbols/Font ./_EventedWidget ../tasks/FeatureSet ../tasks/RouteTask ../tasks/RouteParameters ../tasks/GeometryService ../tasks/DistanceParameters ../tasks/PrintTask ../tasks/PrintParameters ../tasks/PrintTemplate ../toolbars/edit ../toolbars/draw ../config ../tasks/ProjectParameters dojo/uacss".split(" "),function(m,
n,d,v,t,e,k,r,c,h,q,u,x,b,g,a,f,l,y,F,B,A,z,w,D,C,E,O,J,K,I,X,P,N,L,H,Q,ja,V,ba,Z,T,R,Y,da,U,ka,fa,sa,ma,aa,ca,oa,ga,M,S,ta,wa,xa,pa,ya,qa,za,ra,na,ua,Ba,Ca){var ia=L.getProtocolForWebResource();n=n("esri.dijit.Directions",[S,r],{templateString:E,mapClickActive:!1,barrierToolActive:!1,_eventMap:{activate:!0,deactivate:!1,load:!0,"directions-start":!0,"directions-finish":["result"],"directions-clear":!0,"segment-select":["graphic"],"segment-highlight":["graphic"],error:["error"],"stops-update":["stops"],
"route-item-created":!0,"route-item-updated":!0,"feature-collection-created":!0},_emptyStop:{name:""},constructor:function(a,b){if(!a.map)throw Error('Required "map" parameter is missing. Cannot instantiate Directions Widget.');if(!b)throw Error('Required "srcNodeRef" parameter is missing. Cannot instantiate Directions Widget.');this._i18n=C;this._css={widgetContainerClass:"esriDirectionsContainer",searchSourceContainerClass:"esriSearchSourceContainer",stopsContainerClass:"esriStopsContainer",stopsTableContainerClass:"esriStopsTableContainer",
stopsTableCoverClass:"esriStopsTableCover",reverseStopsClass:"esriStopsReverse",addStopsClass:"esriStopsAdd",stopsClass:"esriStops",stopsRemovableClass:"esriStopsRemovable",stopsButtonContainerClass:"esriStopsButtons",stopsOptionsButtonClass:"esriStopsOptionsButton",stopsAddDestinationClass:"esriStopsAddDestination",stopsAddDestinationBtnClass:"esriStopsAddDestinationBtn",stopsGetDirectionsContainerClass:"esriStopsGetDirectionsContainer",stopsGetDirectionsClass:"esriStopsGetDirections",stopsClearDirectionsClass:"esriStopsClearDirections",
stopsInnerGeocoderClass:"esriInnerGeocoder",stopsOptionsOptionsEnabledClass:"esriStopsOptionsEnabled",stopsOptionsMenuClass:"esriStopsOptionsMenu",stopsFindOptimalOrderClass:"esriFindOptimalOrderOption",stopsUseTrafficClass:"esriUseTrafficOption",stopsReturnToStartClass:"esriReturnToStartOption",stopsOptionsCheckboxesClass:"esriOptionsCheckboxes",stopsOptionsToggleContainerClass:"esriOptionsToggleContainer",stopsOptionsUnitsContainerClass:"esriOptionsUnitsContainer",stopsOptionsUnitsMiClass:"esriOptionsUnitsMi",
stopsOptionsUnitsKmClass:"esriOptionsUnitsKm",stopsOptionsImpedanceContainerClass:"esriOptionsImpedanceContainer",stopsOptionsImpedanceTimeClass:"esriOptionsImpedanceTime",stopsOptionsImpedanceDistanceClass:"esriOptionsImpedanceDistance",stopClass:"esriStop",stopOriginClass:"esriStopOrigin",stopDestinationClass:"esriStopDestination",stopUnreachedFirstOrLastClass:"esriStopUnreachedFirstOrLast",stopUnreachedClass:"esriStopUnreached",esriStopGeocoderColumnClass:"esriStopGeocoderColumn",esriStopReverseColumnClass:"esriStopReverseColumn",
stopDnDHandleClass:"esriStopDnDHandle",stopDnDHandleClassHidden:"esriStopDnDHandleHidden",stopIconColumnClass:"esriStopIconColumn",stopIconClass:"esriStopIcon",stopIconRemoveColumnClass:"esriStopIconRemoveColumn",stopIconRemoveClass:"esriStopIconRemove",stopIconRemoveClassHidden:"esriStopIconRemoveHidden",resultsContainerClass:"esriResultsContainer",resultsLoadingClass:"esriResultsLoading",resultsPrintClass:"esriResultsPrint",resultsSaveClass:"esriResultsSave",resultsSummaryClass:"esriResultsSummary",
routesContainerClass:"esriRoutesContainer",routesClass:"esriRoutes",routesErrorClass:"esriRoutesError",routesInfoClass:"esriRoutesInfo",routeClass:"esriRoute",routeTextColumnClass:"esriRouteTextColumn",routeTextClass:"esriRouteText",routeLengthClass:"esriRouteLength",routeOriginClass:"esriDMTStopOrigin",routeDestinationClass:"esriDMTStopDestination",routeInfoClass:"esriRouteInfo",routeIconColumnClass:"esriRouteIconColumn",routeIconClass:"esriRouteIcon",infoWindowRouteClass:"esriInfoWindowRoute",routeZoomClass:"esriRouteZoom",
esriPrintPageClass:"esriPrintPage",esriPrintBarClass:"esriPrintBar",esriPrintButtonClass:"esriPrintButton",esriCloseButtonClass:"esriCloseButton",esriPrintMainClass:"esriPrintMain",esriPrintHeaderClass:"esriPrintHeader",esriPrintLogoClass:"esriPrintLogo",esriPrintMapClass:"esriPrintMap",esriPrintNameClass:"esriPrintName",esriPrintNotesClass:"esriPrintNotes",esriPrintLengthClass:"esriPrintLength",esriPrintDirectionsClass:"esriPrintDirections",esriPrintFooterClass:"esriPrintFooter",esriPrintStopLabelClass:"esriPrintStopLabel",
clearClass:"esriClear",dndDragBodyClass:"esriDndDragDirection",stopsButtonClass:"esriDirectionsButton",stopsButtonTabClass:"esriDirectionsTabButton",stopsButtonTabLastClass:"esriDirectionsTabLastButton",stopsPressedButtonClass:"esriDirectionsPressedButton",linkButtonClass:"esriLinkButton",activateButtonClass:"esriActivateButton",lineBarrierButtonClass:"esriLineBarrierButton",travelModesContainerClass:"esriTravelModesContainer"};this.options={map:null,autoSolve:!0,minStops:2,maxStops:20,theme:"simpleDirections",
alphabet:"1234567890",directions:null,returnToStart:!1,optimalRoute:!1,routeTaskUrl:ia+"//route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",printTaskUrl:ia+"//utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task",geometryTaskUrl:ia+"//utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",routeParams:{},stops:["",""],searchOptions:{},stopsInfoTemplate:new V(C.widgets.directions.stop,"${address}${error}"),waypointInfoTemplate:new V(C.widgets.directions.maneuver,
C.widgets.directions.waypoint),segmentInfoTemplate:new V(C.widgets.directions.maneuver,'\x3cdiv class\x3d"${maneuverType}"\x3e\x3cdiv class\x3d"'+this._css.routeIconClass+" "+this._css.infoWindowRouteClass+'"\x3e\x3cstrong\x3e${step}.\x3c/strong\x3e ${formattedText}\x3c/div\x3e\x3c/div\x3e'),textSymbolFont:new M("11px",M.STYLE_NORMAL,M.VARIANT_NORMAL,M.WEIGHT_NORMAL,"Arial, Helvetica, sans-serif"),textSymbolColor:new e([255,255,255]),textSymbolOffset:{x:0,y:10.875},fromSymbol:(new aa({url:m.toUrl("./images/Directions/greenPoint.png"),
height:21.75,width:15.75,type:"esriPMS"})).setOffset(0,10.875),fromSymbolDrag:(new aa({url:m.toUrl("./images/Directions/greenPointMove.png"),height:21.75,width:15.75,type:"esriPMS"})).setOffset(0,10.875),stopSymbol:(new aa({url:m.toUrl("./images/Directions/bluePoint.png"),height:21.75,width:15.75,type:"esriPMS"})).setOffset(0,10.875),stopSymbolDrag:(new aa({url:m.toUrl("./images/Directions/bluePointMove.png"),height:21.75,width:15.75,type:"esriPMS"})).setOffset(0,10.875),toSymbol:(new aa({url:m.toUrl("./images/Directions/redPoint.png"),
height:21.75,width:15.75,type:"esriPMS"})).setOffset(0,10.875),toSymbolDrag:(new aa({url:m.toUrl("./images/Directions/redPointMove.png"),height:21.75,width:15.75,type:"esriPMS"})).setOffset(0,10.875),unreachedSymbol:(new aa({url:m.toUrl("./images/Directions/grayPoint.png"),height:21.75,width:15.75,type:"esriPMS"})).setOffset(0,10.875),unreachedSymbolDrag:(new aa({url:m.toUrl("./images/Directions/grayPointMove.png"),height:21.75,width:15.75,type:"esriPMS"})).setOffset(0,10.875),waypointSymbol:new ma({color:[255,
255,255,255],size:10,type:"esriSMS",style:"esriSMSCircle",outline:{color:[20,89,127,255],width:2.5,type:"esriSLS",style:"esriSLSSolid"}}),maneuverSymbol:new ma({color:[255,255,255,255],size:4,type:"esriSMS",style:"esriSMSCircle",outline:{color:[30,99,137,255],width:1,type:"esriSLS",style:"esriSLSSolid"}}),routeSymbol:(new ca).setColor(new e([20,89,127,.75])).setWidth(10).setCap(ca.CAP_ROUND).setJoin(ca.JOIN_ROUND),segmentSymbol:(new ca).setColor(new e([255,255,255,1])).setWidth(6).setCap(ca.CAP_ROUND).setJoin(ca.JOIN_ROUND),
barrierRenderer:new ga({type:"uniqueValue",field1:"BarrierType",defaultSymbol:{type:"esriPMS",imageData:"PHN2ZyB3aWR0aD0iMjIyIiBoZWlnaHQ9IjIyMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGc+CjxlbGxpcHNlIGZpbGw9IiNmZjAwMDAiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLXdpZHRoPSIyMCIgY3g9IjExMiIgY3k9IjExMSIgaWQ9InN2Z181IiByeD0iMTAwIiByeT0iMTAwIi8+CjxlbGxpcHNlIGZpbGw9IiNmZjAwMDAiIHN0cm9rZT0iI2ZmZmZmZiIgc3Ryb2tlLXdpZHRoPSIyMCIgY3g9IjExMiIgY3k9IjExMSIgaWQ9InN2Z182IiByeD0iOTUiIHJ5PSI5NSIvPgo8cmVjdCBmaWxsPSIjZmYwMDAwIiBzdHJva2Utd2lkdGg9IjIwIiB4PSI2NC41IiB5PSIxMDIiIHdpZHRoPSI5NSIgaGVpZ2h0PSIxOCIgaWQ9InN2Z183IiBzdHJva2U9IiNmZmZmZmYiLz4KPC9nPgo8L3N2Zz4\x3d",
contentType:"image/svg+xml",width:18,height:18},uniqueValueInfos:[{value:"2",symbol:{type:"esriPMS",imageData:"PHN2ZyB3aWR0aD0iMjg2IiBoZWlnaHQ9IjI1NiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGc+CjxwYXRoIGZpbGw9IiNmZmYiIHN0cm9rZS13aWR0aD0iMTAiIGQ9Im04Ljc0OTk5MiwyNTEuNzQ5OTk3bDEzNC45OTk5OTgsLTI0MS45OTk5OThsMTM0Ljk5OTk5OCwyNDEuOTk5OTk4bC0yNjkuOTk5OTk1LDBsLTAuMDAwMDAxLDB6IiBpZD0ic3ZnXzEiIHN0cm9rZT0iIzAwMCIvPgo8cGF0aCBzdHJva2U9IiNmZmYiIGZpbGw9IiNmZjAwMDAiIHN0cm9rZS13aWR0aD0iMTUiIGQ9Im0yMy41MDAwMDQsMjQyLjUwMDAwNWwxMTkuOTk5OTkyLC0yMTUuOTk5OTk5bDExOS45OTk5OTIsMjE1Ljk5OTk5OWwtMjM5Ljk5OTk4MywwbC0wLjAwMDAwMSwweiIgaWQ9InN2Z18yIi8+Cjx0ZXh0IGZvbnQtd2VpZ2h0PSJib2xkIiBmaWxsPSIjZmZmZmZmIiBzdHJva2U9IiNmZjAwMDAiIHN0cm9rZS13aWR0aD0iMCIgeD0iMTA5IiB5PSIyMjIuNzUiIGlkPSJzdmdfNSIgZm9udC1zaXplPSIxODAiIGZvbnQtZmFtaWx5PSJHZW9yZ2lhLCBUaW1lcywgJ1RpbWVzIE5ldyBSb21hbicsIHNlcmlmIiB0ZXh0LWFuY2hvcj0ic3RhcnQiIHhtbDpzcGFjZT0icHJlc2VydmUiPiE8L3RleHQ+CjwvZz4KPC9zdmc+",
contentType:"image/svg+xml",width:19,height:18}}]}),polylineBarrierRenderer:new ga({type:"uniqueValue",field1:"BarrierType",defaultSymbol:{color:[255,0,0,184],width:7.5,type:"esriSLS",style:"esriSLSSolid"},uniqueValueInfos:[{value:"1",symbol:{color:[255,85,0,184],width:7.5,type:"esriSLS",style:"esriSLSSolid"}}]}),polygonBarrierRenderer:new ga({type:"uniqueValue",field1:"BarrierType",defaultSymbol:{color:[255,0,0,156],outline:{color:[255,0,0,153],width:2.4,type:"esriSLS",style:"esriSLSSolid"},type:"esriSFS",
style:"esriSFSSolid"},uniqueValueInfos:[{value:"1",symbol:{color:[255,170,0,156],outline:{color:[255,0,0,153],width:7.5,type:"esriSLS",style:"esriSLSSolid"},type:"esriSFS",style:"esriSFSSolid"}}]}),printPage:"",printTemplate:"",focusOnNewStop:!0,dragging:!0,canModifyStops:!0,canModifyWaypoints:!0,directionsLengthUnits:null,directionsLanguage:null,traffic:!1,trafficLayer:null,showPrintPage:!0,showSaveButton:!1,showSegmentPopup:!1,showSegmentHighlight:!0,showReverseStopsButton:!0,showReturnToStartOption:!0,
showOptimalRouteOption:!0,showTravelModesOption:!0,showMilesKilometersOption:!0,showClearButton:!1,showActivateButton:!0,showBarriersButton:!0,loaded:!1,routeLayer:{itemId:null,title:null,isItemOwner:!0,ownerFolder:null},startTime:"now"};this.userOptions=a;this.defaults=d.mixin({},this.options,a,{_waypointName:"DWWP",_userDefinedStopName:"UserDefinedStopName",_solveInProgress:!1,_moveInProgress:!1,_stopSequence:1E3});if(!this.defaults.minStops||2>this.defaults.minStops)this.defaults.minStops=2;if(2<
this.defaults.minStops&&this.defaults.stops&&","===this.defaults.stops.toString())for(var c=2;c<this.defaults.minStops;c++)this.defaults.stops.splice(0,0,"");this.domNode=b},postCreate:function(){this.inherited(arguments);this.own(f(this._activateButtonNode,k,d.hitch(this,function(){this.mapClickActive?this.deactivate():this.activate()})));this.own(f(this._lineBarrierButtonNode,k,d.hitch(this,function(){this.barrierToolActive?this.deactivateBarrierTool():this.activateBarrierTool()})));this.own(f(this._addDestinationNode,
k,d.hitch(this,this._addStopButton)));this.own(f(this._optionsButtonNode,k,d.hitch(this,this._toggleOptionsMenu)));this.own(f(this._saveMenuButton,k,d.hitch(this,this._toggleSaveMenu)));this.own(f(this._saveButton,k,d.hitch(this,function(){this._saveButton._enabled&&this._storeRouteUI()})));this.own(f(this._saveAsButton,k,d.hitch(this,function(){d.mixin(this.routeLayer,{itemId:null,title:null,ownerFolder:null});this._storeRouteUI()})));this.own(f(this._findOptimalOrderNode,k,d.hitch(this,this._toggleCheckbox)));
this.own(f(this._returnToStartNode,k,d.hitch(this,this._toggleCheckbox)));this.own(f(this._useTrafficNode,k,d.hitch(this,this._toggleCheckbox)));this.own(f(this._useMilesNode,k,d.hitch(this,this._toggleUnits)));this.own(f(this._useKilometersNode,k,d.hitch(this,this._toggleUnits)));this.own(f(this._getDirectionsButtonNode,k,d.hitch(this,this.getDirections)));this.own(f(this._clearDirectionsButtonNode,k,d.hitch(this,function(){this.clearDirections()})));var a=d.hitch(this,function(){clearTimeout(this._startTimeMenu._hideTimer);
this._startTimeMenu._hideTimer=setTimeout(d.hitch(this,function(){B.set(this._startTimeMenu,"display","none")}),100)});this.own(f(this._startTimeButtonNode,k,d.hitch(this,function(){this._startTimeButtonNode.disabled||"block"===B.get(this._startTimeMenu,"display")?B.set(this._startTimeMenu,"display","none"):(B.set(this._startTimeMenu,"display","block"),this["now"===this.startTime?"_startTimeMenuLeaveNow":"none"===this.startTime?"_startTimeMenuNone":"_startTimeMenuDepartAt"].focus())})));this.own(f(this._startTimeMenuLeaveNow,
"blur",a));this.own(f(this._startTimeMenuDepartAt,"blur",a));this.own(f(this._startTimeMenuNone,"blur",a));this.own(f(this._startTimeMenuLeaveNow,"mousedown",d.hitch(this,function(){this.startTime="now";this._updateStartTimeUI();this._clearDisplayBeforeSolve()})));this.own(f(this._startTimeMenuDepartAt,"mousedown",d.hitch(this,function(){this.startTime=(new Date).getTime();this._updateStartTimeUI();this._clearDisplayBeforeSolve()})));this.own(f(this._startTimeMenuNone,"mousedown",d.hitch(this,function(){this.startTime=
"none";this._updateStartTimeUI();this._clearDisplayBeforeSolve()})));this._symbolEventPaddingDirections=(new ca).setColor(new e([0,255,0,0])).setWidth(20).setCap(ca.CAP_ROUND);this._stopLayer=new T({id:"directions_stopLayer_"+this.id,displayOnPan:!0});this._routeLayer=new T({id:"directions_routeLayer_"+this.id,displayOnPan:!0});this._waypointsEventLayer=new T({id:"directions_waypointsEventLayer_"+this.id,displayOnPan:!0});this._barriersLayer=new T({id:"directions_barriersLayer_"+this.id,displayOnPan:!0});
this._polylineBarriersLayer=new T({id:"directions_polylineBarriersLayer_"+this.id,displayOnPan:!0});this._polygonBarriersLayer=new T({id:"directions_polygonBarriersLayer_"+this.id,displayOnPan:!0});this._barriersLayer.setRenderer(this.defaults.barrierRenderer);this._polylineBarriersLayer.setRenderer(this.defaults.polylineBarrierRenderer);this._polygonBarriersLayer.setRenderer(this.defaults.polygonBarrierRenderer);this.map&&(this.map.addLayer(this._routeLayer),this.map.addLayer(this._polygonBarriersLayer),
this.map.addLayer(this._polylineBarriersLayer),this.map.addLayer(this._barriersLayer),this.map.addLayer(this._stopLayer),this._externalTimeExtent=this.map.timeExtent);this._snappingManager=this.map.enableSnapping({layerInfos:[{layer:this._waypointsEventLayer,snapToVertex:!1,snapToPoint:!0,snapToEdge:!0}],tolerance:15});this._setWidgetProperties();var b=new H(null,this.waypointSymbol,{}),a=d.hitch(this,function(){this._moveInProgress||this._solveInProgress||!b._isShown()||(this.editToolbar.deactivate(),
this._stopLayer.remove(b),clearTimeout(b._solveTimeout),b._solveTimeout=null,b.attributes.isWaypoint=!0,b._isStopIcon&&this.stopGraphics[b._index]&&(this._stopLayer.add(this.stopGraphics[b._index]),this._stopLayer.add(this.textGraphics[b._index])));b._showTooltip()});this._handle=d.mixin(b,{_isHandle:!0,_tooltip:J.create("div",{className:this.theme+" esriDirectionsRouteTooltip",onmouseover:a},this.map.container),_showTooltip:d.hitch(this,function(a){b._tooltip.style.display=!a||a instanceof MouseEvent?
"none":"inline";a&&(a="string"===typeof a?a:"\x3ctable class\x3d'esriRoutesTooltip'\x3e"+this._renderDirectionsItemTR(a)+"\x3c/table\x3e",b._tooltip.innerHTML!==a&&(b._tooltip.innerHTML=a))}),_isShown:d.hitch(this,function(){return-1<t.indexOf(this._stopLayer.graphics,b)}),_remove:a});this._activate(this.mapClickActive)},startup:function(){this.inherited(arguments);return this._enqueue(this._init)},destroy:function(){this.deactivate();this.map.removeLayer(this._barriersLayer);this.map.removeLayer(this._polylineBarriersLayer);
this.map.removeLayer(this._polygonBarriersLayer);this.map.removeLayer(this._routeLayer);this.map.removeLayer(this._stopLayer);this.map.removeLayer(this._waypointsEventLayer);this._disconnectEvents();J.empty(this.domNode);this.inherited(arguments)},activate:function(){return this._enqueue(function(){this.deactivateBarrierTool().then(d.hitch(this,function(){this.set("mapClickActive",!0)}))})},deactivate:function(){return this._enqueue(function(){this.deactivateBarrierTool().then(d.hitch(this,function(){this.set("mapClickActive",
!1)}))})},activateBarrierTool:function(){return this._enqueue(function(){this.set("mapClickActive",!1);this.set("barrierToolActive",!0)})},deactivateBarrierTool:function(){return this._enqueue(function(){this.set("mapClickActive",!1);this.set("barrierToolActive",!1)})},clearDirections:function(){return this._enqueue(function(){this.clearMessages();return this._clearDirections()})},reset:function(){return this._enqueue(this._reset)},modifyStopSequence:function(a,b){return this._enqueue(function(){return this._modifyStopSequence(a,
b)})},onActivate:function(){},onDeactivate:function(){},onActivateBarrierTool:function(){},onDeactivateBarrierTool:function(){},onLoad:function(){this._enableButton(this._getDirectionsButtonNode)},onDirectionsStart:function(){this._clearDisplayBeforeSolve();this.set("solving",!0);this._showLoadingSpinner(!0)},onDirectionsFinish:function(){this._showLoadingSpinner(!1);this.set("solving",!1)},onDirectionsClear:function(){},onSegmentSelect:function(){},onSegmentHighlight:function(){},onStopsUpdate:function(){},
onRouteItemCreated:function(){},onRouteItemUpdated:function(){},onFeatureCollectionCreated:function(){},onError:function(){},removeStops:function(){return this.reset()},removeStop:function(a,b,c){return this._enqueue(function(){this.clearMessages();return this._removeStop(a,b,c)})},updateStops:function(a){return this._enqueue(function(){return this._updateStops(a)})},addStops:function(a,b){return this._enqueue(function(){return this._addStops(a,b)}).then(d.hitch(this,this.zoomToFullRoute))},addStop:function(a,
b){return this._enqueue(function(){return this._addStop(a,b)},{_incrementalSolveStopRange:this._incrementalSolveStopRange})},updateStop:function(a,b,c){return this._enqueue(function(){return this._updateStop(a,b,c)},{_incrementalSolveStopRange:this._incrementalSolveStopRange})},setBarriers:function(a){this.routeParams.barriers=a;return this._getDirections().then(d.hitch(this,function(){this.zoomToFullRoute()}))},setPolylineBarriers:function(a){this.routeParams.polylineBarriers=a;return this._getDirections().then(d.hitch(this,
function(){this.zoomToFullRoute()}))},setPolygonBarriers:function(a){this.routeParams.polygonBarriers=a;return this._getDirections().then(d.hitch(this,function(){this.zoomToFullRoute()}))},clearMessages:function(){this.messages=[];this._msgNode&&(this._msgNode.innerHTML="")},getDirections:function(a){return this._enqueue(function(){return this._getDirections().then(d.hitch(this,function(){!0!==a&&this.zoomToFullRoute()}))})},selectSegment:function(a){if(!(!this.directions||!this.directions.features||
0>a||a>=this.directions.features.length))for(var b=w("[data-segment]",this._resultsNode),c=0;c<b.length;c++){var d=parseInt(z.get(b[c],"data-segment"),10);if(a===d&&b[c]!==this._focusedDirectionsItem){this._focusedDirectionsItem=b[c];this.centerAtSegmentStart(a);this.onSegmentSelect(this.directions.features[a]);b[c].focus();break}}},unhighlightSegment:function(a){var b=this._segmentGraphics;if(b&&(!this._focusedDirectionsItem||a)){for(a=0;a<b.length;a++)this._routeLayer.remove(b[a]);this._segmentGraphics=
[]}},highlightSegment:function(a,b){if(!(this._focusedDirectionsItem&&!b||a>=this.directions.features.length)){a=a||0;var c=d.hitch(this,function(a){var b=this.map.toMap({x:0,y:0});return this.map.toScreen(b.offset(a,0)).x}),f=d.hitch(this,function(a){for(var b=0,d=0;d<a.length;d++)for(var e=1;e<a[d].length;e++)var f=a[d][e-1],g=a[d][e],b=b+c(Math.sqrt((f[0]-g[0])*(f[0]-g[0])+(f[1]-g[1])*(f[1]-g[1])));return b}),g=d.hitch(this,function(a){var b=this.map.toMap({x:0,y:0});return this.map.toMap({x:a,
y:0}).x-b.x}),h=function(a,b,d){b=Math.max(1,b);for(var e=d?a[0].length-1:0,f=0,g,h,k,l=[[a[0][d?e:0]]];d&&0<e||!d&&e<a[0].length-1;){h=a[0][d?e-1:e];k=a[0][d?e:e+1];if(g=c(Math.sqrt((h[0]-k[0])*(h[0]-k[0])+(h[1]-k[1])*(h[1]-k[1]))))if(f+g<b)d?l[0].splice(0,0,h):l[0].push(k),f+=g;else{b=(b-f)/g;d?l[0].splice(0,0,[k[0]-(k[0]-h[0])*b,k[1]-(k[1]-h[1])*b]):l[0].push([h[0]+(k[0]-h[0])*b,h[1]+(k[1]-h[1])*b]);break}e+=d?-1:1}return 0<f+g?l:a},k=this.get("directions").features[a],l=new fa(k.geometry),m=40*
Math.PI/180;d.mixin(k.attributes,{_index:a});if(a){var n=h(this.get("directions").features[a-1].geometry.paths,25,!0),G="esriDMTStop"!==k.attributes.maneuverType?h(l.paths,25,!1):n,n=G!==n?[n[0].concat(G[0])]:G,q=(new fa(G)).getExtent();if(1<G[0].length&&15<=c(Math.max(q.getWidth(),q.getHeight()))){for(var h=15*Math.cos(m/2),f=15*Math.sin(m/2),t=G[0].length-2,r,m=G[0][t+1],q=0;0<=t&&!q;)r=G[0][t],q=c(Math.sqrt((r[0]-m[0])*(r[0]-m[0])+(r[1]-m[1])*(r[1]-m[1]))),t--;22>q&&(G=q+(22-q)/3,t=q+2*(22-q)/
3,t=[r[0]+t/q*(m[0]-r[0]),r[1]+t/q*(m[1]-r[1])],r=[m[0]-G/q*(m[0]-r[0]),m[1]-G/q*(m[1]-r[1])],m=t,q=22);h/=q;G=[m[0]-(m[0]-r[0])*h,m[1]-(m[1]-r[1])*h];r[1]!==m[1]?(h=(m[0]-r[0])/(m[1]-r[1]),r=g(f/Math.sqrt(1+h*h)),g=h*r):(r=0,g=g(f));Infinity===Math.abs(r)||Infinity===Math.abs(g)||isNaN(r)||isNaN(g)||(n[0].push(m),n[0].push([G[0]-r,G[1]+g]),n[0].push([G[0]+r,G[1]-g]),n[0].push(m))}else n=h(n,2*f(G),!0);l.paths=n}this.unhighlightSegment(this._segmentGraphics&&this._segmentGraphics.length);g=d.clone(this.routeSymbol).setWidth(this.segmentSymbol.width).setColor(new e([parseInt(.9*
this.segmentSymbol.color.r),parseInt(.9*this.segmentSymbol.color.g),parseInt(.9*this.segmentSymbol.color.b)]));this._segmentGraphics=[new H(k.geometry,g,k.attributes,this.get("segmentInfoTemplate")),new H(l,this.routeSymbol,k.attributes,this.get("segmentInfoTemplate")),new H(l,this.segmentSymbol,k.attributes,this.get("segmentInfoTemplate"))];this.get("showSegmentHighlight")&&(this._routeLayer.add(this._segmentGraphics[0]),this._routeLayer.add(this._segmentGraphics[1]),this._routeLayer.add(this._segmentGraphics[2]));
k=d.hitch(this,function(a){if(0<a&&a<this.directions.features.length){a=this.directions.features[a]._associatedFeaturesWithWaypoints;for(var b=0;b<a.length;b++)a[b]._associatedSnapFeature&&a[b]._associatedSnapFeature.getDojoShape()&&a[b]._associatedSnapFeature.getDojoShape().moveToFront()}});k(a-1);k(a);this.onSegmentHighlight(this.directions.features[a])}},zoomToSegment:function(a){var b,c=new I;this.directions&&this.directions.features?(b=Math.max(0,Math.min(this.directions.features.length-1,a||
0)),this.map.setExtent(this.get("directions").features[b].geometry.getExtent(),!0).promise.always(d.hitch(this,function(){this.highlightSegment(b);c.resolve()}))):c.reject(Error("No directions."));return c.promise},centerAtSegmentStart:function(a){var b,c=new I;if(this.directions&&this.directions.features){b=Math.max(0,Math.min(this.directions.features.length-1,a||0));var e=this.directions.features[b];this.map.centerAt(e.geometry.getPoint(0,0)).promise.always(d.hitch(this,function(){this.highlightSegment(b,
!0);this._showSegmentPopup(e,b);c.resolve()}))}else c.reject(Error("No directions."));return c.promise},zoomToFullRoute:function(){var a=new I;this.directions&&this.directions.features?(this._clearInfoWindow(),this.unhighlightSegment(),this.get("map").setExtent(this.get("directions").extent,!0).promise.always(a.resolve)):a.resolve();return a.promise},setListIcons:function(){var a,b=this._dnd.getAllNodes();for(a=0;a<b.length;a++){var c=w("."+this._css.stopIconClass,b[a])[0];c&&(c.innerHTML=this._getLetter(a));
A.remove(b[a],this._css.stopOriginClass+" "+this._css.stopDestinationClass+" "+this._css.stopUnreachedClass+" "+this._css.stopUnreachedFirstOrLastClass);c=this._getStopSymbol(this.stops[a]);c===this.fromSymbol?A.add(b[a],this._css.stopOriginClass):c===this.toSymbol?A.add(b[a],this._css.stopDestinationClass):c===this.unreachedSymbol&&A.add(b[a],this._css.stopUnreachedClass)}a=w("[data-reverse-td]",this._dndNode)[0];J.destroy(a);this.get("showReverseStopsButton")&&J.create("td",{"data-reverse-td":"true",
rowspan:b.length,className:this._css.esriStopReverseColumnClass,innerHTML:'\x3cdiv role\x3d"button" class\x3d"'+this._css.reverseStopsClass+'" data-reverse-stops\x3d"true" title\x3d"'+C.widgets.directions.reverseDirections+'"\x3e\x3c/div\x3e',onmouseover:function(a){a.stopPropagation()},onmouseout:function(a){a.stopPropagation()}},b[0])},addRouteSymbols:function(){if(this.stopGraphics.length){this._moveLayersToFront();for(var a=0;a<this.stopGraphics.length;a++)if(this.stopGraphics[a]&&(!this._handle._isShown()||
this._handle._isShown()&&this._handle._index!==a)){this._stopLayer.add(this.stopGraphics[a]);var b=this.stopGraphics[a].getDojoShape();b&&b.moveToFront();this._stopLayer.add(this.textGraphics[a]);(b=this.textGraphics[a].getDojoShape())&&b.moveToFront()}this._moveInProgress&&!this._handle.attributes.isWaypoint&&this._handle.getDojoShape()&&this._handle.getDojoShape().moveToFront()}},createRouteSymbols:function(){this._clearStopGraphics();for(var a=this.stops,b=function(a){var b={},c;for(c in a)a.hasOwnProperty(c)&&
0===c.indexOf("Attr_")&&(b[c]=a[c]);return b},c=0;c<a.length;c++){var e=a[c];if(e&&e.feature){var f=e.feature.attributes,g=f?f.Status:void 0,h=null;this._isStopAWaypoint(e)||(h=new oa(this._getLetter(c),this.get("textSymbolFont"),this.get("textSymbolColor")),this.get("textSymbolOffset")&&h.setOffset(this.get("textSymbolOffset").x,this.get("textSymbolOffset").y));h=new H(e.feature.geometry,h,{address:e.name},this.get("stopsInfoTemplate"));h._isStopLabel=!0;h._index=c;e=new H(e.feature.geometry,this._getStopSymbol(e),
d.mixin({address:e.name,Status:void 0===g?0:g,CurbApproach:f&&f.CurbApproach?f.CurbApproach:null,TimeWindowStart:f&&f.TimeWindowStart?f.TimeWindowStart:null,TimeWindowEnd:f&&f.TimeWindowEnd?f.TimeWindowEnd:null,isWaypoint:this._isStopAWaypoint(e)},b(f)),this.get(this._isStopAWaypoint(e)?"waypointInfoTemplate":"stopsInfoTemplate"));e._isStopIcon=!0;e._index=c;this.stopGraphics[c]=e;this.textGraphics[c]=h}}this.set("stopGraphics",this.stopGraphics);this.set("textGraphics",this.textGraphics);this._showBarriers();
this.addRouteSymbols();this.setListIcons()},setTravelMode:function(a){return this._enqueue(function(){this.clearMessages();this._travelModeSelector.setValue(a);return this._setTravelMode(a)})},getSupportedTravelModeNames:function(){var a=[],b=this.serviceDescription;if(b&&b.supportedTravelModes&&b.supportedTravelModes.length)for(var b=b.supportedTravelModes,c=0;c<b.length;c++)a.push(b[c].name);return a},setDirectionsLengthUnits:function(){var a=1===arguments.length?arguments[0]:this.get("directionsLengthUnits");
return this._enqueue(function(){this.clearMessages();return this._setDirectionsLengthUnits(a)})},setDirectionsLanguage:function(){var a=1===arguments.length?arguments[0]:this.get("directionsLanguage");return this._enqueue(function(){this.clearMessages();return this._setDirectionsLanguage(a)})},useMyCurrentLocation:function(a){this.clearMessages();return this._createLocateButton(this.geocoders[a],!0,!0)},loadRoute:function(a){return this._enqueue(d.hitch(this,function(){return this._loadRoute(a)}))},
_getStopsAttr:function(){return this.returnToStart&&this._returnToStartStop?this.stops.concat(this._returnToStartStop):this.stops},_getTravelModeNameAttr:function(){return this.routeParams&&this.routeParams.travelMode&&this.routeParams.travelMode.name},_reset:function(){var a=this.mapClickActive||this.barrierToolActive;this._clearBarriersGraphics();this._setWidgetProperties();return this._init().then(d.hitch(this,function(){this.mapClickActive=!a;this.set("mapClickActive",a);this._searchSourceSelector&&
this._searchSourceSelector.setValue("all")}))},_activate:function(){var a=this.get("mapClickActive"),b=d.hitch(this,function(a){for(var b=a?[this.textGraphics,this.stopGraphics,this.displayedManeuverPointGraphics,this.displayedRouteGraphics]:[this.displayedRouteGraphics,this.displayedManeuverPointGraphics,this.stopGraphics,this.textGraphics],c=0;c<b.length;c++)for(var d=b[c],e=0;e<d.length;e++){var f=d[e].getDojoShape();f&&f[a?"moveToBack":"moveToFront"].call(f)}});this.drawToolbar&&(this.barrierToolActive=
!1,this.drawToolbar.deactivate(),A.remove(this._lineBarrierButtonNode,this._css.stopsPressedButtonClass));this._addStopOnMapClickListener&&this._addStopOnMapClickListener.remove();a?(this.map.activeDirectionsWidget&&this.map.activeDirectionsWidget!==this&&this.map.activeDirectionsWidget.deactivate(),this.map.activeDirectionsWidget=this,this._addStopOnMapClickListener=f(this.map,"click",d.hitch(this,function(a){this.canModifyStops&&!this._solveInProgress&&(this.map.infoWindow.hide(),this.addStop(new H(a.mapPoint)))})),
this.map.addLayer(this._waypointsEventLayer),this._moveLayersToFront(),A.add(this._activateButtonNode,this._css.stopsPressedButtonClass),this.onActivate()):(this.map.removeLayer(this._waypointsEventLayer),A.remove(this._activateButtonNode,this._css.stopsPressedButtonClass),this.onDeactivate());b(!a);this.emit("map-click-active",{mapClickActive:this.mapClickActive})},_activateBarrierTool:function(){this.get("barrierToolActive")?(this.map.activeDirectionsWidget&&this.map.activeDirectionsWidget!==this&&
this.map.activeDirectionsWidget.deactivate(),this.map.activeDirectionsWidget=this,this.drawToolbar.activate(ua.FREEHAND_POLYLINE),A.add(this._lineBarrierButtonNode,this._css.stopsPressedButtonClass),this.onActivateBarrierTool()):(this.drawToolbar.deactivate(),A.remove(this._lineBarrierButtonNode,this._css.stopsPressedButtonClass),this.onDeactivateBarrierTool());this.emit("barrier-tool-active",{barrierToolActive:this.barrierToolActive})},_moveLayersToFront:function(){var a=this.get("map"),b=a.graphicsLayerIds.length-
1;a.reorderLayer(this._routeLayer,b);a.reorderLayer(this._polygonBarriersLayer,b);a.reorderLayer(this._polylineBarriersLayer,b);a.reorderLayer(this._barriersLayer,b);a.reorderLayer(this._waypointsEventLayer,b);a.reorderLayer(this._stopLayer,b)},_destroyGeocoders:function(){for(;this.geocoders&&this.geocoders.length;){if(this.geocoders[0])try{this.geocoders[0].destroy()}catch(G){}this.geocoders.splice(0,1)}this.geocoders=[]},_disconnectEvents:function(){var a=this._clearDirections(!0),b;if(this._watchEvents&&
this._watchEvents.length)for(b=0;b<this._watchEvents.length;b++)this._watchEvents[b].unwatch();if(this._onEvents&&this._onEvents.length)for(b=0;b<this._onEvents.length;b++)this._onEvents[b].remove();if(this._geocoderEvents)for(b=0;b<this._geocoderEvents.length;b++)this._geocoderEvents[b].value.unwatch(),this._geocoderEvents[b].blur.remove(),this._geocoderEvents[b].select.remove(),this._geocoderEvents[b].suggest.remove();this._onEvents=[];this._watchEvents=[];this._geocoderEvents=[];this._disconnectResults();
this._destroyGeocoders();this._destroyGlobalGeocoder();this._destroyDnD();return a},_getDirections:function(){var a=new I;this._removeEmptyStops();1<this._getStopCount()+this._getWaypointCount()&&this.loaded?(this.onDirectionsStart(),this.clearMessages(),this._dnd.sync(),this._sortGeocoders(),this._getCandidates(this.stops).then(d.hitch(this,function(b){this.stops=b;this._setStops();this._configureRoute().always(d.hitch(this,function(b){a.resolve(b)}))}),d.hitch(this,function(b){this.set("directions",
null);this._clearRouteGraphics();a.reject(b);this.onDirectionsFinish(b)}))):this._clearDirections(!0).always(d.hitch(this,function(){this.createRouteSymbols();a.resolve()}));return a.promise},_clearDirections:function(){var a=new I;this._handle&&this._handle._remove();this.get("routeParams")&&this.get("routeParams").stops?this.get("routeParams").stops.features.length?(this.get("routeParams").stops.features=[],this.onDirectionsClear(),a.resolve()):arguments.length?a.resolve():this._reset().then(a.resolve,
a.reject):a.resolve();this.set("directions",null);this._clearDisplayBeforeSolve();this._clearDisplayAfterSolve();this._routeLayer.clear();this._waypointsEventLayer.clear();this._stopLayer.clear();return a.promise},_setTravelMode:function(a){var b=new I,c=this.serviceDescription,d=function(){b.resolve(a)};if(c&&c.supportedTravelModes&&c.supportedTravelModes.length){for(var e=c.supportedTravelModes,f=!1,c=0;c<e.length;c++)if(e[c].name===a){f=!0;!this.routeParams.travelMode||this.routeParams.travelMode&&
this.routeParams.travelMode.name!==a?(this.routeParams.travelMode=e[c].impedanceAttributeName?e[c]:e[c].itemId,this._checkStartTimeUIAvailability(),this._solveAndZoom().always(d)):d();this._travelModeSelector&&this._travelModeSelector.domNode&&(this._travelModeSelector.domNode.title=e[c].description);break}f||b.reject(a)}else b.reject(a);return b.promise},_setDirectionsLengthUnits:function(a){this._clearDisplayBeforeSolve();var b=new I;A.remove(this._useMilesNode,this._css.stopsPressedButtonClass);
A.remove(this._useKilometersNode,this._css.stopsPressedButtonClass);a===Q.KILOMETERS?A.add(this._useKilometersNode,this._css.stopsPressedButtonClass):a===Q.MILES&&A.add(this._useMilesNode,this._css.stopsPressedButtonClass);a===Q.KILOMETERS||a===Q.METERS||a===Q.MILES||a===Q.FEET||a===Q.YARDS||a===Q.NAUTICAL_MILES?(this.directionsLengthUnits=a,b.resolve(a)):b.reject(a);return b.promise},_setDirectionsLanguage:function(a){this._clearDisplayBeforeSolve();var b=new I;a=this._setDirectionsLanguageByLocale(a);
this._solveAndZoom().always(function(){b.resolve(a)},b.reject);return b.promise},_showLoadingSpinner:function(a){void 0===a&&(a=this._requestQueueTail&&!this._requestQueueTail.isFulfilled()||this._moveInProgress);a?(A.add(this._widgetContainer,this._css.resultsLoadingClass),A.add(this._resultsNode,"esriRoutesContainerBusy")):(A.remove(this._widgetContainer,this._css.resultsLoadingClass),A.remove(this._resultsNode,"esriRoutesContainerBusy"))},_enqueue:function(a,b){var c=new I;this._requestQueueTail||
(this._requestQueueTail=new I,this._requestQueueTail.resolve());this._requestQueueTail.promise.always(d.hitch(this,function(){try{d.mixin(this,{_incrementalSolveStopRange:null},b);var e=a.call(this);e&&"object"===typeof e&&e.hasOwnProperty("isFulfilled")?e.then(d.hitch(this,function(a){c.resolve(a);this._showLoadingSpinner()}),d.hitch(this,function(a){c.reject(a);this._showLoadingSpinner()})):(c.resolve(e),this._showLoadingSpinner())}catch(va){c.reject(va),this._showLoadingSpinner()}}));this._requestQueueTail=
c;this._showLoadingSpinner();return c.promise},_createDnD:function(){this._dnd=new X(this._dndNode,{skipForm:!0,withHandles:!0})},_destroyDnD:function(){J.empty(this._dndNode);this._dnd&&(this._dnd.destroy(),this._dnd=null)},_createDepartAtControls:function(){if(this._departAtTime)this.map&&this._restoreMapTimeExtent(),this._useTrafficItemNode.title=C.widgets.directions.trafficLabelLive,A.remove(this._departAtContainer,"departAtContainerVisible"),this.startTime="now",this._updateStartTimeUI();else{var a=
this,b=function(){this._keepDirections||a._clearDisplayBeforeSolve();this._keepDirections=!1},c=d.hitch(this,function(){this.map&&this.map.disableKeyboardNavigation()}),e=d.hitch(this,function(){this.map&&this.map.enableKeyboardNavigation()});this._departAtTime=new u({required:!0,value:new Date,onChange:b,onFocus:c,onBlur:e},this._departAtTimeContainer);this._departAtDate=new q({required:!0,value:new Date,onChange:b,onFocus:c,onBlur:e,constraints:{min:new Date(864E5)}},this._departAtDateContainer)}},
_setStartTime:function(a,b,c){if(isNaN(c))this.startTime="now"===c?c:"none";else{b=c instanceof Date?c:new Date(c);c=this.directions&&this.directions.features&&this.directions.features[0]&&this.directions.features[0].attributes;var d=6E4*-b.getTimezoneOffset();b=new Date(b-d+(c&&c.arriveTimeUTC?c.ETA-c.arriveTimeUTC:d));this._departAtTime._keepDirections=!a;this._departAtDate._keepDirections=!a;this._departAtTime.setValue(b);this._departAtDate.setValue(b)}this._updateStartTimeUI()},_checkStartTimeUIAvailability:function(){var a=
this._getImpedanceAttribute(),a=this._isTimeUnits(a?a.units:"")||this.serviceDescription&&10.6<=this.serviceDescription.currentVersion;this._startTimeButtonNode.disabled=!a;A[a?"remove":"add"].apply(this,[this._startTimeButtonNodeContainer,"esriLinkButtonDisabled"]);A[a?"remove":"add"].apply(this,[this._startTimeDDLArrow,"esriDirectionsDDLArrowDisabled"]);a||this.set("startTime","now")},_usingAGOL:function(a){a||(a=this.routeTaskUrl);return-1<a.search(/^(https?:)*\/\/*[^.]*\.arcgis\.com.*$/i)},_usingRouteAGOL:function(){return-1<
this.get("routeTaskUrl").search(/^(https?:)*\/\/route*[^.]*\.arcgis\.com.*$/i)},_setSearchOptions:function(){var a={map:this.get("map"),autoNavigate:!1,enableInfoWindow:!1,enableHighlight:!1,enableSourcesMenu:!1};this.searchOptions=d.mixin({maxResults:1,locationToAddressDistance:100},this.defaults.searchOptions,a)},_setDefaultUnits:function(){if(!this.get("directionsLengthUnits")){var a="EN-US"===v.locale.toUpperCase()?Q.MILES:Q.KILOMETERS;this.defaults.directionsLengthUnits?a=this.defaults.directionsLengthUnits:
this.userOptions.routeParams&&this.userOptions.routeParams.directionsLengthUnits&&(a=this.userOptions.routeParams.directionsLengthUnits);this.set("directionsLengthUnits",a)}this._setDirectionsLengthUnits(this.directionsLengthUnits)},_setTrafficOptions:function(){this._usingRouteAGOL()&&!this.trafficLayer&&(this.trafficLayer=new Z(ia+"//traffic.arcgis.com/arcgis/rest/services/World/Traffic/MapServer",{opacity:.4}));this.trafficLayer&&this.trafficLayer.url&&this._usingAGOL(this.trafficLayer.url)&&(this._trafficAvailabilityButton.style.display=
"inline-block");this.set("showTrafficOption",(this.defaults.showTrafficOption||!this.defaults.hasOwnProperty("showTrafficOption"))&&!!this.trafficLayer);this._optionsMenu()},_updateCanModifyStops:function(a,b){this.canModifyStops||this.canModifyWaypoints||this.set("mapClickActive",!1);b||!this.canModifyStops||this.canModifyWaypoints||this.set("mapClickActive",!0);this._showAddDestination();this._showMapClickActiveButton();this._stopsTableCover.style.display=this.canModifyStops?"none":"inline"},_updateCanAddWaypoints:function(a,
b){this.canModifyStops||this.canModifyWaypoints||this.set("mapClickActive",!1);b||this.canModifyStops||!this.canModifyWaypoints||this.set("mapClickActive",!0);this._showMapClickActiveButton();this._handle._remove()},_updateStartTimeUI:function(){isNaN(this.startTime)?(this._startTimeButtonLabel.innerHTML="now"==this.startTime?this._i18n.widgets.directions.leaveNow:this._i18n.widgets.directions.noStartTime,A.remove(this._startTimeButtonNodeContainer,"departAtButton"),A.remove(this._departAtContainer,
"departAtContainerVisible")):(A.add(this._startTimeButtonNodeContainer,"departAtButton"),A.add(this._departAtContainer,"departAtContainerVisible"),this._startTimeButtonLabel.innerHTML=this._i18n.widgets.directions.departAt)},_setWidgetProperties:function(){this._disconnectEvents();this.set(this.defaults);this.routeLayer=d.clone(this.defaults.routeLayer);this._folderSelector&&(this._outputLayer.setValue(""),this._outputLayer.set("disabled",!0),this._folderSelector.set("disabled",!0));this.set("stops",
[]);this._updateCanModifyStops()},_updateStops:function(a){var b=new I;a?this.get("loaded")?this._reset().then(d.hitch(this,function(){this._addStops(a).then(b.resolve,b.reject)}),b.reject):this._addStops(a).then(b.resolve,b.reject):b.reject();return b.promise},_removeStop:function(a,b,c,e){var f=new I,g=d.hitch(this,function(a){this.stops.splice(a,1);var b=this._dnd.getAllNodes()[a],c=this.get("geocoders");this._geocoderEvents[b.id]&&(this._geocoderEvents[b.id].blur.remove(),this._geocoderEvents[b.id].select.remove(),
this._geocoderEvents[b.id].suggest.remove(),this._geocoderEvents[b.id].value.unwatch());c[a].destroy();c.splice(a,1);this.set("geocoders",c);J.destroy(b);this._dnd.sync();this._stopsRemovable();this._optionsMenu();this._checkMaxStops();this.setListIcons();this._sortGeocoders()});if(0>a||a>=this.stops.length||void 0===a)a=this.stops.length-1;var h=!1;for(e=this.stopGraphics[a]&&this._isStopAWaypoint(this.stops[a])||e;!h;)g(a),e?h=!0:(a-=0>=a||a<this.stops.length&&this._isStopAWaypoint(this.stops[a])?
0:1,h=!this._isStopAWaypoint(this.stops[a]));for(;this.stops.length-this._getWaypointCount()<this.minStops;)this._addStop();this._clearStopsStatusAttr();this._setStops();this.createRouteSymbols();c?(this._clearDisplayBeforeSolve(),this._clearDisplayAfterSolve(),this.createRouteSymbols(),f.resolve()):this._solveAndZoom(b).then(f.resolve,f.reject);return f.promise},_removeTrafficLayer:function(){this.trafficLayer&&this.map&&this.map.removeLayer(this.trafficLayer);this._trafficLayerAdded=!1},_addStops:function(a,
b){var c=new I,e=[],f=this.autoSolve;this.autoSolve=!1;void 0===b&&(b=this._getStopCount());for(var g=0;g<Math.min(a.length,this.maxStops-this._getStopCount());g++){var h=new I;this._addStop(a[g],b+g,!0).always(h.resolve);e.push(h)}K(e).always(d.hitch(this,function(){this.autoSolve=f;this._getDirections().always(function(){c.resolve(a)})}));return c.promise},_addStop:function(a,b,c){var e=new I;this._checkMaxStops();this.maxStopsReached?(this._showMessage(C.widgets.directions.error.maximumStops),
e.reject(Error(C.widgets.directions.error.maximumStops))):(void 0===a&&void 0===b&&(b=this.stops.length),a instanceof H&&a.attributes&&a.attributes.isWaypoint&&(!b||b===this.stops.length||2>this._getStopCount())&&!c?(this._showMessage(C.widgets.directions.error.waypointShouldBeInBetweenStops),e.reject(Error(C.widgets.directions.error.waypointShouldBeInBetweenStops))):this._getCandidate(a).then(d.hitch(this,function(a){this._isStopAWaypoint(a)&&a&&a.feature&&(a.feature.attributes=d.mixin({},a.feature.attributes,
{isWaypoint:!0,CurbApproach:3}));this._insertStop(a,b);this.autoSolve&&""!==a.name?this._getDirections().always(function(){e.resolve(a,b)}):e.resolve(a,b)}),d.hitch(this,function(a){e.reject(a)})));return e.promise},_removeEmptyStops:function(){for(var a=0,b=this.stops.length-this._getWaypointCount()-this.minStops;a<this.stops.length&&0<b;)this.stops[a]&&this.stops[a].name?a++:(this._removeStop(a,!0,!0,!0),b--,this._moveInProgress&&this._handle._index>=a&&this._handle._isStopIcon&&this._handle._index--)},
_setReverseGeocode:function(a,b,c){if(a.feature.geometry&&-1<c){var e={address:a.name};this.stopGraphics[c]&&(d.mixin(this.stopGraphics[c].attributes,e),this.stopGraphics[c].setGeometry(b));this.textGraphics[c]&&(d.mixin(this.textGraphics[c].attributes,e),this.textGraphics[c].setGeometry(b));this.set("stopGraphics",this.stopGraphics);this.set("textGraphics",this.textGraphics);(e=this.geocoders[c])&&e.inputNode&&(e.value=a.name,e.inputNode.value=a.name);d.mixin(a.feature.attributes,this.stops[c].feature.attributes);
this.stops[c]=a;this.stops[c].feature.setGeometry(b);this._setStops();return this._enqueue(function(){return this._getDirections()})}},_insertStop:function(a,b){var c,d;if(void 0===b)for(c=0;c<this.geocoders.length;c++){if(!this.geocoders[c].get("value")){d=this.geocoders[c];break}}else c=b,this.geocoders[c]&&!this.geocoders[c].get("value")&&(d=this.geocoders[c]);!d||void 0!==b&&b!==c||this._isStopAWaypoint(a)?(void 0===b&&(b=this.geocoders.length),this.stops.splice(b,0,a),this._createGeocoder(a,
b)):(this.stops[c]=a,d.set("value",a.name),d._stopReference=a);this._optionsMenu()},_createGeocoder:function(a,b){var c=this._dnd.getAllNodes(),e=!1,f=!1,g=c.length;c[b]?(f=c[b],e=!0):e=f=!1;var h=d.hitch(this,function(a,b){var c=b?this._css.stopDnDHandleClass:this._css.stopDnDHandleClassHidden,d=b?this._css.stopDnDHandleClassHidden:this._css.stopDnDHandleClass;A.replace(a.children[0],c,d);2<this.geocoders.length&&(c=b?this._css.stopIconRemoveClass:this._css.stopIconRemoveClassHidden,d=b?this._css.stopIconRemoveClassHidden:
this._css.stopIconRemoveClass,A.replace(a.children[3].children[0],c,d))}),k=J.create("tr",{className:this._css.stopClass,style:this._isStopAWaypoint(a)?"display:none;":"",onmouseover:function(){h(this,!0)},onmouseout:function(){h(this,!1)}});J.create("td",{className:this._css.stopDnDHandleClassHidden+" dojoDndHandle"},k);c=J.create("td",{className:this._css.stopIconColumnClass},k);J.create("div",{className:this._css.stopIconClass+" dojoDndHandle",innerHTML:this._getLetter(g),"data-center-at":"true"},
c);g=J.create("td",{className:this._css.esriStopGeocoderColumnClass},k);g=J.create("div",{},g);c=J.create("td",{className:this._css.stopIconRemoveColumnClass},k);J.create("div",{className:this._css.stopIconRemoveClassHidden,role:"button","data-remove":"true"},c);this._dnd.insertNodes(!1,[k],e,f);var e=d.mixin({},this.get("searchOptions"),{value:a.name,activeSourceIndex:this._globalGeocoder.activeSourceIndex}),l=new O(e,g),m=d.hitch(this,function(a,b){this._enqueue(function(){if(b!==a&&l._stopReference&&
l._stopReference.name!==b){var c=t.indexOf(this.stops,l._stopReference);this.stops[c]={name:b};this._handle._remove();this._removeSomeWaypoints(this._markWPsForRemovalAfterUserChangedStopSequence(c));this._setStops();this._clearDisplayBeforeSolve();this._clearDisplayAfterSolve();this.createRouteSymbols()}})});l._tr=k;l._stopReference=a;l.startup();this.geocoders.splice(b,0,l);this._geocoderEvents[k.id]={blur:l.on("blur",function(){""!==this.value&&this._stopReference&&!this._stopReference.feature&&
this.search()}),select:l.on("select-result",d.hitch(this,function(a){var b=!0;if(a&&(a.results||a.result)){var c=this._dnd.getAllNodes(),c=t.indexOf(c,k),d=l.value,e=a.results&&a.results.results&&a.results.results.length?a.results.results[0]:a.result;e?(e.name=d,this.stops[c]=this._toPointGeometry(e),this.geocoders[c]._stopReference=this.stops[c],m("",d)):(this.removeStop(c),this.set("directions",null),this._showMessage(C.widgets.directions.error.unknownStop.replace("\x3cname\x3e",a.target.get("value"))),
this._clearRouteGraphics(),b=!1);b&&this.getDirections()}})),suggest:l.on("suggest-results",function(){if(document.activeElement===this.inputNode)for(var a=w("LI[role\x3d'menuitem']",this.suggestionsNode),b=0;b<a.length;b++)z.set(a[b],"tabindex",-1);else this._hideSuggestionsMenu()}),value:l.watch("value",function(a,b,c){m(b,c)})};this._checkMaxStops();this.setListIcons();this._stopsRemovable();this._optionsMenu();this._sortGeocoders()},_blurGeocoders:function(){if(document.activeElement)for(var a=
0;a<this.geocoders.length;a++)if(this.geocoders[a].inputNode===document.activeElement){this.geocoders[a]._hideSuggestionsMenu();this.geocoders[a].inputNode.blur();1<this._getStopCount()+this._getWaypointCount()&&this.getDirections(!0);break}},_decorateEmptyAGOLGeocoderResponse:function(a){a&&", , "===a.name&&(a.name=a.feature&&a.feature.attributes&&a.feature.attributes.Match_addr?a.feature.attributes.Match_addr+("POI"===a.feature.attributes.Addr_type&&a.feature.attributes.City&&-1===a.feature.attributes.Match_addr.indexOf(a.feature.attributes.City)?
", "+a.feature.attributes.City:""):"");return a},_toPointGeometry:function(a){var b=a.feature.geometry;b&&(b.getCentroid?a.feature.geometry=b.getCentroid():b.getExtent&&(b=b.getExtent())&&(a.feature.geometry=b.getCenter()));return a},_removeLocateButtonVisibilityEvents:function(){for(var a=0;a<this.geocoders.length;a++){var b=this.geocoders[a];b._onMouseEnter&&b._onMouseEnter.remove();b._onMouseOut&&b._onMouseOut.remove();b._onKeyPress&&b._onKeyPress.remove();b._locateButton&&(b._locateButton._onMouseEnter&&
b._locateButton._onMouseEnter.remove(),b._locateButton._onMouseOut&&b._locateButton._onMouseOut.remove())}},_setLocateButtonVisibilityEvents:function(){this._removeLocateButtonVisibilityEvents();for(var a=this,b=function(b){b instanceof FocusEvent?this._geocoder._lbShown_f=!0:this._geocoder._lbShown_g=!0;a._createLocateButton(this._geocoder,!0)},c=function(b){b instanceof FocusEvent?this._geocoder._lbShown_f=!1:this._geocoder._lbShown_g=!1;clearTimeout(this._destroyTimeout);this._destroyTimeout=setTimeout(d.hitch(this,
function(){this._geocoder._lbShown_lb||this._geocoder._lbShown_f||a._destroyLocateButton(this._locateButton)}),400)},e=function(){this._geocoder._lbShown_g=!0;clearTimeout(this._destroyTimeout);this._destroyTimeout=setTimeout(d.hitch(this,function(){""===this.value?a._createLocateButton(this._geocoder,!0):a._destroyLocateButton(this._locateButton)}),400)},g=function(){this._geocoder._lbShown_lb=!0;clearTimeout(this._geocoder._destroyTimeout)},h=function(){this._geocoder._lbShown_lb=!1;clearTimeout(this._geocoder._destroyTimeout);
this._geocoder._destroyTimeout=setTimeout(d.hitch(this,function(){this._geocoder._lbShown_g||this._geocoder._lbShown_f||a._destroyLocateButton(this._geocoder.inputNode._locateButton)}),400)},k=0;k<this.geocoders.length;k++){var m=this.geocoders[k];m&&m.inputNode&&(m.inputNode._geocoder=m,m._onMouseEnter=f(m.inputNode,l.enter,b),m._onMouseOut=f(m.inputNode,[l.leave,"blur"],c),m._onKeyPress=f(m.inputNode,"keydown",e),m.inputNode._locateButton&&(m=m.inputNode._locateButton,m._onMouseEnter=f(m.domNode,
l.enter,g),m._onMouseOut=f(m.domNode,l.leave,h)))}},_createLocateButton:function(a,b,c){var e=new I;a.inputNode._locateButton&&a.inputNode._locateButton._locating?e.resolve():m(["./LocateButton"],d.hitch(this,function(g){this._destroyLocateButton(a.inputNode._locateButton);if(a&&!this._solveInProgress){var h=J.create("div",{},a.domNode);A.add(a.domNode,this._css.stopsInnerGeocoderClass);var l=new g({map:this.map,highlightLocation:!1,centerAt:!1,setScale:!1,useTracking:!1},h);l.startup();a.inputNode._locateButton=
l;l.domNode._geocoder=a;this._setLocateButtonVisibilityEvents();g=d.hitch(this,function(){l._locating=!0;a.set("value","");a.inputNode.placeholder=C.widgets.directions.retrievingMyLocation.toUpperCase()});l._onBeforeLocate=f(l._locateNode,k,g);l._onLocate=f(l,"locate",d.hitch(this,function(c){l._locating=!1;c.graphic?(b&&this._destroyLocateButton(a.inputNode._locateButton),this.updateStop(new H(c.graphic.geometry),t.indexOf(this.geocoders,a)).then(d.hitch(this,function(){1<this.stopGraphics.length?
this.getDirections().always(function(){e.resolve(c)}):e.resolve(c)}))):(a.set("value",""),a.inputNode.placeholder=C.widgets.directions.myLocationError.toUpperCase(),console.error(c.error),e.reject(c.error))}));c?(g(),l.locate().then(null,e.reject)):e.resolve()}else e.resolve()}));return e.promise},_destroyLocateButton:function(a){if(a){var b=a.domNode._geocoder;clearTimeout(b._destroyTimeout);a._locating?b._destroyTimeout=setTimeout(d.hitch(this,function(){b._lbShown_lb||b._lbShown_f||this._destroyLocateButton(a)}),
100):(a.clear(),a._onBeforeLocate.remove(),a._onLocate.remove(),a._onMouseEnter&&a._onMouseEnter.remove(),a._onMouseOut&&a._onMouseOut.remove(),a.destroy(),b.inputNode&&(b.inputNode._locateButton=null,b._setPlaceholder(b.activeSourceIndex)))}},_sortStops:function(){this.stops.length&&(this.stops.sort(d.hitch(this,function(a,b){for(var c,d,e=0;e<this.get("geocoders").length;e++)this.geocoders[e]._stopReference===a?c=e:this.geocoders[e]._stopReference===b&&(d=e);return c>d?1:d>c?-1:0})),this._setStops())},
_getCandidate:function(a){var b=new I,c=typeof a;a?"object"===c&&a.hasOwnProperty("feature")&&a.hasOwnProperty("name")?(a.feature.attributes&&void 0!==a.feature.attributes.displayName&&!this._isStopAWaypoint(a)&&(a.name=a.feature.attributes.displayName,a.feature.attributes.Name=this._userDefinedStopName),a.name=this._isStopAWaypoint(a)?this._waypointName:String(a.name),"point"!==a.feature.geometry.type&&(a.feature.geometry=new U([a.feature.geometry.x,a.feature.geometry.y],this.map.spatialReference)),
b.resolve(a)):"object"===c&&a.hasOwnProperty("address")&&a.hasOwnProperty("location")?(a=this._globalGeocoder._hydrateResult(a),b.resolve(a)):"object"!==c||!a.hasOwnProperty("name")||null!==a.name&&""!==a.name?a instanceof H&&a.attributes&&(void 0!==a.attributes.Name||a.attributes.isWaypoint)?(c=this._addStopWrapperToGraphic(a,a.attributes.isWaypoint?this._waypointName:String(a.attributes.Name)),String(a.attributes.Name)&&(c.feature.attributes.Name=this._userDefinedStopName),b.resolve(c)):("object"===
c&&a.hasOwnProperty("name")&&(a=String(a.name)),this._reverseGeocode(a).then(b.resolve,b.reject)):b.resolve(d.clone(this._emptyStop)):b.resolve(d.clone(this._emptyStop));return b.promise},_reverseGeocode:function(a){var b=new I,c,e=a.geometry?a.geometry:a;if(this._globalGeocoder){var f=d.hitch(this,function(a){var b=new I,c=500;if(this.map){var d=this.map.toScreen(e);d.x+=da._calculateClickTolerance([a]);this.map.spatialReference.isWebMercator()?(c=Math.abs(this.map.toMap(d).x-e.x),b.resolve(c)):
4326===this.map.spatialReference.wkid?(c=Math.abs(R.geographicToWebMercator(this.map.toMap(d)).x-R.geographicToWebMercator(e).x),b.resolve(c)):this._geometryService&&(a=new ya,a.distanceUnit=pa.UNIT_METER,a.geometry1=e,a.geometry2=this.map.toMap(d),this._geometryService.distance(a,function(a){c=a;b.resolve(c)},function(){b.resolve(c)}))}return b.promise}),g=[],h=this._globalGeocoder.sources,k=function(){h[c].featureLayer&&g.push(f(h[c].featureLayer).then(d.hitch(h[c],function(a){this.searchQueryParams=
d.mixin(this.searchQueryParams,{distance:a})})))};if("all"===this._globalGeocoder.activeSourceIndex)for(c=0;c<h.length;c++)k();else c=this._globalGeocoder.activeSourceIndex,k();K(g).always(d.hitch(this,function(){this._globalGeocoder.search(e).then(d.hitch(this,function(d){var f=!1;if(d){var g=null,h;for(c=0;c<this._globalGeocoder.sources.length;c++)if(d[c]&&d[c].length){h=d[c];break}if(h.length&&(f=!0,g=h[0],this._globalGeocoder.sources[c].featureLayer))for(d=Number.POSITIVE_INFINITY,c=0;c<h.length;c++){h[c]=
this._toPointGeometry(h[c]);var k=Y.geodesicLengths([new fa({paths:[[R.xyToLngLat(e.x,e.y),R.xyToLngLat(h[c].feature.geometry.x,h[c].feature.geometry.y)]],spatialReference:{wkid:this.map.spatialReference.wkid}})],"esriMeters")[0];d>k&&(d=k,g=h[c])}(g=this._decorateEmptyAGOLGeocoderResponse(g))&&""!==g.name&&null!==g.name&&void 0!==g.name?(g.name=String(g.name),isNaN(e.x)||isNaN(e.y)||this.map.spatialReference.wkid!==e.spatialReference.wkid?!g.feature.geometry||isNaN(g.feature.geometry.x)||isNaN(g.feature.geometry.y)?
(this._showMessage(C.widgets.directions.error.locator),b.reject(Error(C.widgets.directions.error.locator))):b.resolve(g):(g.feature.geometry=e,b.resolve(g))):f=!1}f||(a instanceof U?a=new H(a):a instanceof Array&&(a=new H(new U(a[0],a[1]))),a instanceof H?this._decorateUngeocodedStop(a).then(b.resolve,b.reject):(this._showMessage(C.widgets.directions.error.unknownStop.replace("\x3cname\x3e",a.toString())),b.reject(Error(C.widgets.directions.error.unknownStop.replace("\x3cname\x3e",a.toString())))))}))}))}else this._showMessage(C.widgets.directions.error.locatorUndefined),
b.reject(Error(C.widgets.directions.error.locatorUndefined));return b.promise},_updateStop:function(a,b,c){var e=new I;this.stops&&this.stops[b]?a instanceof H&&a.attributes&&a.attributes.isWaypoint&&(!b||b===this.stops.length-1||2>this._getStopCount())?(this._showMessage(C.widgets.directions.error.waypointShouldBeInBetweenStops),e.reject(Error(C.widgets.directions.error.waypointShouldBeInBetweenStops))):this._getCandidate(a).then(d.hitch(this,function(a){var d=a.feature,d=d?d.geometry:null,f=this.stops[b].feature,
f=f?f.geometry:null,d=d&&f&&(d.x!==f.x||d.y!==f.y)||!d&&f;this.stops[b]=a;this.geocoders[b]||this._createGeocoder(a,b);f=this.geocoders[b];f._stopReference=a;f._tr.style.display=this._isStopAWaypoint(a)?"none":"";f.value=a.name;f.inputNode&&(f.inputNode.value=a.name);d&&this.autoSolve&&1<this._getStopCount()+this._getWaypointCount()||c?this._getDirections().then(e.resolve,e.reject):(this._setStops(),e.resolve(a))}),d.hitch(this,function(a){e.reject(a)})):(this._showMessage(C.widgets.directions.error.couldNotUpdateStop),
e.reject(Error(C.widgets.directions.error.couldNotUpdateStop)));this._optionsMenu();return e.promise},_renderDirections:function(){var a=this.get("directions"),b;this._resultsNode&&(b=""+('\x3cdiv class\x3d"'+this._css.clearClass+'"\x3e\x3c/div\x3e'),b+=this._renderDirectionsSummary(a),b+='\x3cdiv class\x3d"'+this._css.clearClass+'"\x3e\x3c/div\x3e',b+='\x3cdiv class\x3d"'+this._css.routesClass+'"\x3e',b+=this._renderDirectionsTable(a),b+="\x3cdiv class\x3d'esriPrintFooter'\x3e"+C.widgets.directions.printDisclaimer+
"\x3c/div\x3e",b+="\x3c/div\x3e",this._resultsNode&&(this._resultsNode.innerHTML=b),this._disconnectResults(),(a=w("[data-segment]",this._resultsNode))&&a.length&&t.forEach(a,d.hitch(this,function(a){this._resultEvents.push(f(a,l.enter,d.hitch(this,function(){if(!this._focusedDirectionsItem){var b=parseInt(z.get(a,"data-segment"),10);this.highlightSegment(b)}})));this._resultEvents.push(f(a,"focusout",d.hitch(this,function(){this._focusedDirectionsItem=null;this.unhighlightSegment(!0)})));this._resultEvents.push(f(a,
l.leave,this.unhighlightSegment));this._resultEvents.push(f(a,"click, keydown",d.hitch(this,function(b){b&&("click"===b.type||"keydown"===b.type&&b.keyCode===g.ENTER)&&(this._focusedDirectionsItem!==a?this.selectSegment(parseInt(z.get(a,"data-segment"),10)):(a.blur(),this.map.infoWindow.hide(),this._focusedDirectionsItem=null,this.unhighlightSegment(!0)))})))})))},_renderDirectionsSummary:function(a){var b="",c=d.hitch(this,function(){for(var b={},c=this._getDirectionsTimeAttribute(),d=this._getTimeNeutralAttribute()||
{},e=0,f=0,g=this.get("stops"),h=g.length-1;0<=h;h--)if(null!==g[h].feature.attributes.ArriveCurbApproach){b=g[h].feature.attributes;break}for(var k in b)b.hasOwnProperty(k)&&(k==="Cumul_"+c.name&&(e=b[k]),k==="Cumul_"+d.name&&(f=b[k]));b="esriTrafficLabelHidden";g=C.widgets.directions.noTraffic;h=a.totalTime-a.totalDriveTime;h=(f-this._convertCostValue(h,c.units,d.units))/(e-h||1);0<h&&.8>h?(b="esriTrafficLabelHeavy",g=C.widgets.directions.heavyTraffic):1===h?(b="esriTrafficLabelNone",g=C.widgets.directions.noTraffic):
1.25<h&&(b="esriTrafficLabelLight",g=C.widgets.directions.ligthTraffic);d=this._formatTime(f,!1,d.units);return{label:g,labelClass:b,ratio:h,noTrafficCostStr:1!==h&&d?d+" "+C.widgets.directions.onAverage+"\x3cbr\x3e":"",trafficCost:e,noTrafficCost:f,timeAtt:c}});if(a.totalLength||a.totalTime){var c=c(),e=this._getImpedanceAttribute(),b=b+("\x3cdiv class\x3d'"+this._css.resultsSummaryClass+"' data-full-route\x3d'true'\x3e\x3cdiv class\x3d'esriImpedanceCost'\x3e");if(this._isTimeUnits(e.units))b+=this._formatTime(c.trafficCost,
!0,c.timeAtt.units)+"\x3cdiv class\x3d'esriImpedanceCostHrMin'\x3e\x3cdiv class\x3d'esriImpedanceCostHr'\x3e"+C.widgets.directions.time.hr+"\x3c/div\x3e\x3cdiv class\x3d'esriImpedanceCostMin'\x3e"+C.widgets.directions.time.min+"\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d'esriOtherCosts'\x3e"+(c.noTrafficCost?"\x3cdiv class\x3d'esriTrafficLabel "+c.labelClass+"'\x3e"+c.label+"\x3c/div\x3e"+c.noTrafficCostStr:"")+this._formatDistance(a.totalLength);else var e=(e=C.widgets.directions.units[this.directionsLengthUnits])?
e.name:"",f=this.serviceDescription&&10.6<=this.serviceDescription.currentVersion,g=this.directions.features[0].attributes,b=b+(D.format(a.totalLength,{places:1})+"\x3cdiv class\x3d'esriImpedanceCostDist'\x3e"+e+"\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d'esriOtherCosts'\x3e"+(c.noTrafficCost&&f?"\x3cdiv class\x3d'esriTrafficLabel "+c.labelClass+"'\x3e"+c.label+"\x3c/div\x3e"+c.noTrafficCostStr:"")+this._formatTime(a.totalTime)+" "+("none"!==this.startTime&&c.noTrafficCost&&f?C.widgets.directions.atTheMoment+
" "+this._toSpatiallyLocalTimeString(g.arriveTimeUTC,g.ETA):""));b+="\x3c/div\x3e\x3c/div\x3e"}return b},_renderDirectionsTable:function(a){for(var b=0,c=0,d=0,e='\x3ctable summary\x3d"'+a.routeName+'"\x3e\x3ctbody role\x3d"menu"\x3e',f=0;f<a.features.length;f++){var g=a.features[f].attributes;"esriDMTDepart"===g.maneuverType&&(c=d=0);d+=g.length;c+=g.time;b+=g.time;e+=this._renderDirectionsItemTR(a.features[f],d,c,b)}return e+"\x3c/tbody\x3e\x3c/table\x3e"},_renderDirectionsItemTR:function(a,b,c,
d){var e=this.directions,f=e?t.indexOf(e.features,a):-1;d="";var g=this._css.routeClass,h=a._associatedStopWithReturnToStart&&a._associatedStopWithReturnToStart.attributes,k=a.attributes;if(-1<f){k&&(k.step=f+1);k.maneuverType&&(g+=" "+k.maneuverType);h&&null===h.ArriveCurbApproach&&null!==h.DepartCurbApproach?g+=" "+this._css.routeOriginClass:h&&null!==h.ArriveCurbApproach&&null===h.DepartCurbApproach&&(g+=" "+this._css.routeDestinationClass+" "+this._css.routeLastClass);d+='\x3ctr tabindex\x3d"0" role\x3d"menuitem" class\x3d"'+
g+" "+this._css.routeZoomClass+'" data-segment\x3d"'+f+'"\x3e';d+='\x3ctd class\x3d"'+this._css.routeIconColumnClass+'"\x3e';d+='\x3cdiv class\x3d"'+this._css.routeIconClass+'"\x3e';d+=this._getLetter(a._associatedStop);d=d+"\x3c/div\x3e\x3c/td\x3e"+('\x3ctd class\x3d"'+this._css.routeTextColumnClass+'"\x3e');d+='\x3cdiv class\x3d"'+this._css.routeInfoClass+'"\x3e';d+='\x3cdiv class\x3d"'+this._css.routeTextClass+'"\x3e';a=(e.strings[f]||[]).slice();if("esriDMTDepart"===k.maneuverType||"esriDMTStop"===
k.maneuverType)for(e=0;e<this.stops.length;e++)this.stops[e]&&this.stops[e].name&&a.push({string:this.stops[e].name});if(a){g=k.text;for(e=0;e<a.length;e++)g=this._boldText(g,a[e].string);k.formattedText=g}else k.formattedText=k.text;if("esriDMTStop"===k.maneuverType&&(b||c)||"esriDMTDepart"===k.maneuverType&&0===f)b=this._formatDistance(b-k.length,!0),c=this._formatTime(c-k.time),f=this._formatTime(k.time),a=this._formatDistance(k.length,!0),k.formattedText+="\x3cdiv class\x3d'esriRouteTextColumnCumulative'\x3e"+
b+(b&&c?" \x26middot; ":"")+c+(b||c?"\x3cbr\x3e":"")+(f?C.widgets.directions.serviceTime+":\x26nbsp;"+f:"")+(f&&a?"\x3cbr\x3e":"")+(a?C.widgets.directions.serviceDistance+":\x26nbsp;"+a:"")+"\x3c/div\x3e";d+="\x3cstrong\x3e"+D.format(k.step)+".\x3c/strong\x3e "+k.formattedText;d+="\x3c/div\x3e";b=this._formatDistance(k.length,!0);c=this._formatTime(k.time);"esriDMTStop"!==k.maneuverType&&"esriDMTDepart"!==k.maneuverType||!this.routeParams.startTime||-22091616E5===k.ETA?b&&(d+='\x3cdiv class\x3d"'+
this._css.routeLengthClass+'"\x3e',d+=b,c&&(d+="\x26nbsp;\x26middot;\x3cwbr\x3e\x26nbsp;"+c),d+="\x3c/div\x3e"):d+='\x3cdiv class\x3d"'+this._css.routeLengthClass+'"\x3e'+this._toSpatiallyLocalTimeString(k.arriveTimeUTC,k.ETA)+"\x3c/div\x3e";d+="\x3c/div\x3e\x3c/td\x3e\x3c/tr\x3e"}return d},_toSpatiallyLocalTimeString:function(a,b){var c=new Date(b),d=new Date(c.getTime()+6E4*c.getTimezoneOffset()),d=v.date.locale.format(d,{selector:"time"}),e="";a?(e=(b-a)/1E3/60/60,c=Math.floor(e),e=60*(e-c),c=
C.widgets.directions.GMT+(0>c?"":"+")+D.format(c,{pattern:"00"})+D.format(e,{pattern:"00"}),e=d+" "+c):e="now"===this.startTime?v.date.locale.format(c,{selector:"time"}):d;return e},_addStopWrapperToGraphic:function(a,b){return{extent:new ka({xmin:a.geometry.x-.25,ymin:a.geometry.y-.25,xmax:a.geometry.x+.25,ymax:a.geometry.y+.25,spatialReference:a.geometry.spatialReference}),feature:a,name:b}},_clearBarriersGraphics:function(){this._barriersLayer.clear();this._polylineBarriersLayer.clear();this._polygonBarriersLayer.clear()},
_showBarriers:function(){this._clearBarriersGraphics();var a=this.routeParams,b=a.polylineBarriers&&a.polylineBarriers.features||[],c=a.polygonBarriers&&a.polygonBarriers.features||[];t.forEach(a.barriers&&a.barriers.features||[],d.hitch(this,function(a){this._barriersLayer.add(a)}));t.forEach(b,d.hitch(this,function(a){this._polylineBarriersLayer.add(a)}));t.forEach(c,d.hitch(this,function(a){this._polygonBarriersLayer.add(a)}));this._barriersLayer.refresh();this._polylineBarriersLayer.refresh();
this._polygonBarriersLayer.refresh()},_showRoute:function(a){this._clearDisplayAfterSolve();var b=a.routeResults[0].directions,c=new I;if(b){this.set("solveResult",a);this.set("directions",b);var d=a.routeResults[0].stops,e,f;if(d&&d.length){var g=[];for(e=0;e<d.length;e++){var h=d[e];h.attributes.isWaypoint=h.attributes.Name===this._waypointName||h.attributes.isWaypoint;h=this._addStopWrapperToGraphic(h,h.attributes.Name);this.stops[e]&&this.stops[e].feature&&this.stops[e].feature.attributes&&this.stops[e].feature.attributes.Name===
this._userDefinedStopName&&(h.feature.attributes.Name=this._userDefinedStopName);this._returnToStartStop&&this._returnToStartStop._resultsStopIndex===e?this._returnToStartStop=h:g.push(h)}if(this.stops.length>g.length)for(e=0;e<this.stops.length;e++)this.stops[e].feature||""!==this.stops[e].name||g.splice(e,0,this._emptyStop);this.stops=g;for(e=0;e<this.stops.length;e++)this._updateStop(this.stops[e],e);this._setStops();this._setMenuNodeValues()}this.set("mergedRouteGraphic",new H(b.mergedGeometry,
this.get("routeSymbol")));d=[];g=[];for(e=h=0;e<b.featuresWithWaypoints.length;e++){var k=b.featuresWithWaypoints[e];if("esriDMTDepart"===k.attributes.maneuverType)for(f=0;f<this.stops.length;f++)if(this.stops[f].feature===k._associatedStop){h=f+1;break}k.setSymbol(this.get("routeSymbol"));this._routeLayer.add(k);d.push(k);(f=k.getDojoShape())&&f.moveToBack();f=new H(k.geometry,this._symbolEventPaddingDirections,k.attributes);f._nextStopIndex=h-.5;f._isSnapFeature=!0;k._associatedSnapFeature=f;this._waypointsEventLayer.add(f);
"esriDMTDepart"!==k.attributes.maneuverType&&(f=k.geometry.getPoint(0,0))&&(f=new H(f,this.maneuverSymbol),f._directionsFeature=k._associatedFeatureNoWaypoints,g.push(f),this._waypointsEventLayer.add(g[g.length-1]))}this.set("displayedRouteGraphics",d);this.set("displayedManeuverPointGraphics",g);this._renderDirections();for(e=0;e<this.stops.length;e++)if(this._isStopAWaypoint(this.stops[e])&&this._modifiedWaypointIndex===e){for(f=0;f<b.featuresWithWaypoints.length;f++)if(d=b.featuresWithWaypoints[f],
d._associatedStop===this.stops[e].feature){if("esriDMTStop"===d.attributes.maneuverType||"esriDMTDepart"===d.attributes.maneuverType)this.stops[e].feature.geometry.x=d.geometry.paths[0][0][0],this.stops[e].feature.geometry.y=d.geometry.paths[0][0][1];break}this._modifiedWaypointIndex=null;break}B.set(this._savePrintBtnContainer,"display","inline-block");this.onDirectionsFinish(a)}else a=a.routeResults[0].route,a.setSymbol(this.routeSymbol),this._routeLayer.add(a),this._incrementalRouteSegment=a;c.resolve();
this._moveLayersToFront();this.createRouteSymbols();return c.promise},_setGeocodersStopReference:function(){if(this.geocoders)for(var a=0;a<this.geocoders.length;a++)this.geocoders[a]&&this.stops[a]&&(this.geocoders[a]._stopReference=this.stops[a])},_setStops:function(){this._setGeocodersStopReference();this.createRouteSymbols();this._set("stops",this.stops);this.onStopsUpdate(this.stops)},_getCandidates:function(a){var b=[];if(a&&a.length){for(var c=0;c<a.length;c++)b.push(this._getCandidate(a[c]));
return K(b)}a=new I;a.resolve([]);return a.promise},_clearResultsHTML:function(){this._resultsNode.innerHTML="";B.set(this._savePrintBtnContainer,"display","none")},_showSegmentPopup:function(a){if(a&&this.get("showSegmentPopup")&&this.get("map").infoWindow){var b=a.geometry.getPoint(0,0);a=new H(b,null,a.attributes,this.get("segmentInfoTemplate"));var c=this.get("map").infoWindow;c.setFeatures([a]);c.show(b)}},_addStopButton:function(){this.addStop().then(d.hitch(this,function(){this.get("focusOnNewStop")&&
this.geocoders[this.stops.length-1].focus()}))},_sortGeocoders:function(){var a=this._dnd.getAllNodes();this.geocoders.sort(d.hitch(this,function(b,c){return b.domNode&&b.domNode.parentNode&&b.domNode.parentNode.parentNode&&c.domNode&&c.domNode.parentNode&&c.domNode.parentNode.parentNode?t.indexOf(a,b.domNode.parentNode.parentNode)>t.indexOf(a,c.domNode.parentNode.parentNode)?1:-1:0}));this.stops.length===this.geocoders.length&&this._sortStops();for(var b=0;b<this.geocoders.length;b++)this.geocoders[b]&&
this.geocoders[b].inputNode&&(this.geocoders[b].inputNode.title=C.widgets.directions.stopNoTitle+(b+1));this._setLocateButtonVisibilityEvents()},_disconnectResults:function(){if(this._resultEvents&&this._resultEvents.length)for(var a=0;a<this._resultEvents.length;a++)this._resultEvents[a]&&this._resultEvents[a].remove();this._resultEvents=[]},_formatArbitraryCostsForRouteTooltip:function(a){var b="",c;for(c in a)if(0===c.indexOf("Total_")&&a.hasOwnProperty(c)){var d=this._getCostAttribute(c.substr(6));
d&&(b+=this._isTimeUnits(d.units)?this._formatTime(a[c],!1,d.units):this._formatDistance(a[c],!0,d.units),b+=b?" \x26middot; ":"")}b&&(b=C.widgets.directions.toNearbyStops+": \x3cb\x3e"+b.substr(0,b.length-10)+"\x3c/b\x3e");return b},_formatTime:function(a,b,c){c||(c=(this._getDirectionsTimeAttribute()||{}).units);var d="";c=Math.round(this._convertCostValue(a,c,"esriNAUMinutes"));a=Math.floor(c/60);c=Math.floor(c%60);b?d=D.format(a,{pattern:100>a?"00":"000"})+":"+D.format(c,{pattern:"00"}):(a&&(d+=
a+" "+C.widgets.directions.time.hr+" "),d+=a||c?c+" "+C.widgets.directions.time.min:"");return d},_formatDistance:function(a,b,c){c||(c=this.directionsLengthUnits);var d=this.directionsLengthUnits,e=C.widgets.directions.units[d],f=d.replace("esri","").toLowerCase();a=this._convertCostValue(a,c,d);e&&(f=b?e.abbr:e.name);return a?D.format(a,{locale:"root",places:2})+" "+f:""},_createToolbars:function(){this.editToolbar||(this.editToolbar=new na(this.map));this.drawToolbar||(this.drawToolbar=new ua(this.map),
C.toolbars.draw.freehand=C.widgets.directions.lineBarrierFreehand,this.drawToolbar.onDrawComplete=d.hitch(this,function(a){var b=new H(a.geometry,null,{BarrierType:0});1<Y.geodesicLengths([a.geographicGeometry],Q.METERS)[0]&&(this._polylineBarriersLayer.add(b),this.routeParams.polylineBarriers||(this.routeParams.polylineBarriers=new ta),this.routeParams.polylineBarriers.features.push(b),this._clearStopsStatusAttr(),this.getDirections(!0))}))},_destroyGlobalGeocoder:function(){this._globalGeocoder&&
(this._globalGeocoder.destroy(),this._globalGeocoder=null)},_createGlobalGeocoder:function(){var a=new I;this._globalGeocoder=new O(this.get("searchOptions"));f.once(this._globalGeocoder,"load",a.resolve,a.reject);this._globalGeocoder.startup();return a.promise},_init:function(){var a=new I;this.set("loaded",!1);this._enableButton(this._getDirectionsButtonNode,!1);B.set(this._saveAsButton,"display","none");this.clearMessages();if(this.get("map").loaded)this._configure().always(a.resolve);else f.once(this.get("map"),
"load",d.hitch(this,function(){this._configure().always(a.resolve)}));return a.promise},_setDefaultStops:function(){var a=new I;this.defaults.stops&&this.defaults.stops.length?this._updateStops(this.defaults.stops).then(d.hitch(this,function(){this._removeEmptyStops();a.resolve()}),a.reject):a.resolve();return a.promise},_configure:function(){var a=new I;this._handle&&this._handle._remove();this._createDnD();this._createDepartAtControls();this._setSearchOptions();this._createGlobalGeocoder().then(d.hitch(this,
function(){this._createToolbars();this._usingAGOL()||(this.printTaskUrl=this.geometryTaskUrl=null);this._createGeometryTask();this._createPrintTask();this._showActivateButton();this._showBarriersButton();this._createTravelModesDDL();this._createSearchSourceDDL();var b=[this._createRouteTask(),this._setDefaultStops()];K(b).then(d.hitch(this,function(){this._setDefaultUnits();this._setTrafficOptions();this._setMenuNodeValues();this._setupEvents();var b=this.directionsLanguage||this.userOptions.routeParams&&
this.userOptions.routeParams.directionsLanguage||v.locale.toLowerCase();this._setDirectionsLanguageByLocale(b);this._setupTravelModes().then(d.hitch(this,function(){this.set("loaded",!0);this.onLoad();a.resolve(!0)}),function(b){a.reject(b)})}),function(b){a.reject(b)})}),function(b){a.reject(b)});this._naRouteSharing=null;return a.promise},_setDirectionsLanguageByLocale:function(a){var b=this.serviceDescription.directionsSupportedLanguages,c=function(a){if(b)for(var c=0;c<b.length;c++)if(b[c].toLowerCase().substr(0,
2)===a)return b[c];return null},d=c(a);d||(a=a.substr(0,2),d=c(a));this.directionsLanguage=d;return this.routeParams.directionsLanguage=d},_getStopSymbol:function(a,b){var c=a&&(a.feature&&a.feature.attributes||a.attributes),d=this.stopSymbol;c&&(d=this._isStopAWaypoint(a)?this.waypointSymbol:void 0===c.Status||0===c.Status||6===c.Status?null===c.ArriveCurbApproach&&null!==c.DepartCurbApproach?this.get(b?"fromSymbolDrag":"fromSymbol"):null!==c.ArriveCurbApproach&&null===c.DepartCurbApproach?this.get(b?
"toSymbolDrag":"toSymbol"):this.get(b?"stopSymbolDrag":"stopSymbol"):this.get(b?"unreachedSymbolDrag":"unreachedSymbol"));return d},_addTrafficLayer:function(){this.trafficLayer&&!this._trafficLayerAdded&&this.map&&(this.map.addLayer(this.trafficLayer),this.trafficLayer.show(),this._trafficLayerAdded=!0)},_toggleUnits:function(a){a.target===this._useMilesNode?this.setDirectionsLengthUnits(Q.MILES):a.target===this._useKilometersNode&&this.setDirectionsLengthUnits(Q.KILOMETERS)},_toggleCheckbox:function(a){var b=
z.get(a.target,"checked");a.target===this._findOptimalOrderNode?this.set("optimalRoute",b):a.target===this._useTrafficNode?this.set("traffic",b):a.target===this._returnToStartNode&&this.set("returnToStart",b)},_isStopLocated:function(a){return a&&a.feature&&a.feature.attributes&&(!a.feature.attributes.Status||6===a.feature.attributes.Status)},_configureRouteOptions:function(){var a=this.get("routeParams"),b;this.get("directionsLengthUnits")?a.directionsLengthUnits=this.get("directionsLengthUnits"):
this.set("directionsLengthUnits",a.directionsLengthUnits);a.findBestSequence=this.get("optimalRoute");if(a.findBestSequence)for(a.preserveFirstStop=this._isStopLocated(this.stops[0]),a.preserveLastStop=!this.returnToStart&&this._isStopLocated(this.stops[this.stops.length-1])||this.returnToStart&&this._isStopLocated(this.stops[0]),b=0;b<this.stops.length;)this._isStopAWaypoint(this.stops[b])?this._removeStop(b,!0,!0):b++;if(!this.returnToStart&&this.stops.length&&this._isStopAWaypoint(this.stops[this.stops.length-
1]))for(b=this.stops.length-1;0<b;)this._isStopAWaypoint(this.stops[b])&&this._removeStop(b,!0,!0),b--;if(this._isTimeUnits(this._getImpedanceAttribute().units)||this.serviceDescription&&10.6<=this.serviceDescription.currentVersion)if(a.useTimeWindows=!0,"now"===this.startTime)a.timeWindowsAreUTC=!0,a.startTimeIsUTC=!0,a.startTime=new Date;else if("none"===this.startTime)a.startTime=null;else{a.timeWindowsAreUTC=!1;a.startTimeIsUTC=!1;var c=this._departAtTime,d=6E4*c.getValue().getTimezoneOffset(),
c=new Date(c.getValue().getTime()+this._departAtDate.getValue().getTime()-d),c=new Date(c.getTime()-6E4*c.getTimezoneOffset());a.startTime=c}else a.startTime=null,a.useTimeWindows=!1;var c=this._getImpedanceAttribute(),d=this._getTimeNeutralAttribute(),e=this._getDirectionsTimeAttribute();b=this.routeParams.accumulateAttributes||this.serviceDescription.accumulateAttributeNames;d&&-1===t.indexOf(b,d.name)&&b.push(d.name);!this._isTimeUnits(c.units)&&this.serviceDescription&&10.6<=this.serviceDescription.currentVersion&&
e&&-1===t.indexOf(b,e.name)&&b.push(e.name);this.routeParams.accumulateAttributes=b;a.returnStops=!0;e=[];for(b=0;b<this.stopGraphics.length;b++)if(this.stopGraphics[b]&&(e.push(new H(this.stopGraphics[b].toJson())),b)){var f=e[0].attributes,g=e[b].attributes,h;for(h in g)g.hasOwnProperty(h)&&!f.hasOwnProperty(h)&&(f[h]=null)}this.get("returnToStart")&&this.stopGraphics.length&&this._isStopLocated(this.stops[0])?(h=new H(this.stopGraphics[0].toJson()),this._returnToStartStop=this._addStopWrapperToGraphic(h,
h.attributes.Name),e.push(h)):this._returnToStartStop=null;a.stops.features=e;if(d)for(b=0;b<e.length;b++)e[b].attributes["Attr_"+d.name]=this._convertCostValue(e[b].attributes["Attr_"+c.name],c.units,d.units);this.set("routeParams",a)},_configureRoute:function(){var a=new I;a.promise.always(d.hitch(this,function(){this._checkMaxStops()}));this.createRouteSymbols();this._configureRouteOptions();if(this.routeParams.returnRoutes&&this._incrementalSolveStopRange){var b=this._incrementalSolveStopRange;
b.start<b.end?this.routeParams.stops.features=this.routeParams.stops.features.slice(b.start,b.end+1):b.start>b.end&&(this.routeParams.stops.features=this.routeParams.stops.features.slice(b.start,this.routeParams.stops.features.length-1).concat(this.routeParams.stops.features.slice(0,b.end+1)))}else this._incrementalSolveStopRange=null;for(var c={},e=this.routeParams.stops.features,f,g,b=0;b<e.length;b++)g=e[b].attributes.address,f=(b===this._handle._index&&!this._handle.attributes.isWaypoint&&this._incrementalSolveStopRange?
this._waypointName:g)+"_"+this._stopSequence++,e[b].attributes.Name=f,c[f]=g,delete e[b].attributes.address,delete e[b].attributes.isWaypoint,delete e[b].attributes.Status;this._solveInProgress=!0;var h={_incrementalSolveStopRange:this._incrementalSolveStopRange};this.routeTask.solve(this.routeParams,d.hitch(this,function(b){this._solveResultProcessing(b,c,h).then(a.resolve,a.reject)}),d.hitch(this,function(b){d.mixin(this,h);this._solveInProgress=!1;for(var c=0;c<this.stops.length;c++)this.stops[c].feature&&
(this.stops[c].feature.attributes=d.mixin(this.stops[c].feature.attributes,{Status:5}));this.set("directions",null);this._clearDisplayAfterSolve();this.createRouteSymbols();this._routeTaskError(b);a.reject(b)}));return a.promise},_solveResultProcessing:function(a,b,c){var e=new I;d.mixin(this,c);this._solveInProgress=!1;c=a.routeResults[0];var f=c.directions;c=c.stops;var g;if(f){this._solverMessages=a.messages;var h=function(a){for(var c in b)if(a&&0===f.routeName.indexOf(c)||!a&&0<f.routeName.indexOf(c))return b[c];
return""};g=h(!0);h=h(!1);f.routeName=(g!==this._waypointName?g:C.widgets.directions.waypoint)+" \u2014 "+(h!==this._waypointName?h:C.widgets.directions.waypoint);for(g=0;g<f.features.length;g++)if(h=f.features[g].attributes,"esriDMTDepart"===h.maneuverType||"esriDMTStop"===h.maneuverType)for(var k in b)if(b.hasOwnProperty(k)&&-1<h.text.indexOf(k)){h.text=h.text.replace(k,b[k]);for(var l=0;l<c.length;l++){var m=c[l].attributes;if(m.Name===k){d.mixin(f.features[g],{_associatedStop:c[this.returnToStart&&
l===c.length-1?0:l],_associatedStopWithReturnToStart:c[l]});if(!m.ArriveTime&&!m.ArriveTimeUTC&&h.ETA&&h.arriveTimeUTC){m.ArriveTime=h.ETA;m.ArriveTimeUTC=h.arriveTimeUTC;l=0;if(0==g&&"esriDMTDepart"===h.maneuverType||0<g&&"esriDMTStop"===h.maneuverType)l=this._convertCostValue(h.time,this._getDirectionsTimeAttribute().units,"milliseconds");m.DepartTime=m.ArriveTime+l;m.DepartTimeUTC=m.ArriveTimeUTC+l}break}}}for(g=0;g<c.length;g++)this._returnToStartStop&&c[g].attributes.Name===this._returnToStartStop.feature.attributes.Name&&
(this._returnToStartStop._resultsStopIndex=g),c[g].attributes.Name=b[c[g].attributes.Name];this._directionsPostprocessing(f);this.traffic&&this._updateMapTimeExtent()}this._showRoute(a).always(d.hitch(this,function(){this._incrementalSolveStopRange=null;e.resolve(a)}));return e.promise},_directionsPostprocessing:function(a){var b,c,e=function(b,c){var d=a.features[b]._associatedFeaturesWithWaypoints||[];d.push(a.featuresWithWaypoints[c]);a.features[b]._associatedFeaturesWithWaypoints=d;a.featuresWithWaypoints[c]._associatedFeatureNoWaypoints=
a.features[b]};c=d.hitch(this,function(a){return"\x3cdiv class\x3d'"+this.theme+"'\x3e\x3ctable class\x3d'esriRoutesTooltip'\x3e"+this._renderDirectionsItemTR(a._associatedFeatureNoWaypoints)+"\x3c/table\x3e\x3c/div\x3e"});a.featuresWithWaypoints=[];for(b=0;b<a.features.length;b++){var f=new H(a.features[b].toJson());f.setInfoTemplate(new V({title:this._i18n.widgets.directions.maneuver,content:c}));a.featuresWithWaypoints.push(f);a.featuresWithWaypoints[b]._associatedStop=a.features[b]._associatedStop;
a.featuresWithWaypoints[b]._associatedStopWithReturnToStart=a.features[b]._associatedStopWithReturnToStart}a.stringsWithWaypoints=d.mixin([],a.strings);a.eventsWithWaypoints=d.mixin([],a.events);for(c=b=0;b<a.features.length;)a.features[b]._associatedStop&&a.features[b]._associatedStop.attributes.Name===this._waypointName?(a.features.splice(b,b?2:1),a.strings.splice(b,b?2:1),a.events.splice(b,b?2:1),b&&a.features[b]&&"esriDMTStraight"===a.features[b].attributes.maneuverType?(f=a.features.splice(b,
1)[0],a.strings[b-1]=(a.strings[b-1]||[]).concat(a.strings.splice(b,1)[0]||[]),a.strings[b-1].length||(a.strings[b-1]=void 0),a.events[b-1]=(a.events[b-1]||[]).concat(a.events.splice(b,1)[0]||[]),a.events[b-1].length||(a.events[b-1]=void 0),a.features[b-1].attributes.length+=f.attributes.length,a.features[b-1].attributes.time+=f.attributes.time,a.features[b-1].geometry.paths[0]=a.features[b-1].geometry.paths[0].concat(f.geometry.paths[0]),e(b-1,c++),e(b-1,c++),e(b-1,c++)):(b&&e(b-1,c++),b<a.features.length&&
e(b,c++))):(e(b,c++),b++)},_boldText:function(a,b){var c=a;try{var d=new RegExp("[^\x3cstrong\x3e\x26nbsp;]"+b.replace(/(\||\$|\^|\(|\)|\[|\]|\{|\}|\/|\.|\+|\*|\?|\?)/g,"\\$1")+"[^\x26nbsp;\x3c/strong\x3e]","g"),c=(" "+c+" ").replace(d,"\x3cstrong\x3e\x26nbsp;"+b+"\x26nbsp;\x3c/strong\x3e"),c=c.trim()}catch(va){}return c},_clearStopGraphics:function(){if(this.stopGraphics&&this.stopGraphics.length)for(var a=0;a<this.stopGraphics.length;a++)this._stopLayer.remove(this.stopGraphics[a]),this._stopLayer.remove(this.textGraphics[a]);
this.set("stopGraphics",[]);this.set("textGraphics",[])},_updateMapTimeExtent:function(){if(this.map){var a=this.directions&&this.directions.features[0]&&this.directions.features[0].attributes||{},b=(new Date).getTime(),b="none"==this.startTime?b:a.arriveTimeUTC||b;this._useTrafficItemNode.title="none"!==this.startTime&&a.arriveTimeUTC?C.widgets.directions.trafficLabelDepartAt+": "+this._toSpatiallyLocalTimeString(a.arriveTimeUTC,a.ETA):"";this._myTimeExtentUpdate=!0;a=new Date(b);this.map.setTimeExtent(new ja(a,
a))}},_restoreMapTimeExtent:function(){this.map&&(this._myTimeExtentUpdate=!0,this.map.setTimeExtent(this._externalTimeExtent))},_clearRouteGraphics:function(){for(var a=this.displayedRouteGraphics,b=this.displayedManeuverPointGraphics,c=this._routeLayer,d=this._waypointsEventLayer,e=0,f=0,g=this._incrementalSolveStopRange?this._incrementalSolveStopRange:{start:0,end:this.stops?this.stops.length:-1};a&&f<a.length;){if(a[f]._associatedStop)for(var h=0;h<this.stops.length;h++)if(this.stops[h].feature===
a[f]._associatedStop){e=h;break}e>=g.start&&e<g.end||g.start>=g.end&&(e>=g.start||e<g.end)?(c.remove(a[f]),a.splice(f,1)):f++}c.remove(this._incrementalRouteSegment);this.set("displayedRouteGraphics",a?a:[]);b&&b.length&&t.forEach(b,function(a){d.remove(a)});this.set("displayedManeuverPointGraphics",[]);this._waypointsEventLayer.clear();this.unhighlightSegment(!0)},_clearInfoWindow:function(){var a=this.get("map").infoWindow;a&&(a.hide(),a.clearFeatures())},_clearDisplayBeforeSolve:function(){this._toggleSaveMenu(!1);
this._clearInfoWindow();this._clearResultsHTML()},_clearDisplayAfterSolve:function(){this._clearStopGraphics();this._clearRouteGraphics();this._clearBarriersGraphics();this.clearMessages()},_getLetter:function(a){var b=this.alphabet,c="",e=function(a){var c="";"0123456789"===b||"1234567890"===b?c=String(a+1):(a=a||0,a>=b.length&&(c=e(Math.floor(a/b.length)-1),a%=b.length),c+=b[a]);return c},f=a instanceof H?d.hitch(this,function(){for(var b=this.get("returnToStart")?0:-1,c=0;c<this.stops.length;c++)if(this.stops[c].feature===
a){b=c;break}return b})():a;if(-1<f&&b&&b.length){b instanceof Array&&(b=b.toString().replace(/,/g,""));for(var c=-1,g=0;g<=f;g++)c+=this._isStopAWaypoint(this.stops[g])?0:1;c=e(c)}return c},_solveAndZoom:function(a){if(this.autoSolve)return this._getDirections().then(d.hitch(this,function(){a||this.zoomToFullRoute()}));var b=new I;b.resolve();return b.promise},_setupEvents:function(){this._onEvents.push(f(this.domNode,"[data-blur-on-click]:click",function(){this.blur()}));this._onEvents.push(f(this._dndNode,
"[data-reverse-stops]:click, [data-reverse-stops]:keydown",d.hitch(this,function(a){a&&("click"===a.type||"keydown"===a.type&&a.keyCode===g.ENTER)&&this.modifyStopSequence()})));this._onEvents.push(f(this._printButton,"click, keydown",d.hitch(this,function(a){a&&("click"===a.type||"keydown"===a.type&&a.keyCode===g.ENTER)&&this._printDirections()})));this._onEvents.push(f(this._resultsNode,"[data-full-route]:click, [data-full-route]:keydown",d.hitch(this,function(a){a&&("click"===a.type||"keydown"===
a.type&&a.keyCode===g.ENTER)&&this.zoomToFullRoute()})));this._onEvents.push(f(this._dndNode,"[data-remove]:click, [data-remove]:keydown",d.hitch(this,function(a){if(a&&("click"===a.type||"keydown"===a.type&&a.keyCode===g.ENTER)){var b=w("[data-remove]",this._dndNode);a=t.indexOf(b,a.target);this.removeStop(a)}})));this._onEvents.push(f(this._dndNode,"[data-center-at]:click, [data-center-at]:keydown",d.hitch(this,function(a){if(a&&("click"===a.type||"keydown"===a.type&&a.keyCode===g.ENTER)){var b=
w("[data-center-at]",this._dndNode);a=t.indexOf(b,a.target);this.stops[a]&&this.stops[a].feature&&this.stops[a].feature.geometry&&this.map.centerAndZoom(this.stops[a].feature.geometry)}})));this._onEvents.push(f(this.map,"zoom-end",d.hitch(this,function(){var a=this._segmentGraphics;a&&a[0]&&void 0!==a[0].attributes._index&&this.highlightSegment(a[0].attributes._index,!0)})));this._onEvents.push(f(this._dnd,"Drop",d.hitch(this,function(){this._dnd.sync();this.set("optimalRoute",!1);var a,b,c=!1,d=
[],e=this._dnd.getAllNodes();for(a=0;a<this.geocoders.length;a++)if(b=t.indexOf(e,this.geocoders[a]._tr),-1<b&&a!==b&&a!==b-1){for(;0<b&&this._isStopAWaypoint(this.stops[b]);)b--;c=!0;break}c&&(d=this._markWPsForRemovalAfterUserChangedStopSequence(a,b));this._sortGeocoders();this.setListIcons();this._removeSomeWaypoints(d);this.stops[b].name&&this.getDirections()})));this._onEvents.push(f(this._dnd,"DndStart",d.hitch(this,function(){var a=w("body")[0];A.add(a,this._css.dndDragBodyClass);this._removeLocateButtonVisibilityEvents()})));
this._onEvents.push(f(this._dnd,"DndDrop, DndCancel",d.hitch(this,function(){var a=w("body")[0];A.remove(a,this._css.dndDragBodyClass);this._setLocateButtonVisibilityEvents()})));var a=this._handle,b=d.hitch(this,function(b){var c=d.hitch(this,function(c,d,e,f,g){var h=a._isShown();a.setGeometry(c);a._tooltip.style.left=b.screenPoint.x+"px";a._tooltip.style.top=b.screenPoint.y+"px";!h||a._index===e&&a.attributes.isWaypoint===f||(a._remove(),h=!1);a.setSymbol(d);a._index=e;a._isStopIcon=a._index===
Math.floor(a._index);a.attributes.isWaypoint=f;a._isStopIcon&&(a.attributes.address=this.stopGraphics[e].attributes.address,a.setInfoTemplate(this.stopGraphics[e].infoTemplate));if(this.canModifyWaypoints||a._isStopIcon)h||(this._stopLayer.add(a),(c=a.getDojoShape())&&c[f?"moveToBack":"moveToFront"].call(c)),this.editToolbar.activate(na.MOVE,a);f=f?a._isStopIcon?C.widgets.directions.dragWaypoint:this.canModifyWaypoints?C.widgets.directions.dragRoute:"":C.widgets.directions.dragStop;a._showTooltip(g||
f)});this.unhighlightSegment();if(this.mapClickActive&&this.dragging&&!this._solveInProgress&&!this._moveInProgress&&!a._solveTimeout)if(clearTimeout(a._removeTimeout),(b.graphic._isStopIcon||b.graphic._isStopLabel)&&!b.graphic.attributes.isWaypoint&&this.canModifyStops||b.graphic._isStopIcon&&b.graphic.attributes.isWaypoint&&this.canModifyWaypoints){var e=b.graphic._isStopLabel?this.stopGraphics[b.graphic._index]:b.graphic;c(e.geometry,this._getStopSymbol(this.stops[e._index],!0),e._index,!0===e.attributes.isWaypoint);
this._stopLayer.remove(this.stopGraphics[e._index]);this._stopLayer.remove(this.textGraphics[e._index])}else if(b.graphic._isSnapFeature||b.graphic._isHandle&&!b.graphic._isStopIcon)this._snappingManager||(this._snappingManager=this.map.snappingManager),this._snappingManager.getSnappingPoint(b.screenPoint).then(d.hitch(this,function(d){if(!this.maxStopsReached&&!this._moveInProgress&&d){for(var e=this.displayedManeuverPointGraphics,f=null,g=0;g<e.length;g++)if(e[g].geometry.x===d.x&&e[g].geometry.y===
d.y){f=e[g]._directionsFeature;e=t.indexOf(this.directions.features,f);-1<e&&this.highlightSegment(e);break}c(d,b.graphic._isHandle?a.symbol:this.waypointSymbol,b.graphic._isHandle?a._index:b.graphic._nextStopIndex,b.graphic._isHandle?a.attributes.isWaypoint:!0,f)}}))}),c=d.hitch(this,function(){clearTimeout(a._removeTimeout);a._removeTimeout=setTimeout(a._remove,100);this.unhighlightSegment()}),e=d.hitch(this,function(a){if(this.barrierToolActive){a=a.graphic;var b=this.routeParams,c=b.barriers?
t.indexOf(b.barriers.features,a):-1,d=b.polygonBarriers?t.indexOf(b.polygonBarriers.features,a):-1,e=b.polylineBarriers?t.indexOf(b.polylineBarriers.features,a):-1;-1<c&&b.barriers.features.splice(c,1);-1<d&&b.polygonBarriers.features.splice(d,1);-1<e&&b.polylineBarriers.features.splice(e,1);this._barriersLayer.remove(a);this._polygonBarriersLayer.remove(a);this._polylineBarriersLayer.remove(a);this._clearStopsStatusAttr();this.getDirections(!0)}});this._onEvents.push(this._waypointsEventLayer.on("mouse-move",
b));this._onEvents.push(this._waypointsEventLayer.on("mouse-out",c));this._onEvents.push(this._stopLayer.on("mouse-move",b));this._onEvents.push(this._stopLayer.on("mouse-out",c));this._onEvents.push(this._barriersLayer.on("click",e));this._onEvents.push(this._polylineBarriersLayer.on("click",e));this._onEvents.push(this._polygonBarriersLayer.on("click",e));this._editToolbarEvents();this._watchEvents.push(this.watch("theme",this._updateThemeWatch));this._watchEvents.push(this.watch("canModifyStops",
this._updateCanModifyStops));this._watchEvents.push(this.watch("canModifyWaypoints",this._updateCanAddWaypoints));this._watchEvents.push(this.watch("showReturnToStartOption",this._optionsMenu));this._watchEvents.push(this.watch("showOptimalRouteOption",this._optionsMenu));this._watchEvents.push(this.watch("returnToStart",this._setMenuNodeValues));this._watchEvents.push(this.watch("optimalRoute",this._setMenuNodeValues));this._watchEvents.push(this.watch("startTime",this._setStartTime));this._watchEvents.push(this.watch("traffic",
this._setMenuNodeValues));this._watchEvents.push(this.watch("trafficLayer",this._trafficLayerUpdate));this._watchEvents.push(this.watch("routeTaskUrl",d.hitch(this,function(){this._createRouteTask();this._setTrafficOptions()})));this._watchEvents.push(this.watch("printTaskUrl",d.hitch(this,function(){this._createPrintTask()})));this._watchEvents.push(this.watch("geometryTaskUrl",d.hitch(this,function(){this._createGeometryTask()})));this._watchEvents.push(this.watch("routeParams",d.hitch(this,function(){this._createRouteParams();
this._setDefaultUnits()})));this._watchEvents.push(this.watch("searchOptions",d.hitch(this,function(){this._setSearchOptions();this._createGlobalGeocoder();var a=this.get("searchOptions").sources;if(a)for(var b=0;b<this.geocoders.length;b++)this.geocoders[b].set("sources",a)})));this._watchEvents.push(this.watch("showReverseStopsButton",this.setListIcons));this._watchEvents.push(this.watch("editToolbar",this._editToolbarEvents));this._watchEvents.push(this.watch("showTravelModesOption",this._showTravelModesOption));
this._watchEvents.push(this.watch("showMilesKilometersOption",this._showMilesKilometersOption));this._watchEvents.push(this.watch("showClearButton",this._showClearButton));this._watchEvents.push(this.watch("directionsLengthUnits",this.setDirectionsLengthUnits));this._watchEvents.push(this.watch("directionsLanguage",this.setDirectionsLanguage));this._watchEvents.push(this.watch("mapClickActive",this._activate));this._watchEvents.push(this.watch("barrierToolActive",this._activateBarrierTool));this._watchEvents.push(this.watch("showActivateButton",
this._showActivateButton));this._watchEvents.push(this.watch("showBarriersButton",this._showBarriersButton));this._watchEvents.push(this.watch("showPrintPage",function(){B.set(this._printButton,"display",this.showPrintPage?"inline-block":"none")}));this._watchEvents.push(this.watch("showSaveButton",function(){B.set(this._saveMenuButton,"display",this.showSaveButton&&this.owningSystemUrl?"inline-block":"none")}))},_editToolbarEvents:function(){var a=d.hitch(this,function(a){var b="";if((a=a.routeResults?
a.routeResults[0]:null)&&a.route){a=a.route.attributes;var c=this.routeParams.travelMode;if(c)var b=b+("\x3cb\x3e"+c.name+"\x3c/b\x3e "+C.widgets.directions.toNearbyStops+": "),d=void 0!==a["Total_"+c.timeAttributeName]?this._formatTime(a["Total_"+c.timeAttributeName],!1,this._getCostAttribute(c.timeAttributeName).units):"",b=b+((void 0!==a["Total_"+c.distanceAttributeName]?this._formatDistance(a["Total_"+c.distanceAttributeName],!0,this._getCostAttribute(c.distanceAttributeName).units):"")+(d?" \x26middot; "+
d:""));else b=this._formatArbitraryCostsForRouteTooltip(a)}this._handle._showTooltip(b)}),b=d.hitch(this,function(c,e){var f=new I,g=this._handle,h=this.map.toScreen(g._origPoint).offset(c.transform.dx+g.symbol.xoffset,c.transform.dy+g.symbol.yoffset);c.origMapPoint||(c.origMapPoint=this.map.toMap(h));B.set(g._tooltip,"left",h.x+"px");B.set(g._tooltip,"top",h.y+"px");clearTimeout(g._solveTimeout);if(this._solveInProgress||!this._requestQueueTail.isFulfilled())g._solveTimeout=setTimeout(function(){b(c,
e).always(f.resolve)},100);else if(g._isStopIcon){var h=c.graphic._index,k=this.stops[h];(k=k?{name:k.name,extent:k.extent,feature:new H(k.feature.toJson())}:null)?(k.feature.setGeometry(c.origMapPoint),this._modifiedWaypointIndex=this._isStopAWaypoint(this.stops[h])?h:null,this._incrementalSolveStopRange={start:this.returnToStart?(this.stops.length+h-1)%this.stops.length:Math.max(0,h-1),end:this.returnToStart?(h+1)%this.stops.length:Math.min(this.stops.length-1,h+1)},this.updateStop(k,h,e).always(d.hitch(this,
function(b){g._solveTimeout=null;b.routeResults&&a(b);f.resolve()}))):f.resolve()}else f.resolve();return f.promise});this._onEvents.push(f(this.editToolbar,"graphic-click",d.hitch(this,function(a){if(a.graphic.attributes.isWaypoint)!a.graphic._isStopIcon||this._moveInProgress||this._solveInProgress||(this._handle._remove(),this._moveInProgress=!0,this.removeStop(a.graphic._index,!0).always(d.hitch(this,function(){this._moveInProgress=!1})));else{var b=this.get("map").infoWindow;b&&(b.setFeatures([a.graphic]),
b.show(a.graphic.geometry))}})));this._onEvents.push(f(this.editToolbar,"graphic-move-start",d.hitch(this,function(a){this._blurGeocoders();this._moveInProgress=!0;this._removeEmptyStops();this.routeParams.returnDirections=!1;this.routeParams.returnRoutes=!0;a=a.graphic;a._origPoint=new U(a.geometry.toJson());a._maxDeviation=0;a._solveHasHappened=!1;this.map.disableMapNavigation()})));this._onEvents.push(f(this.editToolbar,"graphic-move-stop",d.hitch(this,function(a){this.map.enableMapNavigation();
this.routeParams.returnDirections=!0;this.routeParams.returnRoutes=!1;if(this._handle._isStopIcon)if(this._handle._solveHasHappened)if(this._handle.attributes.isWaypoint)b(a,!0).always(d.hitch(this,function(){this._moveInProgress=!1;this._handle._isStopIcon=!0;this._handle._remove();this._showLoadingSpinner()}));else{clearTimeout(this._handle._solveTimeout);this._handle._solveTimeout=null;var c=this.stops[a.graphic._index],e=(c&&c.feature&&c.feature.attributes&&c.feature.attributes.Name)===this._userDefinedStopName,
f=c&&c.name;this._reverseGeocode(new H(a.graphic.toJson())).then(d.hitch(this,function(b){e&&(b.name=f,b.feature.attributes.Name=this._userDefinedStopName);this._setReverseGeocode(b,b.feature.geometry,a.graphic._index).always(d.hitch(this,function(){this._moveInProgress=!1;this._handle._remove();this._showLoadingSpinner()}))}))}else this._moveInProgress=!1;else this._moveInProgress=!1})));this._onEvents.push(f(this.editToolbar,"graphic-move",d.hitch(this,function(a){var c=this._handle,d=a.transform;
d.dx&&d.dy&&(a.graphic._maxDeviation=Math.max(c._maxDeviation,Math.sqrt(d.dx*d.dx+d.dy*d.dy)));10<c._maxDeviation&&(c._solveHasHappened=!0,a.graphic===c&&c.attributes.isWaypoint&&!c._isStopIcon?(this.set("optimalRoute",!1),c._index+=.5,c._isStopIcon=!0,a.graphic._stopIndex=c._index,this._incrementalSolveStopRange={start:this.returnToStart?(this.stops.length+c._index-1)%this.stops.length:Math.max(0,c._index-1),end:this.returnToStart?(c._index+1)%(this.stops.length+1):Math.min(this.stops.length,c._index+
1)},this.addStop({name:this._waypointName,feature:new H(c.geometry,c.symbol,{isWaypoint:!0,CurbApproach:3})},a.graphic._stopIndex)):((c=a.graphic.getDojoShape())&&c.moveToFront(),b(a)))})))},_isStopAWaypoint:function(a){return a&&a.feature&&a.feature.attributes&&a.feature.attributes.isWaypoint},_getStopCount:function(){var a=0,b;for(b=0;b<this.stops.length;b++)a+=!this._isStopAWaypoint(this.stops[b])&&this.stops[b].name?1:0;return a},_getWaypointCount:function(){var a=0,b;for(b=0;b<this.stops.length;b++)a+=
this._isStopAWaypoint(this.stops[b])?1:0;return a},_decorateUngeocodedStop:function(a){var b=new I,c=function(c,d){b.resolve({name:void 0===c?C.widgets.directions.unlocatedStop:c.toFixed(6)+" "+d.toFixed(6),feature:a})};if(a.geometry)if(a.geometry.spatialReference&&4326!==a.geometry.spatialReference.wkid)if(this.map&&this.map.spatialReference&&this.map.spatialReference.isWebMercator()){var e=R.xyToLngLat(a.geometry.x,a.geometry.y);c(e[0],e[1])}else this._geometryService?(e=new Ca,e.outSR=new ba(4326),
e.geometries=[a.geometry],this._geometryService.project(e).then(d.hitch(this,function(b){b&&b.length?c(b[0].x,b[0].y):c(a.geometry.x,a.geometry.y)}),d.hitch(this,function(){c()}))):c(a.geometry.x,a.geometry.y);else c(a.geometry.x,a.geometry.y);else c();return b.promise},_trafficLayerUpdate:function(a,b,c){a=this.get("map");b&&this._trafficLayerAdded&&(a.removeLayer(b),this._trafficLayerAdded=!1);c&&this.get("traffic")&&!this._trafficLayerAdded&&(a.addLayer(c),c.show(),this._trafficLayerAdded=!0)},
_routeTaskError:function(a){var b=C.widgets.directions.error.routeTask,c=a.details,d=function(a){return(res=a.match(/(\d+)/))?": "+res[0]:"."};c&&1===c.length&&("The distance between any inputs must be less than 50 miles (80 kilometers) when walking."===c[0]?b=C.widgets.directions.error.maxWalkingDistance:"Driving a truck is currently not supported outside of North America and Central America."===c[0]?b=C.widgets.directions.error.nonNAmTruckingMode:0===c[0].indexOf("The number of input locations loaded into Barriers")?
b=C.widgets.directions.error.tooManyBarriers+d(c[0]):0===c[0].indexOf("The number of input locations loaded into PolygonBarriers")?b=C.widgets.directions.error.tooManyPolygonBarriers+d(c[0]):0===c[0].indexOf("The number of input locations loaded into PolylineBarriers")&&(b=C.widgets.directions.error.tooManyPolylineBarriers+d(c[0])));this._showMessage(b);this.onDirectionsFinish(a)},_showMessage:function(a,b){var c="";this.messages.push({msg:a,error:!b});if(this.messages.length){for(var c=c+"\x3cul\x3e",
d=0;d<this.messages.length;d++)c+='\x3cli class\x3d"'+(this.messages[d].error?this._css.routesErrorClass:this._css.routesInfoClass)+'"\x3e'+this.messages[d].msg+"\x3c/li\x3e";c+="\x3c/ul\x3e"}this._msgNode&&(this._msgNode.innerHTML=c);if(!b)this.onError(a)},_isTimeUnits:function(a){return"milliseconds"===a||"esriNAUSeconds"===a||"esriNAUMinutes"===a||"esriNAUHours"===a||"esriNAUDays"===a},_getImpedanceAttribute:function(){return this._getCostAttribute(this.routeParams&&this.routeParams.travelMode&&
this.routeParams.travelMode.impedanceAttributeName||this.routeParams.impedanceAttribute||this.serviceDescription.impedance)},_getDirectionsTimeAttribute:function(){return this._getCostAttribute(this.routeParams&&this.routeParams.travelMode&&this.routeParams.travelMode.timeAttributeName||this.routeParams.directionsTimeAttribute||this.serviceDescription.directionsTimeAttribute)},_getTimeNeutralAttribute:function(){var a=(this._getDirectionsTimeAttribute()||{}).timeNeutralAttributeName;return this._getCostAttribute(a)},
_getCostAttribute:function(a){for(var b=this.serviceDescription&&this.serviceDescription.networkDataset.networkAttributes||[],c,d=0;d<b.length;d++)if(b[d].name===a&&"esriNAUTCost"===b[d].usageType){c=b[d];break}return c},_convertCostValue:function(a,b,c){var d=this._isTimeUnits(b),e=this._isTimeUnits(c);b=d?this._toMinutes(a,b):this._toMeters(a,b);return d===e?e?this._fromMinutes(b,c):this._fromMeters(b,c):a},_toMinutes:function(a,b,c){a=a||0;switch(b){case "milliseconds":a/=Math.pow(6E4,c?-1:1);
break;case "esriNAUSeconds":a/=Math.pow(60,c?-1:1);break;case "esriNAUHours":a*=Math.pow(60,c?-1:1);break;case "esriNAUDays":a*=Math.pow(1440,c?-1:1)}return a},_fromMinutes:function(a,b){return this._toMinutes(a,b,!0)},_toMeters:function(a,b,c){a=a||0;switch((b||"").replace("esriNAU","esri")){case "esriInches":a*=Math.pow(.0254,c?-1:1);break;case "esriFeet":a*=Math.pow(.3048,c?-1:1);break;case "esriYards":a*=Math.pow(.9144,c?-1:1);break;case "esriMiles":a*=Math.pow(1609.344,c?-1:1);break;case "esriNauticalMiles":a*=
Math.pow(1851.995396854,c?-1:1);break;case "esriMillimeters":a/=Math.pow(1E3,c?-1:1);break;case "esriCentimeters":a/=Math.pow(100,c?-1:1);break;case "esriKilometers":a*=Math.pow(1E3,c?-1:1);break;case "esriDecimeters":a/=Math.pow(10,c?-1:1)}return a},_fromMeters:function(a,b){return this._toMeters(a,b,!0)},_createRouteTask:function(){var a=new I;this.set("routeTask",new wa(this.get("routeTaskUrl")));this._createRouteParams();this.routeTask.getServiceDescription(this.travelModesServiceUrl,this.doNotFetchTravelModesFromOwningSystem).then(d.hitch(this,
function(b){b.networkDataset?(this.set("serviceDescription",b),this.set("maxStops",parseInt(this.userOptions.maxStops||b.serviceLimits&&b.serviceLimits.Route_MaxStops||this.defaults.maxStops)),this.defaults.portalUrl?(this.owningSystemUrl=this.defaults.portalUrl,a.resolve()):this.routeTask.getOwningSystemUrl().then(d.hitch(this,function(b){this.owningSystemUrl=b;a.resolve()}),a.reject)):(this._showMessage(C.widgets.directions.error.cantFindRouteServiceDescription),a.reject(Error(C.widgets.directions.error.cantFindRouteServiceDescription)))}),
d.hitch(this,function(){this._showMessage(C.widgets.directions.error.cantFindRouteServiceDescription);a.reject(Error(C.widgets.directions.error.cantFindRouteServiceDescription));this.mapClickActive=!1;this._activate()}));return a.promise},_createSearchSourceDDL:function(){if(this._globalGeocoder&&this._globalGeocoder.sources&&1<this._globalGeocoder.sources.length){var a=d.hitch(this,function(a){this._searchSourceSelector.domNode.blur();this._globalGeocoder.set("activeSourceIndex",a);for(var b=0;b<
this.geocoders.length;b++)this.geocoders[b].set("activeSourceIndex",a)});if(!this._searchSourceSelector){for(var b=[{value:"all",label:C.widgets.Search.main.all,selected:!0}],e=0;e<this._globalGeocoder.sources.length;e++)b.push({value:String(e),label:this._globalGeocoder.sources[e].name});this._searchSourceSelector=new c({className:"esriSearchSourcesDDL",style:"width:100%;",options:b},this._searchSourceSelectorContainer);this._searchSourceSelector.startup();this._searchSourceSelector.on("change",
a);this._searchSourceSelector.domNode.style.width=""}a("all")}else 2>this._globalGeocoder.sources.length&&(this._searchSourceContainerNode.style.display="none")},_createTravelModesDDL:function(){this._travelModeSelector||(this._travelModeSelector=new c({className:"esriTravelModesDDL",style:"width:100%;"},this._travelModeSelectorContainer),this._travelModeSelector.startup(),this._travelModeSelector._interractive=!0,this._travelModeSelector.on("change",d.hitch(this,function(a){this._travelModeSelector._interractive?
this._enqueue(function(){return this._setTravelMode(a).always(d.hitch(this,function(){this._travelModeSelector._interractive=!0}))}):this._travelModeSelector._interractive=!0})))},_setupTravelModes:function(){var a=this.get("serviceDescription"),c=a.supportedTravelModes,d=new I;if(c&&c.length&&this._travelModeSelector){for(var e=c[0].name,f=[],g=0;g<c.length;g++){for(var h="AUTOMOBILE"===c[g].type?"Driving":"TRUCK"===c[g].type?"Trucking":"WALK"===c[g].type?"Walking":"Other",k="",l=a.networkDataset.networkAttributes,
m=0;m<l.length;m++){var n=l[m];if(n.name===c[g].impedanceAttributeName){if("esriNAUCentimeters"===n.units||"esriNAUDecimalDegrees"===n.units||"esriNAUDecimeters"===n.units||"esriNAUFeet"===n.units||"esriNAUInches"===n.units||"esriNAUKilometers"===n.units||"esriNAUMeters"===n.units||"esriNAUMiles"===n.units||"esriNAUMillimeters"===n.units||"esriNAUNauticalMiles"===n.units||"esriNAUYards"===n.units)k="Distance";else if("esriNAUDays"===n.units||"esriNAUHours"===n.units||"esriNAUMinutes"===n.units||"esriNAUSeconds"===
n.units)k="Time";break}}f.push({id:c[g].name,label:'\x3cdiv class\x3d"esriTravelModesDirectionsIcon esriTravelModesType'+h+k+'"\x3e\x26nbsp;\x3c/div\x3e\x3cdiv class\x3d"esriTravelModesTypeName" title\x3d"'+c[g].description+'"\x3e'+c[g].name+"\x3c/div\x3e"});!a.defaultTravelMode||c[g].id!==a.defaultTravelMode&&c[g].itemId!==a.defaultTravelMode||(e=c[g].name)}this._showTravelModesOption();this._travelModeSelector.setStore(new b({objectStore:new x({data:f})}));this._travelModeSelector._interractive=
!1;this._travelModeSelector.setValue(e);this._setTravelMode(e).always(d.resolve)}else this._checkStartTimeUIAvailability(),this.set("showTravelModesOption",!1),d.resolve();return d.promise},_createPrintTask:function(){this._printService=(this.printTaskUrl=this._usingAGOL()?this.printTaskUrl:this.defaults.printTaskUrl)?new qa(this.printTaskUrl,{async:!1}):null;var a=new ra;a.exportOptions={width:670,height:750,dpi:96};a.format="PNG32";a.layout="MAP_ONLY";a.preserveScale=!1;a.showAttribution=!1;var b=
new za;b.map=this.map;b.outSpatialReference=this.map.spatialReference;b.template=a;this._printParams=b},_createGeometryTask:function(){this._geometryService=null;this._usingAGOL()?this._geometryService=new pa(this.geometryTaskUrl):this.geometryTaskUrl=(this._geometryService=this.defaults.geometryTaskUrl?new pa(this.defaults.geometryTaskUrl):Ba.defaults.geometryService)?this._geometryService.url:null},_showTravelModesOption:function(){var a=this.get("serviceDescription");B.set(this._travelModeContainerNode,
"display",this.showTravelModesOption&&a&&a.supportedTravelModes&&a.supportedTravelModes.length&&!this.doNotFetchTravelModesFromOwningSystem?"block":"none")},_showMilesKilometersOption:function(){B.set(this._agolDistanceUnitsNode,"display",this.showMilesKilometersOption?"block":"none")},_showClearButton:function(){B.set(this._clearDirectionsButtonNode,"display",this.showClearButton?"inline-block":"none")},_showActivateButton:function(){B.set(this._activateButtonNode,"display",this.showActivateButton?
"inline-block":"none");this.showActivateButton||this.deactivate()},_showBarriersButton:function(){B.set(this._lineBarrierButtonNode,"display",this.showBarriersButton?"inline-block":"none");this.showBarriersButton||this.deactivateBarrierTool()},_createRouteParams:function(){var a={returnDirections:!0,returnRoutes:!1,outputLines:"esriNAOutputLineTrueShape",preserveFirstStop:!0,preserveLastStop:!0,directionsOutputType:"complete",stops:new ta,ignoreInvalidLocations:!0,doNotLocateOnRestrictedElements:!0,
outSpatialReference:this.get("map").spatialReference};this.get("routeParams")||(this.routeParams={});var b=new xa;this.routeParams=d.mixin(b,{outputGeometryPrecision:0,outputGeometryPrecisionUnits:"esriMeters",restrictUTurns:"esriNFSBAtDeadEndsOnly"},this.get("routeParams"),a)},_markWPsForRemovalAfterUserChangedStopSequence:function(a,b){for(var c=a-1,d=[];0<=c&&this._isStopAWaypoint(this.stops[c]);)d.push(this.stops[c]),c--;for(c=a+1;c<this.stops.length&&this._isStopAWaypoint(this.stops[c]);)d.push(this.stops[c]),
c++;if(b>a)for(c=b+1;c<this.stops.length&&this._isStopAWaypoint(this.stops[c]);)d.push(this.stops[c]),c++;else if(void 0!==b)for(c=b-1;0<=c&&this._isStopAWaypoint(this.stops[c]);)d.push(this.stops[c]),c--;else if(this.returnToStart&&0===a)for(c=this.stops.length-1;0<=c&&this._isStopAWaypoint(this.stops[c]);)d.push(this.stops[c]),c--;return d},_removeSomeWaypoints:function(a){for(var b=new I,c=[],d=0;d<a.length;d++){var e=t.indexOf(this.stops,a[d]);-1<e&&c.push(this._removeStop(e,!0,!0))}K(c).always(b.resolve);
return b.promise},_modifyStopSequence:function(a,b){var c=this._dnd.getAllNodes(),e=new I,f,g=[];if(c.length)if(this._removeLocateButtonVisibilityEvents(),arguments.length&&void 0!==a)if(0<=a&&0<=b&&a<this.stops.length&&b<this.stops.length&&a!==b){var c=this._markWPsForRemovalAfterUserChangedStopSequence(a,b),h=this.stops.splice(a,1);this.stops.splice(b,0,h[0]);for(f=0;f<this.stops.length;f++)g.push(this._updateStop(this.stops[f],f));g.push(this._removeSomeWaypoints(c));K(g).always(d.hitch(this,function(){this._solveAndZoom().always(e.resolve)}))}else e.reject("Invalid From and To values.");
else{for(f=0;f<this.stops.length;)this._isStopAWaypoint(this.stops[f])?g.push(this._removeStop(f,!0,!0)):f++;K(g).always(d.hitch(this,function(){g=[];this.stops.reverse();for(f=0;f<this.stops.length;f++)g.push(this._updateStop(this.stops[f],f));K(g).always(d.hitch(this,function(){this._solveAndZoom().always(e.resolve)}))}))}else e.resolve();return e.promise},_setMenuNodeValues:function(a){"traffic"!==a&&this._clearDisplayBeforeSolve();a=this.get("optimalRoute");this._findOptimalOrderNode&&z.set(this._findOptimalOrderNode,
"checked",a);this._returnToStartNode&&(a=this.returnToStart&&!this.maxStopsReached&&this.stops[0]&&(!this.stops[0].feature||this._isStopLocated(this.stops[0])),z.set(this._returnToStartNode,"checked",a),this.set("returnToStart",a),this.maxStopsReached&&this.returnToStart&&this._showMessage(C.widgets.directions.error.maximumStops));if(!this.returnToStart&&!this._incrementalSolveStopRange&&this.directions)for(this._incrementalSolveStopRange={start:this.stops.length-1,end:this.stops.length},this._clearRouteGraphics(),
this._incrementalSolveStopRange=null,a=this.stops.length;0<a--&&this._isStopAWaypoint(this.stops[a]);)this._removeSomeWaypoints([this.stops[a]]);this._useTrafficNode&&(z.set(this._useTrafficNode,"checked",this.traffic),this.traffic?(this._updateMapTimeExtent(),this._addTrafficLayer()):(this._removeTrafficLayer(),this._restoreMapTimeExtent()));switch(this.get("directionsLengthUnits")){case Q.KILOMETERS:z.set(this._useKilometersNode,"checked",!0);z.set(this._useMilesNode,"checked",!1);break;case Q.MILES:z.set(this._useKilometersNode,
"checked",!1),z.set(this._useMilesNode,"checked",!0)}B.set(this._printButton,"display",this.showPrintPage?"inline-block":"none");B.set(this._saveMenuButton,"display",this.showSaveButton&&this.owningSystemUrl?"inline-block":"none");this._showMilesKilometersOption();this._showClearButton()},_optionsMenu:function(){this._useTrafficItemNode&&B.set(this._useTrafficItemNode,"display",this.get("showTrafficOption")?"block":"none");this._returnToStartItemNode&&B.set(this._returnToStartItemNode,"display",this.get("showReturnToStartOption")?
"block":"none");this._findOptimalOrderItemNode&&B.set(this._findOptimalOrderItemNode,"display",this.get("showOptimalRouteOption")&&3<this._getStopCount()?"block":"none");this.stops.length>=this.get("minStops")?A.add(this._widgetContainer,this._css.stopsOptionsOptionsEnabledClass):(A.remove(this._widgetContainer,this._css.stopsOptionsOptionsEnabledClass),this._optionsMenuNode&&"block"===B.get(this._optionsMenuNode,"display")&&this._toggleOptionsMenu())},_stopsRemovable:function(){2<this._dnd.getAllNodes().length-
this._getWaypointCount()?A.add(this._widgetContainer,this._css.stopsRemovableClass):A.remove(this._widgetContainer,this._css.stopsRemovableClass)},_checkMaxStops:function(){this.set("maxStopsReached",this._getStopCount()+this._getWaypointCount()+(this.returnToStart?1:0)>=this.maxStops);this._showAddDestination()},_updateThemeWatch:function(a,b,c){A.remove(this.domNode,b);A.add(this.domNode,c)},_toggleOptionsMenu:function(){"block"===B.get(this._optionsMenuNode,"display")?(B.set(this._optionsMenuNode,
"display","none"),A.remove(this._optionsButtonNode,"esriStopsOptionsOpen"),this._optionsButtonNode.innerHTML=C.widgets.directions.showOptions):(B.set(this._optionsMenuNode,"display","block"),A.add(this._optionsButtonNode,"esriStopsOptionsOpen"),this._optionsButtonNode.innerHTML=C.widgets.directions.hideOptions)},_toggleSaveMenu:function(a){"block"===B.get(this._saveMenuNode,"display")||!1===a?(B.set(this._saveMenuNode,"display","none"),A.remove(this._saveMenuButton,this._css.stopsPressedButtonClass)):
(this.clearMessages(),B.set(this._saveMenuNode,"display","block"),A.add(this._saveMenuButton,this._css.stopsPressedButtonClass),this._enableSharing().then(d.hitch(this,function(){this._outputLayer.setValue(this.routeLayer.title?this.routeLayer.title:this.directions&&this.directions.routeName);if(this.routeLayer.ownerFolder)for(var a=this._folderSelector.store.objectStore.data,b=0;b<a.length;b++)if(a[b].folderId===this.routeLayer.ownerFolder){this._folderSelector.getValue()!==a[b].id&&(this._folderSelector._interractive=
!1,this._folderSelector.setValue(a[b].id));break}this._enableButton(this._saveButton,this.routeLayer.isItemOwner||!this._userCanCreatePortalItem);this._outputLayer.set("disabled",!1)})))},_showToolbar:function(){A[this.stops.length<this.maxStops&&this.canModifyStops||this.canModifyWaypoints?"add":"remove"].call(J,this._widgetContainer,this._css.addStopsClass)},_showAddDestination:function(){this._showToolbar();this._addDestinationNode.style.display=this.stops.length<this.maxStops&&this.canModifyStops?
"inline":"none"},_showMapClickActiveButton:function(){this._showToolbar();this._activateButtonNode.style.display=this.canModifyStops||this.canModifyWaypoints?"inline-block":"none"},_getAbsoluteUrl:function(a){a=m.toUrl(a);return/^https?\:/i.test(a)?a:/^\/\//i.test(a)?ia+a:/^\//i.test(a)?ia+"//"+window.location.host+a:a},_getManeuverImage:function(a){return a?"esriDMTStop"===a||"esriDMTDepart"===a?"":this._getAbsoluteUrl("./images/Directions/maneuvers/"+a+".png"):""},_loadPrintDirections:function(a){var b=
this.get("printTemplate"),c=new I;this.directionsLengthUnits!==this.routeParams.directionsLengthUnits?this.getDirections().then(c.resolve,c.reject):c.resolve();c.then(d.hitch(this,function(){if(!b&&this.directions){var c=this._getAbsoluteUrl("./css/Directions.css"),d=this._getAbsoluteUrl("./css/DirectionsPrint.css"),e=this._getAbsoluteUrl("./images/Directions/print-logo.png"),f;f=F.isBodyLtr()?"ltr":"rtl";b="";b+="\x3c!DOCTYPE HTML\x3e";b+='\x3chtml lang\x3d"en" class\x3d"'+this.get("theme")+'" dir\x3d"'+
f+'"\x3e';b+="\x3chead\x3e";b+='\x3cmeta charset\x3d"utf-8"\x3e';b+='\x3cmeta http-equiv\x3d"X-UA-Compatible" content\x3d"IE\x3dEdge,chrome\x3d1"\x3e';b+="\x3ctitle\x3e"+this.get("directions").routeName+"\x3c/title\x3e";b+='\x3clink rel\x3d"stylesheet" media\x3d"screen" type\x3d"text/css" href\x3d"'+c+'" /\x3e';b+='\x3clink rel\x3d"stylesheet" media\x3d"print" type\x3d"text/css" href\x3d"'+d+'" /\x3e';b+="\x3c/head\x3e";b+='\x3cbody class\x3d"'+this._css.esriPrintPageClass+'"\x3e';b+='\x3cdiv class\x3d"'+
this._css.esriPrintBarClass+'"\x3e';b+='\x3cdiv class\x3d"'+this._css.esriCloseButtonClass+'" title\x3d"'+C.common.close+'" onclick\x3d"window.close();"\x3e'+C.common.close+"\x3c/div\x3e";b+='\x3cdiv id\x3d"printButton" class\x3d"'+this._css.esriPrintButtonClass+'" title\x3d"'+C.widgets.directions.print+'" onclick\x3d"window.print();"\x3e'+C.widgets.directions.print+"\x3c/div\x3e";b+="\x3c/div\x3e";b+='\x3cdiv class\x3d"'+this._css.esriPrintMainClass+'"\x3e';b+='\x3cdiv class\x3d"'+this._css.esriPrintHeaderClass+
'"\x3e';b+='\x3cimg class\x3d"'+this._css.esriPrintLogoClass+'" src\x3d"'+e+'" /\x3e';b+='\x3cdiv class\x3d"'+this._css.esriPrintNameClass+'"\x3e'+this.get("directions").routeName+"\x3c/div\x3e";b+=this._renderDirectionsSummary(this.directions);a&&(b+='\x3cdiv id\x3d"divMap" class\x3d"esriPrintMap esriPrintWait"\x3e\x3c/div\x3e',b+='\x3chr class\x3d"esriNoPrint"/\x3e');b+='\x3cdiv id\x3d"print_helper"\x3e\x3c/div\x3e';b+='\x3ctextarea onkeyup\x3d"document.getElementById(\'print_helper\').innerHTML\x3dthis.value;" id\x3d"print_area" class\x3d"'+
this._css.esriPrintNotesClass+'" placeholder\x3d"'+C.widgets.directions.printNotes+'"\x3e\x3c/textarea\x3e';b+='\x3cdiv class\x3d"'+this._css.clearClass+'"\x3e\x3c/div\x3e';b+="\x3c/div\x3e";b+='\x3cdiv class\x3d"'+this._css.esriPrintDirectionsClass+'"\x3e';b+=this._renderDirectionsTable(this.directions);b+="\x3c/div\x3e";b+='\x3cdiv class\x3d"'+this._css.esriPrintFooterClass+'"\x3e';b+="\x3cp\x3e"+C.widgets.directions.printDisclaimer+"\x3c/p\x3e";b+="\x3c/div\x3e";b+="\x3c/div\x3e";b+="\x3c/body\x3e";
b+="\x3c/html\x3e"}this._printWindow.document.open("text/html","replace");this._printWindow.document.write(b);this._printWindow.document.close()}))},_printDirections:function(){if(this.directions){var a=screen.width/2,b=screen.height/1.5,a="toolbar\x3dno, location\x3dno, directories\x3dno, status\x3dyes, menubar\x3dno, scrollbars\x3dyes, resizable\x3dyes, width\x3d"+a+", height\x3d"+b+", top\x3d"+(screen.height/2-b/2)+", left\x3d"+(screen.width/2-a/2);this.get("printPage")?(window.directions=this.get("directions"),
window.open(this.get("printPage"),"directions_widget_print",a,!0)):(this._printWindow=window.open("","directions_widget_print",a,!0),this._loadPrintDirections(!!this._printService),this._printService&&m(["dojo/_base/window"],d.hitch(this,function(a){this.zoomToFullRoute().then(d.hitch(this,function(){this._printService.execute(this._printParams,d.hitch(this,function(b){a.withDoc(this._printWindow.document,function(){var a=y.byId("divMap");a&&(A.remove(a,"esriPrintWait"),A.add(a,"esriPageBreak"),J.create("img",
{src:b.url,"class":"esriPrintMapImg"},a))})}),d.hitch(this,function(b){a.withDoc(this._printWindow.document,function(){var a=y.byId("divMap");a&&A.remove(a,"esriPrintWait")});console.error("Error while calling print service:\n "+b)}))}))})))}},_enableButton:function(a,b){var c=b||void 0===b;A[c?"remove":"add"].apply(this,[a,"esriDisabledDirectionsButton"]);a._enabled=c},_clearStopsStatusAttr:function(){for(var a=0;a<this.stops.length;a++)this.stops[a].feature&&this.stops[a].feature.attributes&&(this.stops[a].feature.attributes.Status=
void 0)},_enableSharing:function(){var a=new I;!this._naRouteSharing&&this.owningSystemUrl?m(["../tasks/NARouteSharing"],d.hitch(this,function(e){this._naRouteSharing=new e(this.owningSystemUrl,this.map.spatialReference);this._folderSelector||(this._folderSelector=new c({className:"esriFoldersDDL",style:"width: 100%;",sortByLabel:!1,disabled:!0,_interractive:!0,onChange:d.hitch(this,function(){this._folderSelector._interractive?this._enableButton(this._saveButton,!this.routeLayer.itemId):this._folderSelector._interractive=
!0})},this._folderSelectorContainer),this._folderSelector.startup(),this._outputLayer=new h({style:"width: 100%",required:!0,trim:!0,regExp:'[^\x26|\x3c|\x3e|%|#|?|\\|"|/|+]+',maxLength:98,disabled:!0,onKeyPress:d.hitch(this,function(){this._enableButton(this._saveButton,!this.routeLayer.itemId||!this._userCanCreatePortalItem)}),onFocus:d.hitch(this,function(){this.map&&this.map.disableKeyboardNavigation()}),onBlur:d.hitch(this,function(){this.map&&this.map.enableKeyboardNavigation()})},this._outputLayerContainer),
this._outputLayer.startup());this._naRouteSharing.getFolders().then(d.hitch(this,function(c){for(var e=[],f=0;f<c.length;f++)e.push({id:c[f].url,folderId:c[f].id,label:c[f].title});this._folderSelector.setStore(new b({objectStore:new x({data:e})}));this._naRouteSharing.canCreateItem().then(d.hitch(this,function(a){this._folderSelector.set("disabled",!a);this._userCanCreatePortalItem=a}));this._enableButton(this._saveButton);a.resolve()}),d.hitch(this,function(b){console.log(b);this._naRouteSharing=
null;this._toggleSaveMenu(!1);a.reject(b)}))})):this.owningSystemUrl?a.resolve():(a.reject(Error("Owning system is not defined, or the Directions widget is not done initializing.")),this._naRouteSharing=null);return a.promise},_storeRouteUI:function(){var a=new I;this._outputLayer&&this._outputLayer.isValid()?this._storeRoute(this._outputLayer.getValue(),this._folderSelector.getValue(),this._folderSelector.store.objectStore.get(this._folderSelector.getValue()).folderId).then(a.resolve,a.reject):(this._outputLayer&&
this._outputLayer.focus(),a.reject(Error("Need result layer name specified.")));return a.promise},_storeRoute:function(a,b,c){var e=new I,f=this.directions;if(this._savingRoute||!this._naRouteSharing)return this._saveButton.blur(),e.reject(Error("Not ready to store route.")),e.promise;this.clearMessages();e.then(null,d.hitch(this,function(a){console.log("ERR",a);this._showMessage(C.widgets.directions.error.cantSaveRoute)}));e.promise.always(d.hitch(this,function(){this._enableButton(this._saveButton);
B.set(this._saveAsButton,"display",this.routeLayer.itemId&&this._userCanCreatePortalItem?"inline-block":"none");this._showLoadingSpinner();this._savingRoute=!1}));if(f&&f.features&&f.features.length&&this.stops&&this.stops.length)if(this.owningSystemUrl)if(this.routeParams&&this.routeParams.travelMode)if(a&&b){var g,h;g=d.hitch(this,function(a){return this._naRouteSharing.getAttributeUnits(a,this.serviceDescription)});h=this.routeParams.travelMode.timeAttributeName;var k=this.routeParams.travelMode.distanceAttributeName,
l=g(h),m=g(k),n=this.routeParams.directionsLengthUnits||this.serviceDescription.directionsLengthUnits,q=this._naRouteSharing.toMeters,r=this._naRouteSharing.toMinutes,u=function(a,b,c){var d,e;for(e in a)a.hasOwnProperty(e)&&0===e.indexOf(b)&&-1===t.indexOf(c,e.substr(b.length))&&(d=d||{},d[e.substr(b.length)]=a[e]);return d},v=[],w=[],x=[],y;if(h&&l&&k&&m){var z=[],A=this.routeParams.accumulateAttributes||this.serviceDescription.accumulateAttributeNames||[],E=this.serviceDescription.networkDataset.networkAttributes;
for(g=0;g<E.length;g++)"esriNAUTCost"===E[g].usageType&&-1===t.indexOf(A,E[g].name)&&E[g].name!==h&&E[g].name!==k&&z.push(E[g].name);var A=this.get("stops"),F={xmin:Infinity,ymin:Infinity,xmax:-Infinity,ymax:-Infinity};for(g=0;g<A.length;g++)if(A[g].feature&&A[g].feature.toJson){E=A[g].feature.toJson();y=E.attributes;var D=E.geometry,G=this._naRouteSharing.getUTCOffset(y.ArriveTime,y.ArriveTimeUTC),H=this._naRouteSharing.getUTCOffset(y.DepartTime,y.DepartTimeUTC);d.mixin(F,{xmin:F.xmin>D.x?D.x:F.xmin,
ymin:F.ymin>D.y?D.y:F.ymin,xmax:F.xmax<D.x?D.x:F.xmax,ymax:F.ymax<D.y?D.y:F.ymax});E.attributes={__OBJECTID:g+1,CurbApproach:y.CurbApproach,ArrivalCurbApproach:y.ArriveCurbApproach,DepartureCurbApproach:y.DepartCurbApproach,Name:y.Name===this._waypointName?C.widgets.directions.waypoint:y.Name===this._userDefinedStopName?A[g].name:y.Name,RouteName:f.routeName,Sequence:y.Sequence,Status:y.Status,LocationType:y.isWaypoint?1:0,TimeWindowStart:y.TimeWindowStart,TimeWindowEnd:y.TimeWindowEnd,TimeWindowStartUTCOffset:G,
TimeWindowEndUTCOffset:G,ServiceMinutes:r(y["Attr_"+h],l),ServiceMeters:q(y["Attr_"+k],m),ServiceCosts:P.stringify(u(y,"Attr_",z)),CumulativeMinutes:r(y["Cumul_"+h],l),CumulativeMeters:q(y["Cumul_"+k],m),CumulativeCosts:P.stringify(u(y,"Cumul_",z)),LateMinutes:r(y["Violation_"+h],l),WaitMinutes:r(y["Wait_"+h],l),ArrivalTime:this._naRouteSharing.toUTCTime(y.ArriveTime,G),DepartureTime:this._naRouteSharing.toUTCTime(y.DepartTime,H),ArrivalUTCOffset:G,DepartureUTCOffset:H};v.push(E)}k=0;m=function(a){try{a.strings=
P.parse(a.strings)}catch(ab){L.strings=void 0}if(a.strings&&a.strings.length)for(var b=0;b<a.strings.length;b++)if("esriDSTGeneral"===a.strings[b].stringType)return a.strings[b].string};A=function(a,b){for(var c=[],d=0;d<(a||[]).length;d++)a[d].stringType!==b&&b||c.push(a[d].string);return c.length?c.toString():void 0};E=function(a){switch(a){case "esriDMTStop":return"esriDPTManeuverArrive";case "esriDMTDepart":return"esriDPTManeuverDepart";case "esriDMTDoorPassage":return"esriDPTManeuverDoor";case "esriDMTBearLeft":return"esriDPTManeuverBearLeft";
case "esriDMTBearRight":return"esriDPTManeuverBearRight";case "esriDMTElevator":return"esriDPTManeuverElevator";case "esriDMTEscalator":return"esriDPTManeuverEscalator";case "esriDMTFerry":return"esriDPTManeuverFerryOn";case "esriDMTEndOfFerry":return"esriDPTManeuverFerryOff";case "esriDMTForkCenter":return"esriDPTManeuverForkCenter";case "esriDMTForkLeft":return"esriDPTManeuverForkLeft";case "esriDMTForkRight":return"esriDPTManeuverForkRight";case "esriDMTPedestrianRamp":return"esriDPTManeuverPedestrianRamp";
case "esriDMTRampLeft":return"esriDPTManeuverRampLeft";case "esriDMTRampRight":return"esriDPTManeuverRampRight";case "esriDMTRoundabout":return"esriDPTManeuverRoundabout";case "esriDMTTurnLeft":return"esriDPTManeuverTurnLeft";case "esriDMTLeftLeft":return"esriDPTManeuverTurnLeftLeft";case "esriDMTLeftRight":return"esriDPTManeuverTurnLeftRight";case "esriDMTTurnRight":return"esriDPTManeuverTurnRight";case "esriDMTRightLeft":return"esriDPTManeuverTurnRightLeft";case "esriDMTRightRight":return"esriDPTManeuverTurnRightRight";
case "esriDMTSharpLeft":return"esriDPTManeuverSharpLeft";case "esriDMTSharpRight":return"esriDPTManeuverSharpRight";case "esriDMTStraight":return"esriDPTManeuverStraight";case "esriDMTStrairs":return"esriDPTManeuverStairs";case "esriDMTUTurn":return"esriDPTManeuverUTurn"}return"esriDPTUnknown"};for(g=0;g<f.featuresWithWaypoints.length;g++){var J=f.featuresWithWaypoints[g],D=J.toJson(),G=D.attributes,H=D.geometry&&D.geometry.paths&&D.geometry.paths[0]||[],K=D.geometry.hasM||!1||H[0]&&3===H[0].length;
y=this._naRouteSharing.getUTCOffset(G.ETA,G.arriveTimeUTC);D.attributes={__OBJECTID:g+1,Sequence:++k,StopID:function(){var a=void 0,b=J._associatedStopWithReturnToStart&&J._associatedStopWithReturnToStart.attributes.Sequence;if(b)for(var c=0;c<v.length;c++)if(v[c].attributes.Sequence===b){a=v[c].attributes.__OBJECTID;break}return a}(),DirectionPointType:E(G.maneuverType),DisplayText:J._associatedStopWithReturnToStart&&J._associatedStopWithReturnToStart.attributes.isWaypoint?G.text.replace(this._waypointName,
C.widgets.directions.waypoint):G.text,ArrivalTime:this._naRouteSharing.toUTCTime(G.ETA,y),ArrivalUTCOffset:y,Azimuth:void 0,Name:A(f.stringsWithWaypoints[g],"esriDSTStreetName"),AlternateName:A(f.stringsWithWaypoints[g],"esriDSTAltName"),ExitName:A(f.stringsWithWaypoints[g],"esriDSTExit"),IntersectingName:A(f.stringsWithWaypoints[g],"esriDSTCrossStreet"),BranchName:A(f.stringsWithWaypoints[g],"esriDSTBranch"),TowardName:A(f.stringsWithWaypoints[g],"esriDSTToward"),ShortVoiceInstruction:void 0,VoiceInstruction:void 0,
Level:void 0};delete D.symbol;delete D.infoTemplate;H.length?(D.geometry={x:H[0][0],y:H[0][1],spatialReference:D.geometry.spatialReference},K&&d.mixin(D.geometry,{m:H[0][2]})):delete D.geometry;w.push(D);D=J.toJson();G=D.attributes;H=D.geometry&&D.geometry.paths&&D.geometry.paths[0]||[];y=!0;for(h=0;h<H.length-1;h++)if(H[h][0]!==H[h+1][0]||H[h][1]!==H[h+1][1]){y=!1;break}y||(D.attributes={DirectionPointID:g+1,DirectionLineType:"esriDLTSegment",Meters:q(G.length,n),Minutes:r(G.time,l),FromLevel:void 0,
ToLevel:void 0},D.geometry.hasM=K,delete D.symbol,delete D.infoTemplate,x.push(D));var L=f.eventsWithWaypoints[D.attributes.Sequence]||[];for(h=0;h<L.length;h++)D=L[h].toJson(),G=D.attributes,y=this._naRouteSharing.getUTCOffset(G.ETA,G.arriveTimeUTC),D.attributes={Sequence:++k,DirectionPointType:"esriDPTEvent",DisplayText:m(G),ArrivalTime:this._naRouteSharing.toUTCTime(G.ETA,y),ArrivalUTCOffset:y,Name:G.strings},w.push(D)}h=this.routeParams.barriers&&this.routeParams.barriers.features||[];var M=[];
for(g=0;g<h.length;g++)k=h[g].toJson(),m=k.attributes,k.attributes={BarrierType:m.BarrierType||0,FullEdge:m.FullEdge||!1,AddedCost:m["Attr_"+this._getImpedanceAttribute().name]||0,Costs:P.stringify(u(m,"Attr_",z)),CurbApproach:m.CurbApproach||0,Name:m.Name},M.push(k);h=this.routeParams.polylineBarriers&&this.routeParams.polylineBarriers.features||[];var N=[];for(g=0;g<h.length;g++)k=h[g].toJson(),m=k.attributes,k.attributes={BarrierType:m.BarrierType||0,ScaleFactor:m["Attr_"+this._getImpedanceAttribute().name]||
1,Costs:P.stringify(u(m,"Attr_",z)),Name:m.Name},N.push(k);h=this.routeParams.polygonBarriers&&this.routeParams.polygonBarriers.features||[];var O=[];for(g=0;g<h.length;g++)k=h[g].toJson(),m=k.attributes,k.attributes={BarrierType:m.BarrierType||0,ScaleFactor:m["Attr_"+this._getImpedanceAttribute().name]||1,Costs:P.stringify(u(m,"Attr_",z)),Name:m.Name},O.push(k);var Q={geometry:f.mergedGeometry,attributes:{RouteName:f.routeName,TotalMinutes:r(f.totalTime,l),TotalMeters:q(f.totalLength,n),TotalLateMinutes:function(){for(var a=
0,b=0;b<v.length;b++)a+=v[b].attributes.LateMinutes||0;return a}(),TotalWaitMinutes:function(){for(var a=0,b=0;b<v.length;b++)a+=v[b].attributes.WaitMinutes||0;return a}(),TotalCosts:v[v.length-1].attributes.CumulativeCosts,StartTime:"none"!==this.startTime?v[0].attributes.ArrivalTime:null,EndTime:"none"!==this.startTime?v[v.length-1].attributes.DepartureTime:null,StartUTCOffset:v[0].attributes.ArrivalUTCOffset,EndUTCOffset:v[v.length-1].attributes.DepartureUTCOffset,Messages:P.stringify(this._solverMessages),
AnalysisSettings:P.stringify({travelMode:d.hitch(this,function(){var a=d.clone(this.routeParams.travelMode);"\x26lt;"===a.name.substr(0,4)&&"\x26gt;"===a.name.substr(a.name.length-4,4)&&(a.name=a.name.substr(4,a.name.length-8));return a})(),directionsLanguage:this.routeParams.directionsLanguage||this.serviceDescription.directionsLanguage,startTimeIsUTC:this.routeParams.startTimeIsUTC,timeWindowsAreUTC:this.routeParams.timeWindowsAreUTC,findBestSequence:this.routeParams.findBestSequence,preserveFirstStop:this.routeParams.preserveFirstStop,
preserveLastStop:this.routeParams.preserveLastStop,accumulateAttributeNames:this.routeParams.accumulateAttributes||this.serviceDescription.accumulateAttributeNames})}};this._enableButton(this._saveButton,!1);this._savingRoute=!0;this._showLoadingSpinner(!0);d.hitch(this,function(){var a=new I;this._printService?this.zoomToFullRoute().then(d.hitch(this,function(){var b=this._printParams.template,c=b.exportOptions;b.exportOptions={width:200,height:133,dpi:96};this._printService.execute(this._printParams,
function(d){b.exportOptions=c;a.resolve(d.url)},function(d){b.exportOptions=c;console.error("Error while calling print service:\n "+d);a.resolve()})})):a.resolve();return a.promise})().then(d.hitch(this,function(g){var h={folder:b,name:a,stops:v,directionPoints:w,directionLines:x,barriers:M,polylineBarriers:N,polygonBarriers:O,extent:d.mixin(d.clone(f.extent),{xmin:F.xmin>f.extent.xmin?f.extent.xmin:F.xmin,ymin:F.ymin>f.extent.ymin?f.extent.ymin:F.ymin,xmax:F.xmax<f.extent.xmax?f.extent.xmax:F.xmax,
ymax:F.ymax<f.extent.ymax?f.extent.ymax:F.ymax}),routeInfo:Q,thumbnail:g};this._userCanCreatePortalItem?this._naRouteSharing.store(h,this.routeLayer.itemId,"1.0.0").then(d.hitch(this,function(a){if(a.success){var b=this._naRouteSharing.portal,b="//"+(b.isPortal?b.portalHostname:b.urlKey+"."+b.customBaseUrl);this._toggleSaveMenu();this._showMessage(C.widgets.directions.routeIsSaved+"\x3cbr/\x3e\x3ca class\x3d'esriLinkButton' target\x3d'_blank' href\x3d'"+b+"/home/item.html?id\x3d"+a.id+"'\x3e"+C.widgets.directions.share+
"\x3c/a\x3e",!0);if(this.routeLayer.itemId)this.onRouteItemUpdated(a.id);else this.onRouteItemCreated(a.id);d.mixin(this.routeLayer,{itemId:a.id,title:h.name,isItemOwner:!0,ownerFolder:c});e.resolve(a)}else e.reject(a)}),e.reject):this._naRouteSharing.createFeatureCollection(h,"1.0.0").then(d.hitch(this,function(a){e.resolve(a);this._toggleSaveMenu();this.onFeatureCollectionCreated(a)}),e.reject)}))}else e.reject(Error("Cannot deduce the impedance used."))}else e.reject(Error("Missing required parameter: layerName, folder must be specified."));
else e.reject(Error("Shared route must be built using a Travel Mode."));else e.reject(Error("Cannot store route: owning system to store routes is not defined. Please specify Portal or ArcGIS Online Url in constructor."));else e.reject(Error("No route to share. Build a route first."));return e.promise},_loadRoute:function(a){var c=new I;c.promise.always(d.hitch(this,function(){this._showLoadingSpinner(!1);B.set(this._saveAsButton,"display",this.routeLayer.itemId&&this._userCanCreatePortalItem?"inline-block":
"none");this._enableButton(this._saveButton,this.routeLayer.isItemOwner)}));this._reset().then(d.hitch(this,function(){this._showLoadingSpinner(!0);this._enableSharing().then(d.hitch(this,function(){var e=d.clone(this.serviceDescription),f=d.hitch(this,function(b){d.mixin(this.routeLayer,{itemId:a,title:b.title,isItemOwner:b.isItemOwner,ownerFolder:b.ownerFolder})}),g,h,k,l;e.directionsLengthUnits=this.directionsLengthUnits;this._naRouteSharing.load(a,e).then(d.hitch(this,function(a){if(a.routeParameters){d.mixin(this.routeParams,
a.routeParameters);this.routeParams.accumulateAttributes=a.routeParameters.accumulateAttributeNames;this.set("optimalRoute",this.routeParams.findBestSequence);this.startTime=this.routeParams.startTime?this.routeParams.startTime:"none";this._setStartTime(void 0,void 0,this.startTime);var m=a.routeParameters.travelMode,n=m?this._getCostAttribute(m.impedanceAttributeName):void 0,n=n?this._isTimeUnits(n.units)?"Time":"Distance":"";l=e.supportedTravelModes&&e.supportedTravelModes.length?this._travelModeSelector.store.objectStore.data.slice():
[];if(canUseRouteLayerTM=1!==a.successCode&&n){var q="AUTOMOBILE"===m.type?"Driving":"TRUCK"===m.type?"Trucking":"WALK"===m.type?"Walking":"Other";m.name="\x26lt;"+m.name+"\x26gt;";this.serviceDescription.supportedTravelModes=(e.supportedTravelModes||[]).concat(m);l.push({id:m.name,label:'\x3cdiv class\x3d"esriTravelModesDirectionsIcon esriTravelModesType'+q+n+'"\x3e\x26nbsp;\x3c/div\x3e\x3cdiv class\x3d"esriTravelModesTypeName"\x3e'+m.name+"\x3c/div\x3e"});this._travelModeSelector.setStore(new b({objectStore:new x({data:l})}));
this._travelModeSelector._interractive=!1;this._travelModeSelector.setValue(m.name)}else{n=!1;if(m&&m.name)for(l=e.supportedTravelModes||[],g=0;g<l.length;g++)if(l[g].name===m.name){n=!0;this._travelModeSelector._interractive=!1;this._travelModeSelector.setValue(m.name);this.routeParams.travelMode=l[g].impedanceAttributeName?l[g]:l[g].itemId;a.loadMessages.push({message:C.widgets.directions.error.tmFromPortalSameName+" "+m.name,messageType:"Warning"});break}if(!n)if((m=e.defaultTravelMode)&&l)for(g=
0;g<l.length;g++){if(l[g].id===m){this.routeParams.travelMode=l[g].impedanceAttributeName?l[g]:l[g].itemId;a.loadMessages.push({message:C.widgets.directions.error.tmFromPortalDefault+" "+(l[g].name?l[g].name:l[g].itemId),messageType:"Warning"});break}}else this.routeParams.travelMode=null}this._checkStartTimeUIAvailability()}if(a.solveResult&&a.solveResult.routeResults){var r,t=Infinity,u,v=-Infinity,m=a.solveResult.routeResults[0].stops,w=a.solveResult.routeResults[0].directions.features,n={};for(g=
0;g<m.length;g++){var y=m[g].attributes;if(y.isWaypoint)for(h=0;h<w.length;h++)q=w[h].attributes,q._stopSequence===y.Sequence&&(q.text=q.text.replace(y.Name,this._waypointName));k=y.Name+"_"+this._stopSequence++;n[k]=y.isWaypoint?this._waypointName:y.Name;y.Name=k;y.Sequence<t&&(null!==y.ArriveCurbApproach||null!==y.DepartCurbApproach)&&(r=y.Name,t=y.Sequence);y.Sequence>v&&(null!==y.ArriveCurbApproach||null!==y.DepartCurbApproach)&&(u=y.Name,v=y.Sequence)}k=r+" - "+u;a.solveResult.routeResults[0].routeName=
k;a.solveResult.routeResults[0].directions.routeName=k;for(g=0;g<w.length;g++)if(q=w[g].attributes,void 0!==q._stopSequence)for(h=0;h<m.length;h++)if(q._stopSequence===m[h].attributes.Sequence){k=m[h].attributes.Name;q.text=(q.text||"").replace(n[k],k);delete q._stopSequence;break}r=m[m.length-1];m[0].geometry.x===r.geometry.x&&m[0].geometry.y===r.geometry.y&&(this._returnToStartStop=this._addStopWrapperToGraphic(new H(r.geometry,null,r.attributes),n[r.attributes.Name]),this.set("returnToStart",!0));
this._solveResultProcessing(a.solveResult,n).then(d.hitch(this,function(){this._setStartTime(void 0,void 0,this.startTime);f(a);this.zoomToFullRoute();c.resolve(a)}),c.reject)}else{if(a.routeParameters){r=a.routeParameters.stops.features;this.stops=[];for(g=0;g<r.length;g++)this.stops.push(this._addStopWrapperToGraphic(r[g],r[g].attributes.Name)),this._updateStop(this.stops[g],g);this._setStops();a.loadMessages.push({message:C.widgets.directions.routeLayerStopsOnly,messageType:"Warning"})}else a.loadMessages.push({message:C.widgets.directions.routeLayerEmpty,
messageType:"Warning"});f(a);c.resolve(a)}for(g=0;g<a.loadMessages.length;g++)this._showMessage(a.loadMessages[g].message)}),d.hitch(this,function(a){c.reject(a);this._showMessage("GWM_0003"===a.messageCode?C.widgets.directions.error.accessDenied+this._naRouteSharing.portal.getPortalUser().username:C.widgets.directions.error.loadError)}))}),c.reject)}),c.reject);return c.promise}});a("extend-esri")&&d.setObject("dijit.Directions",n,N);return n});