/*
	Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/

/*
	This is an optimized version of Dojo, built for deployment and not for
	development. To get sources and documentation, please visit:

		http://dojotoolkit.org
*/

window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dojo.io.iframe"],["provide","esri.layers.FeatureLayer"],["provide","dojox.gfx.Mover"],["provide","dojox.gfx.Moveable"],["provide","dojox.gfx.move"],["provide","esri.toolbars._GraphicMover"],["provide","dijit._KeyNavContainer"],["provide","dijit._Contained"],["provide","dijit.MenuItem"],["provide","dijit.PopupMenuItem"],["provide","dijit.CheckedMenuItem"],["provide","dijit.MenuSeparator"],["provide","dijit.Menu"],["provide","esri.toolbars._VertexMover"],["provide","esri.toolbars._VertexEditor"],["provide","esri.toolbars._Box"],["provide","esri.toolbars.edit"],["provide","dojo.data.util.filter"],["provide","dojo.data.util.sorter"],["provide","dojo.data.util.simpleFetch"],["provide","dojo.data.ItemFileReadStore"],["provide","dijit.layout._LayoutWidget"],["provide","dijit.dijit"],["provide","dojox.html.metrics"],["provide","dojox.grid.util"],["provide","dojox.grid._Scroller"],["provide","dojox.grid.cells._base"],["provide","dojox.grid.cells"],["provide","dojox.grid._Builder"],["provide","dojo.dnd.Container"],["provide","dojo.dnd.Selector"],["provide","dojo.dnd.Avatar"],["provide","dojo.dnd.Manager"],["provide","dojo.dnd.Source"],["provide","dojox.grid._View"],["provide","dojox.grid._RowSelector"],["provide","dojox.grid._Layout"],["provide","dojox.grid._ViewManager"],["provide","dojox.grid._RowManager"],["provide","dojox.grid._FocusManager"],["provide","dojox.grid._EditManager"],["provide","dojox.grid.Selection"],["provide","dojox.grid._Events"],["provide","dojox.grid._Grid"],["provide","dojox.grid.DataSelection"],["provide","dojox.grid.DataGrid"],["provide","esri.dijit.editing.TemplatePicker"],["provide","esri.dijit.editing.TemplatePicker-all"],["i18n._preloadLocalizations","esri.dijit.editing.nls.TemplatePicker-all",["ROOT","ar","ca","cs","da","de","de-de","el","en","en-gb","en-us","es","es-es","fi","fi-fi","fr","fr-fr","he","he-il","hu","it","it-it","ja","ja-jp","ko","ko-kr","nb","nl","nl-nl","pl","pt","pt-br","pt-pt","ru","sk","sl","sv","th","tr","xx","zh","zh-cn","zh-tw"]]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojo.io.iframe"]){_4._hasResource["dojo.io.iframe"]=true;_4.provide("dojo.io.iframe");_4.getObject("io",true,_4);_4.io.iframe={create:function(_7,_8,_9){if(window[_7]){return window[_7];}if(window.frames[_7]){return window.frames[_7];}var _a=null;var _b=_9;if(!_b){if(_4.config["useXDomain"]&&!_4.config["dojoBlankHtmlUrl"]){console.warn("dojo.io.iframe.create: When using cross-domain Dojo builds,"+" please save dojo/resources/blank.html to your domain and set djConfig.dojoBlankHtmlUrl"+" to the path on your domain to blank.html");}_b=(_4.config["dojoBlankHtmlUrl"]||_4.moduleUrl("dojo","resources/blank.html"));}var _a=_4.place("<iframe id=\""+_7+"\" name=\""+_7+"\" src=\""+_b+"\" onload=\""+_8+"\" style=\"position: absolute; left: 1px; top: 1px; height: 1px; width: 1px; visibility: hidden\">",_4.body());window[_7]=_a;return _a;},setSrc:function(_c,_d,_e){try{if(!_e){if(_4.isWebKit){_c.location=_d;}else{frames[_c.name].location=_d;}}else{var _f;if(_4.isIE||_4.isWebKit){_f=_c.contentWindow.document;}else{_f=_c.contentWindow;}if(!_f){_c.location=_d;return;}else{_f.location.replace(_d);}}}catch(e){console.log("dojo.io.iframe.setSrc: ",e);}},doc:function(_10){var doc=_10.contentDocument||(((_10.name)&&(_10.document)&&(_4.doc.getElementsByTagName("iframe")[_10.name].contentWindow)&&(_4.doc.getElementsByTagName("iframe")[_10.name].contentWindow.document)))||((_10.name)&&(_4.doc.frames[_10.name])&&(_4.doc.frames[_10.name].document))||null;return doc;},send:function(_11){if(!this["_frame"]){this._frame=this.create(this._iframeName,_4._scopeName+".io.iframe._iframeOnload();");}var dfd=_4._ioSetArgs(_11,function(dfd){dfd.canceled=true;dfd.ioArgs._callNext();},function(dfd){var _12=null;try{var _13=dfd.ioArgs;var dii=_4.io.iframe;var ifd=dii.doc(dii._frame);var _14=_13.handleAs;_12=ifd;if(_14!="html"){if(_14=="xml"){if(_4.isIE<9||(_4.isIE&&_4.isQuirks)){_4.query("a",dii._frame.contentWindow.document.documentElement).orphan();var _15=(dii._frame.contentWindow.document).documentElement.innerText;_15=_15.replace(/>\s+</g,"><");_15=_4.trim(_15);var _16={responseText:_15};_12=_4._contentHandlers["xml"](_16);}}else{_12=ifd.getElementsByTagName("textarea")[0].value;if(_14=="json"){_12=_4.fromJson(_12);}else{if(_14=="javascript"){_12=_4.eval(_12);}}}}}catch(e){_12=e;}finally{_13._callNext();}return _12;},function(_17,dfd){dfd.ioArgs._hasError=true;dfd.ioArgs._callNext();return _17;});dfd.ioArgs._callNext=function(){if(!this["_calledNext"]){this._calledNext=true;_4.io.iframe._currentDfd=null;_4.io.iframe._fireNextRequest();}};this._dfdQueue.push(dfd);this._fireNextRequest();_4._ioWatch(dfd,function(dfd){return !dfd.ioArgs["_hasError"];},function(dfd){return (!!dfd.ioArgs["_finished"]);},function(dfd){if(dfd.ioArgs._finished){dfd.callback(dfd);}else{dfd.errback(new Error("Invalid dojo.io.iframe request state"));}});return dfd;},_currentDfd:null,_dfdQueue:[],_iframeName:_4._scopeName+"IoIframe",_fireNextRequest:function(){try{if((this._currentDfd)||(this._dfdQueue.length==0)){return;}do{var dfd=this._currentDfd=this._dfdQueue.shift();}while(dfd&&dfd.canceled&&this._dfdQueue.length);if(!dfd||dfd.canceled){this._currentDfd=null;return;}var _18=dfd.ioArgs;var _19=_18.args;_18._contentToClean=[];var fn=_4.byId(_19["form"]);var _1a=_19["content"]||{};if(fn){if(_1a){var _1b=function(_1c,_1d){_4.create("input",{type:"hidden",name:_1c,value:_1d},fn);_18._contentToClean.push(_1c);};for(var x in _1a){var val=_1a[x];if(_4.isArray(val)&&val.length>1){var i;for(i=0;i<val.length;i++){_1b(x,val[i]);}}else{if(!fn[x]){_1b(x,val);}else{fn[x].value=val;}}}}var _1e=fn.getAttributeNode("action");var _1f=fn.getAttributeNode("method");var _20=fn.getAttributeNode("target");if(_19["url"]){_18._originalAction=_1e?_1e.value:null;if(_1e){_1e.value=_19.url;}else{fn.setAttribute("action",_19.url);}}if(!_1f||!_1f.value){if(_1f){_1f.value=(_19["method"])?_19["method"]:"post";}else{fn.setAttribute("method",(_19["method"])?_19["method"]:"post");}}_18._originalTarget=_20?_20.value:null;if(_20){_20.value=this._iframeName;}else{fn.setAttribute("target",this._iframeName);}fn.target=this._iframeName;_4._ioNotifyStart(dfd);fn.submit();}else{var _21=_19.url+(_19.url.indexOf("?")>-1?"&":"?")+_18.query;_4._ioNotifyStart(dfd);this.setSrc(this._frame,_21,true);}}catch(e){dfd.errback(e);}},_iframeOnload:function(){var dfd=this._currentDfd;if(!dfd){this._fireNextRequest();return;}var _22=dfd.ioArgs;var _23=_22.args;var _24=_4.byId(_23.form);if(_24){var _25=_22._contentToClean;for(var i=0;i<_25.length;i++){var key=_25[i];for(var j=0;j<_24.childNodes.length;j++){var _26=_24.childNodes[j];if(_26.name==key){_4.destroy(_26);break;}}}if(_22["_originalAction"]){_24.setAttribute("action",_22._originalAction);}if(_22["_originalTarget"]){_24.setAttribute("target",_22._originalTarget);_24.target=_22._originalTarget;}}_22._finished=true;}};}if(!_4._hasResource["esri.layers.FeatureLayer"]){_4._hasResource["esri.layers.FeatureLayer"]=true;_4.provide("esri.layers.FeatureLayer");_4.declare("esri.layers.FeatureLayer",esri.layers.GraphicsLayer,{constructor:function(url,_27){this._outFields=_27&&_27.outFields;this._loadCallback=_27&&_27.loadCallback;var _28=_27&&_27._usePatch;this._usePatch=(_28===null||_28===undefined)?true:_28;this._trackIdField=_27&&_27.trackIdField;this.objectIdField=_27&&_27.objectIdField;this._maxOffset=_27&&_27.maxAllowableOffset;this._optEditable=_27&&_27.editable;this._optAutoGen=_27&&_27.autoGeneralize;this.editSummaryCallback=_27&&_27.editSummaryCallback;this.userId=_27&&_27.userId;this.userIsAdmin=_27&&_27.userIsAdmin;this.useMapTime=(_27&&_27.hasOwnProperty("useMapTime"))?(!!_27.useMapTime):true;this.source=_27&&_27.source;this.gdbVersion=_27&&_27.gdbVersion;this._selectedFeatures={};this._selectedFeaturesArr=[];this._newFeatures=[];this._deletedFeatures={};this._ulid=this._getUniqueId();var _29=this.constructor,_2a=this.mode=(esri._isDefined(_27&&_27.mode)?_27.mode:_29.MODE_ONDEMAND);switch(_2a){case _29.MODE_SNAPSHOT:this._mode=new esri.layers._SnapshotMode(this);this._isSnapshot=true;break;case _29.MODE_ONDEMAND:this._tileWidth=(_27&&_27.tileWidth)||512;this._tileHeight=(_27&&_27.tileHeight)||512;this._mode=new esri.layers._OnDemandMode(this);var _2b=_27&&_27.latticeTiling;this.latticeTiling=_2b;break;case _29.MODE_SELECTION:this._mode=new esri.layers._SelectionMode(this);this._isSelOnly=true;break;}this._initLayer=_4.hitch(this,this._initLayer);this._selectHandler=_4.hitch(this,this._selectHandler);this._editable=false;if(_4.isObject(url)&&url.layerDefinition){var _2c=url;this._collection=true;this.mode=_29.MODE_SNAPSHOT;this._initLayer(_2c);return this;}this._task=new esri.tasks.QueryTask(this.url,{source:this.source,gdbVersion:this.gdbVersion});var _2d=this._url.path;this._fserver=false;if(_2d.search(/\/FeatureServer\//i)!==-1){this._fserver=true;}var _2e=_27&&_27.resourceInfo;if(_2e){this._initLayer(_2e);}else{if(this.source){var _2f={source:this.source.toJson()};this._url.query=_4.mixin(this._url.query,{layer:_4.toJson(_2f)});}if(this.gdbVersion){this._url.query=_4.mixin(this._url.query,{gdbVersion:this.gdbVersion});}esri.request({url:_2d,content:_4.mixin({f:"json"},this._url.query),callbackParamName:"callback",load:this._initLayer,error:this._errorHandler});}},_initLayer:function(_30,io){if(_30||io){this._json=_30;this._findCredential();if(this._collection){this._mode=new esri.layers._SnapshotMode(this);this._isSnapshot=true;this._featureSet=_30.featureSet;this._nextId=_30.nextObjectId;_30=_30.layerDefinition;}if(_30.hasOwnProperty("capabilities")){var _31=(this.capabilities=_30.capabilities);if(_31&&_31.toLowerCase().indexOf("editing")!==-1){this._editable=true;}else{this._editable=false;}}else{if(!this._collection){this._editable=this._fserver;}}if(esri._isDefined(this._optEditable)){this._editable=this._optEditable;delete this._optEditable;}this._json=_4.toJson(this._json);if(this._editable){delete this._maxOffset;}else{if(this.mode!==this.constructor.MODE_SNAPSHOT&&((_30.geometryType==="esriGeometryPolyline")||(_30.geometryType==="esriGeometryPolygon"))){this._autoGeneralize=esri._isDefined(this._optAutoGen)?this._optAutoGen:(this.mode===this.constructor.MODE_ONDEMAND);delete this._optAutoGen;}}this.minScale=_30.minScale||0;this.maxScale=_30.maxScale||0;this.layerId=_30.id;this.name=_30.name;this.description=_30.description;this.copyright=_30.copyrightText;this.type=_30.type;this.geometryType=_30.geometryType;this.displayField=_30.displayField;this.defaultDefinitionExpression=_30.definitionExpression;this.fullExtent=new esri.geometry.Extent(_30.extent);if((this.geometryType==="esriGeometryPoint")||(this.geometryType==="esriGeometryMultipoint")){this.latticeTiling=false;}this.indexedFields=_30.indexedFields;this.maxRecordCount=_30.maxRecordCount;this.canModifyLayer=_30.canModifyLayer;this.supportsStatistics=_30.supportsStatistics;this.supportsAdvancedQueries=_30.supportsAdvancedQueries;this.hasLabels=_30.hasLabels;this.canScaleSymbols=_30.canScaleSymbols;this.supportsRollbackOnFailure=_30.supportsRollbackOnFailure;this.syncCanReturnChanges=_30.syncCanReturnChanges;this.isDataVersioned=_30.isDataVersioned;this.editFieldsInfo=_30.editFieldsInfo;this.ownershipBasedAccessControlForFeatures=_30.ownershipBasedAccessControlForFeatures;if(this.editFieldsInfo&&this.ownershipBasedAccessControlForFeatures){this.creatorField=this.editFieldsInfo.creatorField;}this.relationships=_30.relationships;this.allowGeometryUpdates=esri._isDefined(_30.allowGeometryUpdates)?_30.allowGeometryUpdates:true;this._isTable=(this.type==="Table");var _32=(this.fields=[]),_33=_30.fields,i;for(i=0;i<_33.length;i++){_32.push(new esri.layers.Field(_33[i]));}if(!this.objectIdField){this.objectIdField=_30.objectIdField;if(!this.objectIdField){_33=_30.fields;for(i=0;i<_33.length;i++){var _34=_33[i];if(_34.type==="esriFieldTypeOID"){this.objectIdField=_34.name;break;}}}if(!this.objectIdField){console.debug("esri.layers.FeatureLayer: "+esri.substitute({url:this.url},esri.bundle.layers.FeatureLayer.noOIDField));}}if(!esri._isDefined(this._nextId)){var _35=this.objectIdField,_36=-1;if(this._collection&&_35){var _37=this._featureSet,_38=_37&&_37.features,il=_38?_38.length:0,oid,_39;for(i=0;i<il;i++){_39=_38[i].attributes;oid=_39&&_39[_35];if(oid>_36){_36=oid;}}}this._nextId=(_36+1);}this.globalIdField=_30.globalIdField;this.typeIdField=_30.typeIdField;this.visibilityField=_30.visibilityField;var _3a=_30.defaultSymbol;if(_3a){this.defaultSymbol=esri.symbol.fromJson(_3a);}var _3b=this.types=[],_3c=_30.types,_3d,_3e,_3f,_40=this.editFieldsInfo,_41=_40&&_40.creatorField,_42=_40&&_40.editorField,fix=(_41||_42),_43=[];if(_3c){for(i=0;i<_3c.length;i++){_3d=new esri.layers.FeatureType(_3c[i]);_3e=_3d.templates;if(fix&&_3e&&_3e.length){_43=_43.concat(_3e);}_3b.push(_3d);}}var _44=_30.templates,_45,_46=this.templates=[];if(_44){for(i=0;i<_44.length;i++){_45=new esri.layers.FeatureTemplate(_44[i]);if(fix){_43.push(_45);}_46.push(_45);}}for(i=0;i<_43.length;i++){_3f=_4.getObject("prototype.attributes",false,_43[i]);if(_3f){if(_41){delete _3f[_41];}if(_42){delete _3f[_42];}}}var _47=_30.timeInfo;if(_47){this.timeInfo=new esri.layers.TimeInfo(_47);this._startTimeField=_47.startTimeField;this._endTimeField=_47.endTimeField;if(this._startTimeField&&this._endTimeField){this._twoTimeFields=true;}if(this._trackIdField){_47.trackIdField=this._trackIdField;}else{this._trackIdField=_47.trackIdField;}}this.hasAttachments=(!this._collection&&_30.hasAttachments)?true:false;this.htmlPopupType=_30.htmlPopupType;var _48=_30.drawingInfo,_49;if(!this.renderer){if(_48&&_48.renderer){_49=_48.renderer;this.setRenderer(esri.renderer.fromJson(_49));if(_49.type==="classBreaks"){this.renderer._setMaxInclusiveness(true);}if(!this._collection){var _4a=_49.type,_4b=[];_49=this.renderer;switch(_4a){case "simple":_4b.push(_49.symbol);break;case "uniqueValue":case "classBreaks":_4b.push(_49.defaultSymbol);_4b=_4b.concat(_4.map(_49.infos,function(_4c){return _4c.symbol;}));break;}_4b=_4.filter(_4b,esri._isDefined);var _4d=this._url.path+"/images/",_4e=this._getToken();_4.forEach(_4b,function(sym){var url=sym.url;if(url){if((url.search(/https?\:/)===-1)&&(url.indexOf("data:")===-1)){sym.url=_4d+url;}if(_4e&&sym.url.search(/https?\:/)!==-1){sym.url+=("?token="+_4e);}}});}}else{if(_3a){_3c=this.types;if(_3c.length>0){_49=new esri.renderer.UniqueValueRenderer(this.defaultSymbol,this.typeIdField);_4.forEach(_3c,function(_4f){_49.addValue(_4f.id,_4f.symbol);});}else{_49=new esri.renderer.SimpleRenderer(this.defaultSymbol);}this.setRenderer(_49);}else{if(!this._isTable){var _50;switch(this.geometryType){case "esriGeometryPoint":case "esriGeometryMultipoint":_50=new esri.symbol.SimpleMarkerSymbol();break;case "esriGeometryPolyline":_50=new esri.symbol.SimpleLineSymbol();break;case "esriGeometryPolygon":_50=new esri.symbol.SimpleFillSymbol();break;}this.setRenderer(_50?new esri.renderer.SimpleRenderer(_50):null);}}}}var _51=(_48&&_48.transparency)||0;if(!esri._isDefined(this.opacity)&&_51>0){this.opacity=1-(_51/100);}this.version=_30.currentVersion;if(!this.version){var ver;if("capabilities" in _30||"drawingInfo" in _30||"hasAttachments" in _30||"htmlPopupType" in _30||"relationships" in _30||"timeInfo" in _30||"typeIdField" in _30||"types" in _30){ver=10;}else{ver=9.3;}this.version=ver;}if((_4.isIE||_4.isSafari)&&this._editable&&this.version<10.02){this._ts=true;}this.loaded=true;this._fixRendererFields();this._checkFields();this._updateCaps();if(this._collection){this._fireUpdateStart();var _52=this._featureSet;delete this._featureSet;this._mode._drawFeatures(new esri.tasks.FeatureSet(_52));this._fcAdded=true;}this.onLoad(this);var _53=this._loadCallback;if(_53){delete this._loadCallback;_53(this);}}},setRenderer:function(ren){this.inherited("setRenderer",arguments);var _54=this.renderer;if(_54){this._ager=(_54.declaredClass.indexOf("TemporalRenderer")!==-1&&_54.observationAger&&_54.observationRenderer);var _55=_4.filter([_54,_54.observationRenderer,_54.latestObservationRenderer,_54.trackRenderer],esri._isDefined);var _56=[];_4.forEach(_55,function(rnd){_56.push(rnd.attributeField);_56.push(rnd.attributeField2);_56.push(rnd.attributeField3);},this);this._rendererFields=_4.filter(_56,esri._isDefined);}else{this._ager=false;this._rendererFields=[];}if(this.loaded&&this._rendererFields.length>0){this._fixRendererFields();this._checkFields(this._rendererFields);}if(this.loaded&&this._collection){this._typesDirty=true;}},_setMap:function(map,_57){this._map=map;this._toggleTime(true);var div=this.inherited("_setMap",arguments);this.clearSelection();var _58=this.renderer;if(this.timeInfo){if(this._trackIdField||(_58&&(_58.latestObservationRenderer||_58.trackRenderer))){this._trackManager=new esri.layers._TrackManager(this);this._trackManager.initialize(map);}}this._zoomConnect=_4.connect(map,"onZoomEnd",this,this._zoomHandler);this._zoomHandler();var _59=this._mode;if(_59){_59.initialize(map);}return div;},_unsetMap:function(map,_5a){var _5b=this._mode;if(_5b){_5b.destroy();this._mode=null;}if(this._trackManager){this._trackManager.destroy();this._trackManager=null;}_4.disconnect(this._zoomConnect);this._zoomConnect=null;this._toggleTime(false);this.inherited("_unsetMap",arguments);},refresh:function(){var _5c=this._mode;if(_5c){_5c.refresh();}},setEditable:function(_5d){if(!this._collection){console.log("FeatureLayer:setEditCapabilities - this functionality is not yet supported for layer in a feature service");return this;}if(!this.loaded){this._optEditable=_5d;return this;}var _5e=this._editable;this._editable=_5d;this._updateCaps();if(_5e!==_5d){this.onCapabilitiesChange();}return this;},getEditCapabilities:function(_5f){var _60={"canCreate":false,"canUpdate":false,"canDelete":false};if(!this.loaded||!this._editable){return _60;}var _61=_5f&&_5f.feature,_62=_5f&&_5f.userId,_63=_4.map((this.capabilities?this.capabilities.toLowerCase().split(","):[]),_4.trim),_64=_4.indexOf(_63,"editing")>-1,_65=_64&&(_4.indexOf(_63,"create")>-1),_66=_64&&(_4.indexOf(_63,"update")>-1),_67=_64&&(_4.indexOf(_63,"delete")>-1),_68=this.ownershipBasedAccessControlForFeatures,_69=this.editFieldsInfo,_6a=_69&&_69.creatorField,_6b=_69&&_69.realm,_6c=_61&&_61.attributes,_6d=(_6c&&_6a)?_6c[_6a]:undefined,_6e,_6f=!!this.userIsAdmin,_70=!_68||_6f||!!(_68.allowOthersToUpdate||_68.allowUpdateToOthers),_71=!_68||_6f||!!(_68.allowOthersToDelete||_68.allowDeleteToOthers);if(_64&&(!(_65||_66||_67)||_6f)){_65=_66=_67=true;}_6e={"canCreate":_65,"canUpdate":_66,"canDelete":_67};if(_6d===null){_6e.canUpdate=_66&&_70;_6e.canDelete=_67&&_71;}else{if(_6d===""){return _6e;}else{if(_6d){_62=_62||this.getUserId();if(_62&&_6b){_62=_62+"@"+_6b;}if(_62.toLowerCase()===_6d.toLowerCase()){return _6e;}else{_6e.canUpdate=_66&&_70;_6e.canDelete=_67&&_71;}}}}return _6e;},getUserId:function(){var _72;if(this.loaded){_72=(this.credential&&this.credential.userId)||this.userId||"";}return _72;},setUserIsAdmin:function(_73){this.userIsAdmin=_73;},setEditSummaryCallback:function(_74){this.editSummaryCallback=_74;},getEditSummary:function(_75,_76,_77){_77=esri._isDefined(_77)?_77:(new Date()).getTime();var _78="",_79=this.getEditInfo(_75,_76,_77),_7a=(_76&&_76.callback)||this.editSummaryCallback;if(_7a){_79=_7a(_75,_79)||"";}if(_4.isString(_79)){_78=_79;}else{if(_79){var _7b=_79.action,_7c=_79.userId,_7d=_79.timeValue,_7e=0;if(_7b){_7e++;}if(_7c){_7e++;}if(esri._isDefined(_7d)){_7e++;}if(_7e>1){_78=(_7b==="edit"?"edit":"create")+(_7c?"User":"")+(esri._isDefined(_7d)?_79.displayPattern:"");}}_78=_78&&esri.substitute(_79,esri.bundle.layers.FeatureLayer[_78]);}return _78;},getEditInfo:function(_7f,_80,_81){if(!this.loaded){return;}_81=esri._isDefined(_81)?_81:(new Date()).getTime();var _82=(_80&&_80.action)||"last",_83=this.editFieldsInfo,_84=_83&&_83.creatorField,_85=_83&&_83.creationDateField,_86=_83&&_83.editorField,_87=_83&&_83.editDateField,_88=_83&&_83.realm,_89=_7f&&_7f.attributes,_8a=(_89&&_84)?_89[_84]:undefined,_8b=(_89&&_85)?_89[_85]:null,_8c=(_89&&_86)?_89[_86]:undefined,_8d=(_89&&_87)?_89[_87]:null,_8e=this._getEditData(_8a,_8b,_81),_8f=this._getEditData(_8c,_8d,_81),_90;switch(_82){case "creation":_90=_8e;break;case "edit":_90=_8f;break;case "last":_90=_8f||_8e;break;}if(_90){_90.action=(_90===_8f)?"edit":"creation";}return _90;},_getEditData:function(_91,_92,_93){var _94,_95,_96,_97=60000,_98=3600000,_99=2*_98,_9a=24*_98,_9b=7*_9a;if(esri._isDefined(_92)){_95=_93-_92;if(_95<0){_96="Full";}else{if(_95<_97){_96="Seconds";}else{if(_95<(2*_97)){_96="Minute";}else{if(_95<_98){_96="Minutes";}else{if(_95<_99){_96="Hour";}else{if(_95<_9a){_96="Hours";}else{if(_95<_9b){_96="WeekDay";}else{_96="Full";}}}}}}}}if((_91!==undefined)||_96){_94=_94||{};_94.userId=_91;if(_96){var _9c=_4.date.locale.format,_9d=new Date(_92);_94.minutes=Math.floor(_95/_97);_94.hours=Math.floor(_95/_98);_94.weekDay=_9c(_9d,{datePattern:"EEEE",selector:"date"});_94.formattedDate=_9c(_9d,{selector:"date"});_94.formattedTime=_9c(_9d,{selector:"time"});_94.displayPattern=_96;_94.timeValue=_92;}}return _94;},isEditable:function(){return this._editable;},setMaxAllowableOffset:function(_9e){if(!this._editable){this._maxOffset=_9e;}return this;},getMaxAllowableOffset:function(){return this._maxOffset;},setAutoGeneralize:function(_9f){if(!this.loaded){this._optAutoGen=_9f;}else{if(!this._editable&&(this.mode!==this.constructor.MODE_SNAPSHOT)&&((this.geometryType==="esriGeometryPolyline")||(this.geometryType==="esriGeometryPolygon"))){this._autoGeneralize=_9f;if(_9f){var map=this._map;if(map&&map.loaded){this._maxOffset=Math.floor(map.extent.getWidth()/map.width);}}else{delete this._maxOffset;}}}return this;},setScaleRange:function(_a0,_a1){this.minScale=_a0||0;this.maxScale=_a1||0;if(this._map&&this._map.loaded){this._updateStatus();}},setGDBVersion:function(_a2){if(!this._collection&&(_a2!==this.gdbVersion)&&(_a2||this.gdbVersion)){this.gdbVersion=_a2;this._task.gdbVersion=_a2;this._url.query=_4.mixin(this._url.query,{gdbVersion:_a2});if(this.loaded){this.clearSelection();if(this._map){this.refresh();}}this.onGDBVersionChange();}return this;},setDefinitionExpression:function(_a3){this._defnExpr=_a3;var _a4=this._mode;if(_a4){_a4.propertyChangeHandler(1);}return this;},getDefinitionExpression:function(){return this._defnExpr;},setTimeDefinition:function(_a5){if(this._isSnapshot){this._timeDefn=_a5;var _a6=this._mode;if(_a6){_a6.propertyChangeHandler(2);}}return this;},getTimeDefinition:function(){return this._timeDefn;},setTimeOffset:function(_a7,_a8){this._timeOffset=_a7;this._timeOffsetUnits=_a8;var _a9=this._mode;if(_a9){_a9.propertyChangeHandler(0);}return this;},setUseMapTime:function(use){this.useMapTime=use;this._toggleTime(!this._suspended);var _aa=this._mode;if(_aa){_aa.propertyChangeHandler(0);}},selectFeatures:function(_ab,_ac,_ad,_ae){_ac=_ac||this.constructor.SELECTION_NEW;var _af=this._getShallowClone(_ab),map=this._map,_b0,dfd=esri._fixDfd(new _4.Deferred(esri._dfdCanceller));_af.outFields=this._getOutFields();_af.returnGeometry=true;if(map){_af.outSpatialReference=new esri.SpatialReference(map.spatialReference.toJson());}if(!this._applyQueryFilters(_af)){_b0={features:[]};this._selectHandler(_b0,_ac,_ad,_ae,dfd);return dfd;}var _b1=this._canDoClientSideQuery(_af);if(_b1){_b0={features:this._doQuery(_af,_b1)};this._selectHandler(_b0,_ac,_ad,_ae,dfd);return dfd;}else{if(this._collection){var err=new Error("FeatureLayer::selectFeatures - "+esri.bundle.layers.FeatureLayer.invalidParams);this._resolve([err],null,_ae,dfd,true);return dfd;}var _b2=this;if(this._ts){_af._ts=(new Date()).getTime();}var _b3=dfd._pendingDfd=this._task.execute(_af);_b3.addCallbacks(function(_b4){_b2._selectHandler(_b4,_ac,_ad,_ae,dfd);},function(err){_b2._resolve([err],null,_ae,dfd,true);});return dfd;}},getSelectedFeatures:function(){var _b5=this._selectedFeatures,_b6=[],_b7;for(_b7 in _b5){if(_b5.hasOwnProperty(_b7)){_b6.push(_b5[_b7]);}}return _b6;},clearSelection:function(_b8){var _b9=this._selectedFeatures,_ba=this._mode,_bb;for(_bb in _b9){if(_b9.hasOwnProperty(_bb)){this._unSelectFeatureIIf(_bb,_ba);_ba._removeFeatureIIf(_bb);}}this._selectedFeatures={};if(this._isSelOnly){_ba._applyTimeFilter(true);}if(!_b8){this.onSelectionClear();}return this;},setSelectionSymbol:function(_bc){this._selectionSymbol=_bc;if(_bc){var _bd=this._selectedFeatures,_be;for(_be in _bd){if(_bd.hasOwnProperty(_be)){_bd[_be].setSymbol(_bc);}}}return this;},getSelectionSymbol:function(){return this._selectionSymbol;},__msigns:[{n:"applyEdits",c:5,a:[{i:0},{i:1}],e:4,f:1}],applyEdits:function(_bf,_c0,_c1,_c2,_c3,_c4){var _c5=_c4.assembly,dfd=_c4.dfd;this._applyNormalized(_bf,_c5&&_c5[0]);this._applyNormalized(_c0,_c5&&_c5[1]);this.onBeforeApplyEdits(_bf,_c0,_c1);var i,_c6={},_c7=this.objectIdField,_c8={f:"json"},_c9=false;if(this._collection){var _ca={};_ca.addResults=_bf?_4.map(_bf,function(){_c9=true;return {objectId:this._nextId++,success:true};},this):null;_ca.updateResults=_c0?_4.map(_c0,function(_cb){_c9=true;var oid=_cb.attributes[_c7];_c6[oid]=_cb;return {objectId:oid,success:true};},this):null;_ca.deleteResults=_c1?_4.map(_c1,function(_cc){_c9=true;return {objectId:_cc.attributes[_c7],success:true};},this):null;if(_c9){this._editHandler(_ca,_bf,_c6,_c2,_c3,dfd);}return;}if(_bf&&_bf.length>0){_c8.adds=this._convertFeaturesToJson(_bf,0,1);_c9=true;}if(_c0&&_c0.length>0){for(i=0;i<_c0.length;i++){var _cd=_c0[i];_c6[_cd.attributes[_c7]]=_cd;}_c8.updates=this._convertFeaturesToJson(_c0,0,0,1);_c9=true;}if(_c1&&_c1.length>0){var ids=[];for(i=0;i<_c1.length;i++){ids.push(_c1[i].attributes[_c7]);}_c8.deletes=ids.join(",");_c9=true;}if(_c9){var _ce=this;return esri.request({url:this._url.path+"/applyEdits",content:_4.mixin(_c8,this._url.query),callbackParamName:"callback",load:function(_cf){_ce._editHandler(_cf,_bf,_c6,_c2,_c3,dfd);},error:function(err){_ce._resolve([err],null,_c3,dfd,true);}},{usePost:true});}},queryFeatures:function(_d0,_d1,_d2){return this._query("execute","onQueryFeaturesComplete",_d0,_d1,_d2);},queryRelatedFeatures:function(_d3,_d4,_d5){return this._query("executeRelationshipQuery","onQueryRelatedFeaturesComplete",_d3,_d4,_d5);},queryIds:function(_d6,_d7,_d8){return this._query("executeForIds","onQueryIdsComplete",_d6,_d7,_d8);},queryCount:function(_d9,_da,_db){return this._query("executeForCount","onQueryCountComplete",_d9,_da,_db);},queryAttachmentInfos:function(_dc,_dd,_de){var url=this._url.path+"/"+_dc+"/attachments",dfd=new _4.Deferred(esri._dfdCanceller),_df=this;dfd._pendingDfd=esri.request({url:url,content:_4.mixin({f:"json"},this._url.query),callbackParamName:"callback",load:function(_e0){var _e1=_e0.attachmentInfos,_e2;_4.forEach(_e1,function(_e3){_e2=_4.objectToQuery({gdbVersion:_df._url.query&&_df._url.query.gdbVersion,layer:_df._url.query&&_df._url.query.layer,token:_df._getToken()});_e3.url=url+"/"+_e3.id+(_e2?("?"+_e2):"");_e3.objectId=_dc;});_df._resolve([_e1],"onQueryAttachmentInfosComplete",_dd,dfd);},error:function(err){_df._resolve([err],null,_de,dfd,true);}});return dfd;},addAttachment:function(_e4,_e5,_e6,_e7){return this._sendAttachment("add",_e4,_e5,_e6,_e7);},updateAttachment:function(_e8,_e9,_ea,_eb,_ec){_ea.appendChild(_4.create("input",{type:"hidden",name:"attachmentId",value:_e9}));return this._sendAttachment("update",_e8,_ea,_eb,_ec);},deleteAttachments:function(_ed,_ee,_ef,_f0){var url=this._url.path+"/"+_ed+"/deleteAttachments",dfd=new _4.Deferred(esri._dfdCanceller),_f1=this,_f2={f:"json",attachmentIds:_ee.join(",")};dfd._pendingDfd=esri.request({url:url,content:_4.mixin(_f2,this._url.query),callbackParamName:"callback",load:_4.hitch(this,function(_f3){var _f4=_f3.deleteAttachmentResults;_f4=_4.map(_f4,function(_f5){var res=new esri.layers.FeatureEditResult(_f5);res.attachmentId=res.objectId;res.objectId=_ed;return res;});_f1._resolve([_f4],"onDeleteAttachmentsComplete",_ef,dfd);}),error:function(err){_f1._resolve([err],null,_f0,dfd,true);}},{usePost:true});return dfd;},addType:function(_f6){if(!this._collection){return false;}var _f7=this.types;if(_f7){var _f8=_4.some(_f7,function(_f9){if(_f9.id==_f6.id){return true;}return false;});if(_f8){return false;}else{_f7.push(_f6);}}else{this.types=[_f6];}this._typesDirty=true;return true;},deleteType:function(_fa){if(!this._collection){return;}var _fb=this.types;if(_fb){var _fc=-1;_4.some(_fb,function(_fd,_fe){if(_fd.id==_fa){_fc=_fe;return true;}return false;});if(_fc>-1){this._typesDirty=true;return _fb.splice(_fc,1)[0];}}},toJson:function(){var _ff=this._json,json=_4.isString(_ff)?_4.fromJson(_ff):_4.clone(_ff);if(!json){return;}json=json.layerDefinition?json:{layerDefinition:json};var _100=json.layerDefinition,_101=this._collection;if(_101&&this._typesDirty){_100.types=_4.map(this.types||[],function(type){return type.toJson();});var _102=this.renderer,_103=_100.drawingInfo;if(_103&&_102&&_102.declaredClass.indexOf("TemporalRenderer")===-1){_103.renderer=_102.toJson();}}var _104=null;if(!(_101&&!this._fcAdded)){_104={geometryType:_100.geometryType,features:this._convertFeaturesToJson(this.graphics,true)};}json.featureSet=_4.mixin({},json.featureSet||{},_104);if(_101){json.nextObjectId=this._nextId;_100.capabilities=this.capabilities;}return json;},onSelectionComplete:function(){},onSelectionClear:function(){},onBeforeApplyEdits:function(){},onEditsComplete:function(){},onQueryFeaturesComplete:function(){},onQueryRelatedFeaturesComplete:function(){},onQueryIdsComplete:function(){},onQueryCountComplete:function(){},onQueryAttachmentInfosComplete:function(){},onAddAttachmentComplete:function(){},onUpdateAttachmentComplete:function(){},onDeleteAttachmentsComplete:function(){},onCapabilitiesChange:function(){},onGDBVersionChange:function(){},onQueryLimitExceeded:function(){},_updateCaps:function(){var _105=this._editable,_106=_4.trim(this.capabilities||""),_107=_4.map((_106?_106.split(","):[]),_4.trim),caps=_4.map((_106?_106.toLowerCase().split(","):[]),_4.trim),_108=_4.indexOf(caps,"editing"),cap,i,_109,_10a={"Create":_4.indexOf(caps,"create"),"Update":_4.indexOf(caps,"update"),"Delete":_4.indexOf(caps,"delete")};if(_105&&_108===-1){_107.push("Editing");}else{if(!_105&&_108>-1){_109=[_108];for(cap in _10a){if(_10a[cap]>-1){_109.push(_10a[cap]);}}_109.sort();for(i=_109.length-1;i>=0;i--){_107.splice(_109[i],1);}}}this.capabilities=_107.join(",");},_counter:{value:0},_getUniqueId:function(){return this._counter.value++;},_getDesiredStatus:function(){return this.visible&&this._isMapAtVisibleScale();},_isMapAtVisibleScale:function(){if(!this._map){return false;}var _10b=esri.geometry.getScale(this._map);var _10c=this.minScale,_10d=this.maxScale,_10e=!_10c,_10f=!_10d;if(!_10e&&_10b<=_10c){_10e=true;}if(!_10f&&_10b>=_10d){_10f=true;}return (_10e&&_10f)?true:false;},_suspend:function(){this.inherited("_suspend",arguments);this._toggleTime(false);var mode=this._mode;if(mode){mode.suspend();}},_resume:function(){this.inherited("_resume",arguments);this._toggleTime(true);var mode=this._mode;if(mode){mode.resume();}},_zoomHandler:function(){var map=this._map;if(map&&map.loaded){if(this._autoGeneralize){this._maxOffset=Math.floor(map.extent.getWidth()/map.width);}this._updateStatus();}},_toggleTime:function(_110){var map=this._map;if(_110&&this.timeInfo&&this.useMapTime&&map){this._mapTimeExtent=map.timeExtent;if(!this._timeConnect){this._timeConnect=_4.connect(map,"onTimeExtentChange",this,this._timeChangeHandler);}}else{this._mapTimeExtent=null;_4.disconnect(this._timeConnect);this._timeConnect=null;}},_timeChangeHandler:function(_111){this._mapTimeExtent=_111;var mode=this._mode;if(mode){mode.propertyChangeHandler(0);}},_getOffsettedTE:function(_112){var _113=this._timeOffset,_114=this._timeOffsetUnits;return (_112&&_113&&_114)?_112.offset(-1*_113,_114):_112;},_getTimeOverlap:function(_115,_116){if(_115&&_116){return _115.intersection(_116);}else{return _115||_116;}},_getTimeFilter:function(_117){var _118=this.getTimeDefinition(),_119=null,_11a;if(_118||_119){_11a=this._getTimeOverlap(_118,_119);if(!_11a){return [false];}}if(_117){_117=_11a?this._getTimeOverlap(_117,_11a):_117;if(!_117){return [false];}}else{_117=_11a;}return [true,_117];},_getAttributeFilter:function(_11b){var _11c=this.getDefinitionExpression();if(_11b){_11b=_11c?"("+_11c+") AND ("+_11b+")":_11b;}else{_11b=_11c;}return _11b;},_applyQueryFilters:function(_11d){_11d.where=this._getAttributeFilter(_11d.where);_11d.maxAllowableOffset=this._maxOffset;if(this.timeInfo){var _11e=this._getTimeFilter(_11d.timeExtent);if(!_11e[0]){return false;}else{_11d.timeExtent=_11e[1];}}return true;},_add:function(_11f){var _120=this._selectionSymbol,attr=_11f.attributes,_121=this.visibilityField;if(_120&&this._isSelOnly){_11f.setSymbol(_120);}if(_121&&attr&&attr.hasOwnProperty(_121)){_11f[attr[_121]?"show":"hide"]();}return this.add.apply(this,arguments);},_remove:function(){return this.remove.apply(this,arguments);},_canDoClientSideQuery:function(_122){var _123=[],map=this._map;if(this._isTable||!map){return;}if(_122.text||(_122.where&&_122.where!==this.getDefinitionExpression())){return;}var _124=this._isSnapshot,_125=this._isSelOnly;var _126=_122.geometry;if(_126){if(!_125&&_122.spatialRelationship===esri.tasks.Query.SPATIAL_REL_INTERSECTS&&(_126.type==="extent"&&(_124||map.extent.contains(_126)))){_123.push(1);}else{return;}}var ids=_122.objectIds;if(ids){if(_124){_123.push(2);}else{var len=ids.length,mode=this._mode,_127=0,i;for(i=0;i<len;i++){if(mode._getFeature(ids[i])){_127++;}}if(_127===len){_123.push(2);}else{return;}}}if(this.timeInfo){var _128=_122.timeExtent,_129=this._mapTimeExtent;if(_124){if(_128){_123.push(3);}}else{if(_125){if(_128){return;}}else{if(_129){if(_4.indexOf(_123,2)!==-1){if(_128){_123.push(3);}}else{return;}}else{if(_123.length>0){if(_128){_123.push(3);}}else{if(_128){return;}}}}}}return _123.length>0?_123:null;},_doQuery:function(_12a,_12b,_12c){var _12d=[],mode=this._mode,_12e=this.objectIdField,i,len,_12f;if(_4.indexOf(_12b,2)!==-1){_12d=[];var ids=_12a.objectIds;len=ids.length;for(i=0;i<len;i++){var obj=mode._getFeature(ids[i]);if(obj){_12d.push(obj);}}if(_12d.length===0){return [];}}if(_4.indexOf(_12b,1)!==-1){_12f=_12d.length>0?_12d:this.graphics;len=_12f.length;var _130=_12a.geometry._normalize(null,true);_12d=[];for(i=0;i<len;i++){var _131=_12f[i],_132=_131.geometry;if(_132){if(this.normalization&&_130.length){if(_130[0].intersects(_132)||_130[1].intersects(_132)){_12d.push(_131);}}else{if(_130.intersects(_132)){_12d.push(_131);}}}}if(_12d.length===0){return [];}}if(_4.indexOf(_12b,3)!==-1){if(this.timeInfo){_12f=_12d.length>0?_12d:this.graphics;var time=_12a.timeExtent,_133=this._filterByTime(_12f,time.startTime,time.endTime);_12d=_133.match;}}if(_12c){return _4.map(_12d,function(obj){return obj.attributes[_12e];},this);}else{return _12d;}},_filterByTime:function(_134,_135,_136){var _137=this._startTimeField,_138=this._endTimeField,_139;if(!this._twoTimeFields){_139=_137||_138;}var _13a=esri._isDefined,yea=[],nay=[],i,len=_134.length,_13b,_13c;_135=_135?_135.getTime():-Infinity;_136=_136?_136.getTime():Infinity;if(_139){for(i=0;i<len;i++){_13b=_134[i];_13c=_13b.attributes;var time=_13c[_139];if(time>=_135&&time<=_136){yea.push(_13b);}else{nay.push(_13b);}}}else{for(i=0;i<len;i++){_13b=_134[i];_13c=_13b.attributes;var _13d=_13c[_137],end=_13c[_138];_13d=_13a(_13d)?_13d:-Infinity;end=_13a(end)?end:Infinity;if((_13d>=_135&&_13d<=_136)||(end>=_135&&end<=_136)||(_135>=_13d&&_136<=end)){yea.push(_13b);}else{nay.push(_13b);}}}return {match:yea,noMatch:nay};},_resolve:function(args,_13e,_13f,dfd,_140){if(_13e){this[_13e].apply(this,args);}if(_13f){_13f.apply(null,args);}if(dfd){esri._resDfd(dfd,args,_140);}},_getShallowClone:function(_141){var _142=new esri.tasks.Query(),prop;for(prop in _141){if(_141.hasOwnProperty(prop)){_142[prop]=_141[prop];}}return _142;},_query:function(type,_143,_144,_145,_146){var that=this,dfd=new _4.Deferred(esri._dfdCanceller);var _147=function(_148,_149){if(!_149&&type==="execute"&&!that._isTable){var _14a=_148.features,mode=that._mode,_14b=that.objectIdField,il=_14a.length,i;for(i=il-1;i>=0;i--){var oid=_14a[i].attributes[_14b];var _14c=mode._getFeature(oid);if(_14c){_14a.splice(i,1,_14c);}}}that._resolve([_148],_143,_145,dfd);};if(type!=="executeRelationshipQuery"){_144=this._getShallowClone(_144);_144.outFields=this._getOutFields();_144.returnGeometry=true;var map=this._map,_14d;if(map){_144.outSpatialReference=new esri.SpatialReference(map.spatialReference.toJson());}if(!this._applyQueryFilters(_144)){switch(type){case "execute":_14d=new esri.tasks.FeatureSet({features:[]});break;case "executeForIds":_14d=[];break;case "executeForCount":_14d=0;break;}_147(_14d,true);return dfd;}var _14e=this._canDoClientSideQuery(_144);if(_14e){var _14f=this._doQuery(_144,_14e,(type==="executeForIds"||type==="executeForCount"));switch(type){case "execute":_14d=new esri.tasks.FeatureSet();_14d.features=_14f;break;case "executeForIds":_14d=_14f;break;case "executeForCount":_14d=_14f.length;break;}_147(_14d,true);return dfd;}}if(this._collection){var err=new Error("FeatureLayer::_query - "+esri.bundle.layers.FeatureLayer.invalidParams);this._resolve([err],null,_146,dfd,true);return dfd;}if(this._ts){_144._ts=(new Date()).getTime();}var temp=dfd._pendingDfd=this._task[type](_144);temp.addCallbacks(_147,function(err){that._resolve([err],null,_146,dfd,true);});return dfd;},_convertFeaturesToJson:function(_150,_151,_152,_153){var json=[],_154=this._selectionSymbol,_155=this.visibilityField,i,_156,_157=this.objectIdField;if(_152||_153){_156=_4.filter(this.fields,function(_158){return (_158.editable===false)&&(!_153||(_158.name!==_157));});}for(i=0;i<_150.length;i++){var _159=_150[i],_15a={},_15b=_159.geometry,attr=_159.attributes,_15c=_159.symbol;if(_15b&&(!_153||this.allowGeometryUpdates)){_15a.geometry=_15b.toJson();}if(_155){_15a.attributes=attr=_4.mixin({},attr);attr[_155]=_159.visible?1:0;}else{if(attr){_15a.attributes=_4.mixin({},attr);}}if(_15a.attributes&&_156&&_156.length){_4.forEach(_156,function(_15d){delete _15a.attributes[_15d.name];});}if(_15c&&(_15c!==_154)){_15a.symbol=_15c.toJson();}json.push(_15a);}return _151?json:_4.toJson(json);},_selectHandler:function(_15e,_15f,_160,_161,dfd){var _162,ctor=this.constructor;switch(_15f){case ctor.SELECTION_NEW:this.clearSelection(true);_162=true;break;case ctor.SELECTION_ADD:_162=true;break;case ctor.SELECTION_SUBTRACT:_162=false;break;}var i,_163=_15e.features,mode=this._mode,_164=[],_165=this.objectIdField,_166,oid;if(_162){for(i=0;i<_163.length;i++){_166=_163[i];oid=_166.attributes[_165];var _167=mode._addFeatureIIf(oid,_166);_164.push(_167);this._selectFeatureIIf(oid,_167,mode);}}else{for(i=0;i<_163.length;i++){_166=_163[i];oid=_166.attributes[_165];this._unSelectFeatureIIf(oid,mode);var _168=mode._removeFeatureIIf(oid);_164.push(_168||_166);}}if(this._isSelOnly){mode._applyTimeFilter(true);}this._resolve([_164,_15f,_15e.exceededTransferLimit?{queryLimitExceeded:true}:null],"onSelectionComplete",_160,dfd);if(_15e.exceededTransferLimit){this.onQueryLimitExceeded();}},_selectFeatureIIf:function(oid,_169,mode){var _16a=this._selectedFeatures,_16b=_16a[oid];if(!_16b){mode._incRefCount(oid);_16a[oid]=_169;if(!this._isTable){this._setSelectSymbol(_169);}}return _16b||_169;},_unSelectFeatureIIf:function(oid,mode){var _16c=this._selectedFeatures[oid];if(_16c){mode._decRefCount(oid);delete this._selectedFeatures[oid];if(!this._isTable){this._setUnSelectSymbol(_16c);}}return _16c;},_isSelected:function(_16d){},_setSelectSymbol:function(_16e){var _16f=this._selectionSymbol;if(_16f&&!this._isSelOnly){_16e.setSymbol(_16f);}},_setUnSelectSymbol:function(_170){var _171=this._selectionSymbol;if(_171&&!this._isSelOnly){if(_171===_170.symbol){_170.setSymbol(null,true);}}},_getOutFields:function(){var _172=_4.filter([this.objectIdField,this.typeIdField,this.creatorField,this._startTimeField,this._endTimeField,this._trackIdField].concat(this._rendererFields),function(_173,_174,arr){return !!_173&&(_4.indexOf(arr,_173)===_174);});var _175=_4.clone(this._outFields);if(_175){if(_4.indexOf(_175,"*")!==-1){return _175;}_4.forEach(_172,function(_176){if(_4.indexOf(_175,_176)===-1){_175.push(_176);}});return _175;}else{return _172;}},_checkFields:function(_177){var _178=_177||this._getOutFields();_4.forEach(_178,function(_179){if(_179==="*"){return;}if(!this._getField(_179)){console.debug("esri.layers.FeatureLayer: "+esri.substitute({url:this.url,field:_179},esri.bundle.layers.FeatureLayer.fieldNotFound));}},this);if(!_177&&!this._isTable&&!this._fserver&&!this._collection){var _17a=_4.some(this.fields,function(_17b){return (_17b&&_17b.type==="esriFieldTypeGeometry")?true:false;});if(!_17a){console.debug("esri.layers.FeatureLayer: "+esri.substitute({url:this.url},esri.bundle.layers.FeatureLayer.noGeometryField));}}},_fixRendererFields:function(){var _17c=this.renderer;if(_17c&&this.fields.length>0){var _17d=_4.filter([_17c,_17c.observationRenderer,_17c.latestObservationRenderer,_17c.trackRenderer],esri._isDefined);var _17e=[];_4.forEach(_17d,function(rnd){var _17f,_180;_180=rnd.attributeField;if(_180){_17f=!this._getField(_180)&&this._getField(_180,true);if(_17f){rnd.attributeField=_17f.name;}}_180=rnd.attributeField2;if(_180){_17f=!this._getField(_180)&&this._getField(_180,true);if(_17f){rnd.attributeField2=_17f.name;}}_180=rnd.attributeField3;if(_180){_17f=!this._getField(_180)&&this._getField(_180,true);if(_17f){rnd.attributeField3=_17f.name;}}_17e.push(rnd.attributeField);_17e.push(rnd.attributeField2);_17e.push(rnd.attributeField3);},this);this._rendererFields=_4.filter(_17e,esri._isDefined);}},_getField:function(_181,_182){var _183=this.fields;if(_183.length===0){return null;}var _184;if(_182){_181=_181.toLowerCase();}_4.some(_183,function(_185){var _186=false;if(_182){_186=(_185&&_185.name.toLowerCase()===_181)?true:false;}else{_186=(_185&&_185.name===_181)?true:false;}if(_186){_184=_185;}return _186;});return _184;},_getDateOpts:function(){if(!this._dtOpts){var _187=_4.map(_4.filter(this.fields,function(_188){return !!(_188&&_188.type==="esriFieldTypeDate");}),function(_189){return _189.name;});this._dtOpts={properties:_187};}return this._dtOpts;},_applyNormalized:function(_18a,_18b){if(_18a&&_18b){_4.forEach(_18a,function(_18c,_18d){if(_18c&&_18b[_18d]){_18c.setGeometry(_18b[_18d]);}});}},_editHandler:function(_18e,adds,_18f,_190,_191,dfd){var _192=_18e.addResults,_193=_18e.updateResults,_194=_18e.deleteResults,i,_195,oid,_196,attr,_197=this.objectIdField,mode=this._mode,_198=this._isTable;var _199=this.editFieldsInfo,_19a=this._getOutFields()||[],_19b=_199&&_199.creatorField,_19c=_199&&_199.creationDateField,_19d=_199&&_199.editorField,_19e=_199&&_199.editDateField,_19f=_199&&_199.realm;if(_4.indexOf(_19a,"*")===-1){if(_19b&&_4.indexOf(_19a,_19b)===-1){_19b=null;}if(_19c&&_4.indexOf(_19a,_19c)===-1){_19c=null;}if(_19d&&_4.indexOf(_19a,_19d)===-1){_19d=null;}if(_19e&&_4.indexOf(_19a,_19e)===-1){_19e=null;}}var _1a0=(_19c||_19e)?(new Date()).getTime():null,_1a1=(_19b||_19d)?this.getUserId():undefined;if(_1a1&&_19f){_1a1=_1a1+"@"+_19f;}if(_192){for(i=0;i<_192.length;i++){_192[i]=new esri.layers.FeatureEditResult(_192[i]);if(_198){continue;}_195=_192[i];if(_195.success){oid=_195.objectId;_196=adds[i];var gl=_196._graphicsLayer;if(gl&&gl!==this){gl.remove(_196);}attr=_196.attributes||{};attr[_197]=oid;if(_19b){attr[_19b]=_1a1;}if(_19d){attr[_19d]=_1a1;}if(_19c){attr[_19c]=_1a0;}if(_19e){attr[_19e]=_1a0;}_196.setAttributes(attr);mode.drawFeature(_196);}}}if(_193){for(i=0;i<_193.length;i++){_193[i]=new esri.layers.FeatureEditResult(_193[i]);if(_198){continue;}_195=_193[i];if(_195.success){oid=_195.objectId;_196=_18f[oid];var _1a2=mode._getFeature(oid);if(_1a2){if(_1a2.geometry!==_196.geometry){_1a2.setGeometry(esri.geometry.fromJson(_196.geometry.toJson()));}this._repaint(_1a2,oid);}_196=_1a2||_196;attr=_196.attributes||{};if(_19d){attr[_19d]=_1a1;}if(_19e){attr[_19e]=_1a0;}_196.setAttributes(attr);}}}if(_194){var _1a3=[];for(i=0;i<_194.length;i++){_194[i]=new esri.layers.FeatureEditResult(_194[i]);if(_198){continue;}_195=_194[i];if(_195.success){oid=_195.objectId;_196=mode._getFeature(oid);if(_196){if(this._unSelectFeatureIIf(oid,mode)){_1a3.push(_196);}_196._count=0;mode._removeFeatureIIf(oid);}}}if(_1a3.length>0){this.onSelectionComplete(_1a3,this.constructor.SELECTION_SUBTRACT);}}this._resolve([_192,_193,_194],"onEditsComplete",_190,dfd);},_sendAttachment:function(type,_1a4,_1a5,_1a6,_1a7){var _1a8=(type==="add")?"addAttachment":"updateAttachment",url=this._url.path+"/"+_1a4+"/"+_1a8,self=this;var dfd=esri.request({url:url,form:_1a5,content:_4.mixin(this._url.query,{f:"json",token:this._getToken()||undefined}),callbackParamName:"callback.html",handleAs:"json"}).addCallback(function(_1a9){var _1aa=(type==="add")?"addAttachmentResult":"updateAttachmentResult",_1ab=(type==="add")?"onAddAttachmentComplete":"onUpdateAttachmentComplete",_1ac=new esri.layers.FeatureEditResult(_1a9[_1aa]);_1ac.attachmentId=_1ac.objectId;_1ac.objectId=_1a4;self._resolve([_1ac],_1ab,_1a6);return _1ac;}).addErrback(function(_1ad){self._resolve([_1ad],null,_1a7,null,true);});return dfd;},_repaint:function(_1ae,oid,_1af){oid=esri._isDefined(oid)?oid:_1ae.attributes[this.objectIdField];if(!(oid in this._selectedFeatures)||!this._selectionSymbol){_1ae.setSymbol(_1ae.symbol,_1af);}},_getKind:function(_1b0){var _1b1=this._trackManager;if(_1b1){return _1b1.isLatestObservation(_1b0)?1:0;}return 0;}});_4.mixin(esri.layers.FeatureLayer,{MODE_SNAPSHOT:0,MODE_ONDEMAND:1,MODE_SELECTION:2,SELECTION_NEW:3,SELECTION_ADD:4,SELECTION_SUBTRACT:5,POPUP_NONE:"esriServerHTMLPopupTypeNone",POPUP_HTML_TEXT:"esriServerHTMLPopupTypeAsHTMLText",POPUP_URL:"esriServerHTMLPopupTypeAsURL"});esri._createWrappers("esri.layers.FeatureLayer");_4.declare("esri.layers.FeatureType",null,{constructor:function(json){if(json&&_4.isObject(json)){this.id=json.id;this.name=json.name;var _1b2=json.symbol;if(_1b2){this.symbol=esri.symbol.fromJson(_1b2);}var _1b3=json.domains,_1b4,i;var _1b5=this.domains={};for(_1b4 in _1b3){if(_1b3.hasOwnProperty(_1b4)){var _1b6=_1b3[_1b4];switch(_1b6.type){case "range":_1b5[_1b4]=new esri.layers.RangeDomain(_1b6);break;case "codedValue":_1b5[_1b4]=new esri.layers.CodedValueDomain(_1b6);break;case "inherited":_1b5[_1b4]=new esri.layers.InheritedDomain(_1b6);break;}}}var _1b7=json.templates;if(_1b7){var _1b8=this.templates=[];for(i=0;i<_1b7.length;i++){_1b8.push(new esri.layers.FeatureTemplate(_1b7[i]));}}}},toJson:function(){var json={id:this.id,name:this.name,symbol:this.symbol&&this.symbol.toJson()};var _1b9,_1ba=this.domains,_1bb=this.templates,_1bc=esri._sanitize;if(_1ba){var _1bd=json.domains={};for(_1b9 in _1ba){if(_1ba.hasOwnProperty(_1b9)){_1bd[_1b9]=_1ba[_1b9]&&_1ba[_1b9].toJson();}}_1bc(_1bd);}if(_1bb){json.templates=_4.map(_1bb,function(_1be){return _1be.toJson();});}return _1bc(json);}});_4.declare("esri.layers.FeatureTemplate",null,{constructor:function(json){if(json&&_4.isObject(json)){this.name=json.name;this.description=json.description;this.drawingTool=json.drawingTool;var _1bf=json.prototype;this.prototype=new esri.Graphic(_1bf.geometry,null,_1bf.attributes);}},toJson:function(){return esri._sanitize({name:this.name,description:this.description,drawingTool:this.drawingTool,prototype:this.prototype&&this.prototype.toJson()});}});_4.mixin(esri.layers.FeatureTemplate,{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"});_4.declare("esri.layers.FeatureEditResult",null,{constructor:function(json){if(json&&_4.isObject(json)){this.objectId=json.objectId;this.success=json.success;if(!json.success){var err=json.error;this.error=new Error();this.error.code=err.code;this.error.message=err.description;}}}});_4.declare("esri.layers._RenderMode",null,{constructor:function(){this._prefix="jsonp_"+(_4._scopeName||"dojo")+"IoScript";},initialize:function(map){},propertyChangeHandler:function(type){},destroy:function(){},drawFeature:function(_1c0){},suspend:function(){},resume:function(){},refresh:function(){},_incRefCount:function(oid){var _1c1=this._featureMap[oid];if(_1c1){_1c1._count++;}},_decRefCount:function(oid){var _1c2=this._featureMap[oid];if(_1c2){_1c2._count--;}},_getFeature:function(oid){return this._featureMap[oid];},_addFeatureIIf:function(oid,_1c3){var fmap=this._featureMap,_1c4=fmap[oid],_1c5=this.featureLayer;if(!_1c4){fmap[oid]=_1c3;_1c5._add(_1c3);_1c3._count=0;}return _1c4||_1c3;},_removeFeatureIIf:function(oid){var _1c6=this._featureMap[oid],_1c7=this.featureLayer;if(_1c6){if(_1c6._count){return;}delete this._featureMap[oid];_1c7._remove(_1c6);}return _1c6;},_clearIIf:function(){var i,_1c8=this.featureLayer,_1c9=_1c8.graphics,_1ca=_1c8._selectedFeatures,_1cb=_1c8.objectIdField;for(i=_1c9.length-1;i>=0;i--){var _1cc=_1c9[i];var oid=_1cc.attributes[_1cb];if(oid in _1ca){_1cc._count=1;continue;}_1cc._count=0;this._removeFeatureIIf(oid);}},_isPending:function(id){var dfd=_4.io.script[this._prefix+id];return dfd?true:false;},_cancelPendingRequest:function(dfd,id){dfd=dfd||_4.io.script[this._prefix+id];if(dfd){try{dfd.cancel();_4.io.script._validCheck(dfd);}catch(e){}}},_purgeRequests:function(){_4.io.script._validCheck(null);},_toggleVisibility:function(show){var _1cd=this.featureLayer,_1ce=_1cd.graphics,_1cf=show?"show":"hide",i,len=_1ce.length;show=show&&_1cd._ager;for(i=0;i<len;i++){var _1d0=_1ce[i];_1d0[_1cf]();if(show){_1cd._repaint(_1d0);}}},_applyTimeFilter:function(_1d1){var _1d2=this.featureLayer;if(!_1d2.timeInfo||_1d2._suspended){return;}if(!_1d1){_1d2._fireUpdateStart();}var _1d3=_1d2._trackManager;if(_1d3){_1d3.clearTracks();}var defn=_1d2.getTimeDefinition(),_1d4=_1d2._getOffsettedTE(_1d2._mapTimeExtent);if(_1d4){_1d4=_1d2._getTimeOverlap(defn,_1d4);if(_1d4){var _1d5=_1d2._filterByTime(_1d2.graphics,_1d4.startTime,_1d4.endTime);if(_1d3){_1d3.addFeatures(_1d5.match);}_4.forEach(_1d5.match,function(_1d6){var _1d7=_1d6._shape;if(!_1d6.visible){_1d6.show();_1d7=_1d6._shape;_1d7&&_1d7._moveToFront();}if(_1d2._ager&&_1d7){_1d2._repaint(_1d6);}});_4.forEach(_1d5.noMatch,function(_1d8){if(_1d8.visible){_1d8.hide();}});}else{this._toggleVisibility(false);}}else{if(_1d3){_1d3.addFeatures(_1d2.graphics);}this._toggleVisibility(true);}if(_1d3){_1d3.moveLatestToFront();_1d3.drawTracks();}if(!_1d1){_1d2._fireUpdateEnd();}}});_4.declare("esri.layers._SelectionMode",[esri.layers._RenderMode],{constructor:function(_1d9){this.featureLayer=_1d9;this._featureMap={};},initialize:function(map){this.map=map;this._init=true;},propertyChangeHandler:function(type){if(this._init&&type===0){this._applyTimeFilter();}},destroy:function(){this._init=false;},resume:function(){this.propertyChangeHandler(0);}});_4.declare("esri.layers._SnapshotMode",[esri.layers._RenderMode],{constructor:function(_1da){this.featureLayer=_1da;this._featureMap={};this._drawFeatures=_4.hitch(this,this._drawFeatures);this._queryErrorHandler=_4.hitch(this,this._queryErrorHandler);},initialize:function(map){this.map=map;var _1db=this.featureLayer;if(_1db._collection){this._applyTimeFilter();}else{this._fetchAll();}this._init=true;},propertyChangeHandler:function(type){if(this._init){if(type){this._fetchAll();}else{this._applyTimeFilter();}}},destroy:function(){this._init=false;},drawFeature:function(_1dc){var _1dd=this.featureLayer,_1de=_1dd.objectIdField,oid=_1dc.attributes[_1de];this._addFeatureIIf(oid,_1dc);this._incRefCount(oid);},resume:function(){this.propertyChangeHandler(0);},refresh:function(){var _1df=this.featureLayer;if(_1df._collection){_1df._fireUpdateStart();_1df._refresh(true);_1df._fireUpdateEnd();}else{this._fetchAll();}},_getRequestId:function(_1e0){var id="_"+_1e0.name+_1e0.layerId+_1e0._ulid;return id.replace(/[^a-zA-Z0-9\_]+/g,"_");},_fetchAll:function(){var _1e1=this.featureLayer;if(_1e1._collection){return;}_1e1._fireUpdateStart();this._clearIIf();this._sendRequest();},_sendRequest:function(){var map=this.map,_1e2=this.featureLayer,_1e3=_1e2.getDefinitionExpression();var _1e4=new esri.tasks.Query();_1e4.outFields=_1e2._getOutFields();_1e4.where=_1e3||"1=1";_1e4.returnGeometry=true;_1e4.outSpatialReference=new esri.SpatialReference(map.spatialReference.toJson());_1e4.timeExtent=_1e2.getTimeDefinition();_1e4.maxAllowableOffset=_1e2._maxOffset;if(_1e2._ts){_1e4._ts=(new Date()).getTime();}var _1e5;if(_1e2._usePatch){_1e5=this._getRequestId(_1e2);this._cancelPendingRequest(null,_1e5);}_1e2._task.execute(_1e4,this._drawFeatures,this._queryErrorHandler,_1e5);},_drawFeatures:function(_1e6){this._purgeRequests();var _1e7=_1e6.features,_1e8=this.featureLayer,_1e9=_1e8.objectIdField,i,len=_1e7.length,_1ea,oid;for(i=0;i<len;i++){_1ea=_1e7[i];oid=_1ea.attributes[_1e9];this._addFeatureIIf(oid,_1ea);this._incRefCount(oid);}this._applyTimeFilter(true);_1e8._fireUpdateEnd(null,_1e6.exceededTransferLimit?{queryLimitExceeded:true}:null);if(_1e6.exceededTransferLimit){_1e8.onQueryLimitExceeded();}},_queryErrorHandler:function(err){this._purgeRequests();var _1eb=this.featureLayer;_1eb._errorHandler(err);_1eb._fireUpdateEnd(err);}});_4.declare("esri.layers._OnDemandMode",[esri.layers._RenderMode],{constructor:function(_1ec){this.featureLayer=_1ec;this._featureMap={};this._queryErrorHandler=_4.hitch(this,this._queryErrorHandler);},initialize:function(map){this.map=map;this._initialize();this._init=true;},propertyChangeHandler:function(type){if(this._init){if(type<2){this._zoomHandler();}}},destroy:function(){this._disableConnectors();this._init=false;},drawFeature:function(_1ed){var _1ee=this._gridLayer,geom=_1ed.geometry,_1ef=[];if(!geom){return;}_1ef=_1ee.getCellsInExtent((geom.type==="point")?{xmin:geom.x,ymin:geom.y,xmax:geom.x,ymax:geom.y}:geom.getExtent(),false).cells;var _1f0=this._cellMap,i,cell,oid=_1ed.attributes[this.featureLayer.objectIdField],_1f1,row,col;for(i=0;i<_1ef.length;i++){cell=_1ef[i];_1f1=cell.latticeID;row=cell.row;col=cell.col;if(_1f1){cell=(_1f0[_1f1]=(_1f0[_1f1]||cell));}else{_1f0[row]=_1f0[row]||{};cell=(_1f0[row][col]=(_1f0[row][col]||cell));}cell.features=cell.features||[];cell.features.push(_1ed);this._addFeatureIIf(oid,_1ed);this._incRefCount(oid);}},suspend:function(){if(!this._init){return;}this._disableConnectors();},resume:function(){if(!this._init){return;}this._enableConnectors();this._zoomHandler();},refresh:function(){this._zoomHandler();},_initialize:function(){var map=this.map,_1f2=this.featureLayer;var _1f3=_1f2._srInfo;this._gridLayer=new esri.layers._GridLayout(new esri.geometry.Point(_1f3?_1f3.valid[0]:map.extent.xmin,map.extent.ymax,map.spatialReference),{width:_1f2._tileWidth,height:_1f2._tileHeight},{width:map.width,height:map.height},_1f3);this._ioQueue=[];if(!_1f2._suspended){this._zoomHandler();this._enableConnectors();}},_enableConnectors:function(){var map=this.map;this._zoomConnect=_4.connect(map,"onZoomEnd",this,this._zoomHandler);this._panConnect=_4.connect(map,"onPanEnd",this,this._panHandler);this._resizeConnect=_4.connect(map,"onResize",this,this._panHandler);},_disableConnectors:function(){_4.disconnect(this._zoomConnect);_4.disconnect(this._panConnect);_4.disconnect(this._resizeConnect);},_zoomHandler:function(){this._processIOQueue(true);var _1f4=this.featureLayer,map=this.map;if(_1f4._suspended){return;}_1f4._fireUpdateStart();this._clearIIf();var _1f5=_1f4._trackManager;if(_1f5){_1f5.clearTracks();}this._cellMap={};this._gridLayer.setResolution(map.extent);this._sendRequest();},_panHandler:function(){this.featureLayer._fireUpdateStart();this._sendRequest(this.featureLayer._resized&&arguments[0]);},_getRequestId:function(_1f6,cell){var id="_"+_1f6.name+_1f6.layerId+_1f6._ulid+"_"+cell.resolution+"_"+(cell.latticeID||(cell.row+"_"+cell.col));return id.replace(/[^a-zA-Z0-9\_]+/g,"_");},_sendRequest:function(_1f7){this._exceeds=false;var _1f8=this.featureLayer,map=this.map,_1f9=_1f7||map.extent,_1fa=this._gridLayer.getCellsInExtent(_1f9,_1f8.latticeTiling),_1fb=_1fa.cells;if(!_1f8._editable){var _1fc=this._cellMap;_1fb=_4.filter(_1fb,function(cell){if(cell.lattice){if(_1fc[cell.latticeID]){return false;}}else{if(_1fc[cell.row]&&_1fc[cell.row][cell.col]){return false;}}return true;});}var _1fd=_1f8._getOutFields(),_1fe=_1f8.getDefinitionExpression(),time=_1f8._getOffsettedTE(_1f8._mapTimeExtent),_1ff=_1f8._usePatch,_200=this._ioQueue,i,self=this,func=this._drawFeatures,cell,_201,_202;this._pending=this._pending||0;for(i=0;i<_1fb.length;i++){cell=_1fb[i];_201=new esri.tasks.Query();_201.geometry=cell.extent||cell.lattice;_201.outFields=_1fd;_201.where=_1fe;if(_1f8.latticeTiling&&cell.extent){_201.spatialRelationship=esri.tasks.Query.SPATIAL_REL_CONTAINS;}_201.returnGeometry=true;_201.timeExtent=time;_201.maxAllowableOffset=_1f8._maxOffset;if(_1f8._ts){_201._ts=(new Date()).getTime();}_202=null;if(_1ff){_202=this._getRequestId(_1f8,cell);if(this._isPending(_202)){continue;}}this._pending++;_200.push(_1f8._task.execute(_201,function(){var _203=cell;return function(_204){func.apply(self,[_204,_203]);};}.call(this),this._queryErrorHandler,_202));}this._removeOldCells(_1f9);this._endCheck();},_drawFeatures:function(_205,cell){this._exceeds=this._exceeds||_205.exceededTransferLimit;this._finalizeIO();var _206=this.featureLayer,map=this.map,_207=map.extent,_208=cell.extent,row=cell.row,col=cell.col,_209=_206.objectIdField,_20a=_205.features,_20b=this._gridLayer,_20c=this._cellMap,i,len,_20d=cell.latticeID,_20e=_20d?_20c[_20d]:(_20c[row]&&_20c[row][col]);if((cell.resolution!=_20b._resolution)||(_20d?(_20d!==_20b.getLatticeID(_207)):(!_20b.intersects(_208,_207)))){if(_20e){this._removeCell(row,col,_20d);}}else{if(_20e){this._updateCell(_20e,_20a);}else{cell.features=_20a;if(_20d){_20c[_20d]=cell;}else{_20c[row]=_20c[row]||{};_20c[row][col]=cell;}len=_20a.length;for(i=0;i<len;i++){var _20f=_20a[i];var oid=_20f.attributes[_209];this._addFeatureIIf(oid,_20f);this._incRefCount(oid);}}}this._endCheck();},_queryErrorHandler:function(err){this._finalizeIO();this.featureLayer._errorHandler(err);this._endCheck(true);},_finalizeIO:function(){this._purgeRequests();this._pending--;},_endCheck:function(_210){if(this._pending===0){this._processIOQueue();var _211=this.featureLayer,_212=_211._trackManager;if(_212){_212.clearTracks();_212.addFeatures(_211.graphics);if(_211._ager){_4.forEach(_211.graphics,function(_213){if(_213._shape){_211._repaint(_213);}});}_212.moveLatestToFront();_212.drawTracks();}this.featureLayer._fireUpdateEnd(_210&&new Error("FeatureLayer: "+esri.bundle.layers.FeatureLayer.updateError),this._exceeds?{queryLimitExceeded:true}:null);if(this._exceeds){_211.onQueryLimitExceeded();}}},_processIOQueue:function(_214){this._ioQueue=_4.filter(this._ioQueue,function(dfd){var keep=dfd.fired>-1?false:true;return keep;});if(_214){_4.forEach(this._ioQueue,this._cancelPendingRequest);}},_removeOldCells:function(_215){var _216=this._cellMap,_217=this._gridLayer,_218,_219;for(_218 in _216){if(_216[_218]){var row=_216[_218],_21a=row.latticeID,_21b=0,_21c=0;if(_21a){_21b++;if(_21a!==_217.getLatticeID(_215)){this._removeCell(null,null,_21a);_21c++;}}else{for(_219 in row){if(row[_219]){_21b++;var _21d=row[_219].extent;if(!_217.intersects(_21d,_215)){this._removeCell(_218,_219);_21c++;}}}}if(_21c===_21b){delete _216[_218];}}}},_updateCell:function(cell,_21e){var _21f=this.featureLayer,_220=_21f.objectIdField,_221=_21f._selectedFeatures,i,len=_21e.length;cell.features=cell.features||[];for(i=0;i<len;i++){var _222=_21e[i];var oid=_222.attributes[_220];var _223=this._addFeatureIIf(oid,_222);if(_223===_222){this._incRefCount(oid);cell.features.push(_223);}else{if(!(oid in _221)){_223.setGeometry(_222.geometry);_223.setAttributes(_222.attributes);}}}},_removeCell:function(row,col,_224){var _225=this._cellMap,_226=this.featureLayer,_227=_226.objectIdField;var cell=_224?_225[_224]:(_225[row]&&_225[row][col]);if(cell){if(_224){delete _225[_224];}else{delete _225[row][col];}var _228=cell.features,i;for(i=0;i<_228.length;i++){var _229=_228[i];var oid=_229.attributes[_227];this._decRefCount(oid);if(oid in _226._selectedFeatures){continue;}this._removeFeatureIIf(oid);}}}});_4.declare("esri.layers._GridLayout",null,{constructor:function(_22a,_22b,_22c,_22d){this.origin=_22a;this.cellWidth=_22b.width;this.cellHeight=_22b.height;this.mapWidth=_22c.width;this.mapHeight=_22c.height;this.srInfo=_22d;},setResolution:function(_22e){this._resolution=(_22e.xmax-_22e.xmin)/this.mapWidth;if(this.srInfo){var _22f=Math.round((2*this.srInfo.valid[1])/this._resolution),_230=Math.round(_22f/this.cellWidth);this._frameStats=[_230,0,_230-1];}},getCellCoordinates:function(_231){var res=this._resolution,_232=this.origin;return {row:Math.floor((_232.y-_231.y)/(this.cellHeight*res)),col:Math.floor((_231.x-_232.x)/(this.cellWidth*res))};},normalize:function(col){var _233=this._frameStats;if(_233){var _234=_233[0],m180=_233[1],p180=_233[2];if(col<m180){col=col%_234;col=col<m180?col+_234:col;}else{if(col>p180){col=col%_234;}}}return col;},intersects:function(_235,_236){var _237=this.srInfo;if(_237){return _4.some(_236._getParts(_237),function(_238){return _235.intersects(_238.extent);});}else{return _235.intersects(_236);}},getCellExtent:function(row,col){var res=this._resolution,_239=this.origin,_23a=this.cellWidth,_23b=this.cellHeight;return new esri.geometry.Extent((col*_23a*res)+_239.x,_239.y-((row+1)*_23b*res),((col+1)*_23a*res)+_239.x,_239.y-(row*_23b*res),new esri.SpatialReference(_239.spatialReference.toJson()));},getLatticeID:function(_23c){var _23d=this.getCellCoordinates({x:_23c.xmin,y:_23c.ymax}),_23e=this.getCellCoordinates({x:_23c.xmax,y:_23c.ymin}),_23f=_23d.row,_240=_23e.row,_241=this.normalize(_23d.col),_242=this.normalize(_23e.col);return _23f+"_"+_240+"_"+_241+"_"+_242;},sorter:function(a,b){return (a<b)?-1:1;},getCellsInExtent:function(_243,_244){var _245=this.getCellCoordinates({x:_243.xmin,y:_243.ymax}),_246=this.getCellCoordinates({x:_243.xmax,y:_243.ymin}),_247=_245.row,_248=_246.row,_249=_245.col,_24a=_246.col,_24b=[],i,j,nj,_24c=[],_24d=[],len,xmin,xmax,ymin,ymax,_24e=[],_24f,_250;for(i=_247;i<=_248;i++){for(j=_249;j<=_24a;j++){nj=this.normalize(j);_243=this.getCellExtent(i,nj);_24b.push({row:i,col:nj,extent:_243,resolution:this._resolution});if(_244){_24c.push(_243.xmin,_243.xmax);_24d.push(_243.ymin,_243.ymax);}}}_249=this.normalize(_249);_24a=this.normalize(_24a);_24c.sort(this.sorter);_24d.sort(this.sorter);len=_24c.length;for(i=len-1;i>=0;i--){if(i<(len-1)){if(_24c[i]===_24c[i+1]){_24c.splice(i,1);}}}len=_24d.length;for(i=len-1;i>=0;i--){if(i<(len-1)){if(_24d[i]===_24d[i+1]){_24d.splice(i,1);}}}if(_24c.length&&_24d.length){xmin=_24c[0];xmax=_24c[_24c.length-1];ymin=_24d[0];ymax=_24d[_24d.length-1];len=_24c.length;for(i=0;i<len;i++){_24e.push([[_24c[i],ymax],[_24c[i],ymin]]);}len=_24d.length;for(i=0;i<len;i++){_24e.push([[xmin,_24d[i]],[xmax,_24d[i]]]);}_24f=new esri.geometry.Polyline({paths:_24e,spatialReference:this.origin.spatialReference.toJson()});_250=_247+"_"+_248+"_"+_249+"_"+_24a;_24b.push({latticeID:_250,lattice:_24f,resolution:this._resolution});}return {minRow:_247,maxRow:_248,minCol:_249,maxCol:_24a,cells:_24b};}});_4.declare("esri.layers._TrackManager",null,{constructor:function(_251){this.layer=_251;this.trackMap={};},initialize:function(map){this.map=map;var _252=this.layer,_253=_252.renderer.trackRenderer;if(_253&&(_252.geometryType==="esriGeometryPoint")){var _254=(this.container=new esri.layers._GraphicsLayer({id:_252.id+"_tracks",_child:true}));_254._setMap(map,_252._div);_254.setRenderer(_253);}},addFeatures:function(_255){var tkid,_256=this.trackMap,_257=this.layer,_258=_257._trackIdField;_4.forEach(_255,function(_259){var _25a=_259.attributes;tkid=_25a[_258];var ary=(_256[tkid]=(_256[tkid]||[]));ary.push(_259);});var _25b=_257._startTimeField,_25c=_257.objectIdField;var _25d=function(a,b){var _25e=a.attributes[_25b],_25f=b.attributes[_25b];if(_25e===_25f){return (a.attributes[_25c]<b.attributes[_25c])?-1:1;}else{return (_25e<_25f)?-1:1;}};for(tkid in _256){_256[tkid].sort(_25d);}},drawTracks:function(){var _260=this.container;if(!_260){return;}var _261=this.trackMap,sr=this.map.spatialReference,tkid,ary,path,i,_262;for(tkid in _261){ary=_261[tkid];path=[];for(i=ary.length-1;i>=0;i--){_262=ary[i].geometry;if(_262){path.push([_262.x,_262.y]);}}if(path.length>0){_260.add(new esri.Graphic(new esri.geometry.Polyline({paths:[path],spatialReference:sr})));}}},moveLatestToFront:function(){_4.forEach(this.getLatestObservations(),function(_263){var _264=_263._shape;_264&&_264._moveToFront();this._repaint(_263,null,true);},this.layer);},getLatestObservations:function(){var _265=[];if(!this.layer.renderer.latestObservationRenderer){return _265;}var _266=this.trackMap,tkid;for(tkid in _266){var ary=_266[tkid];_265.push(ary[ary.length-1]);}return _265;},clearTracks:function(){var _267=this.getLatestObservations();this.trackMap={};var _268=this.container;if(_268){_268.clear();}_4.forEach(_267,function(_269){this._repaint(_269,null,true);},this.layer);},isLatestObservation:function(_26a){var _26b=this.layer._trackIdField;var _26c=this.trackMap[_26a.attributes[_26b]];if(_26c){return (_26c[_26c.length-1]===_26a);}return false;},destroy:function(){var _26d=this.container;if(_26d){_26d.clear();_26d._unsetMap(this.map,this.layer._div);this.container=null;}this.map=null;this.layer=null;this.trackMap=null;}});}if(!_4._hasResource["dojox.gfx.Mover"]){_4._hasResource["dojox.gfx.Mover"]=true;_4.provide("dojox.gfx.Mover");_4.declare("dojox.gfx.Mover",null,{constructor:function(_26e,e,host){this.shape=_26e;this.lastX=e.clientX;this.lastY=e.clientY;var h=this.host=host,d=document;this.events=[_4.connect(d,"onmousemove",this,"onFirstMove"),_4.connect(d,"ontouchmove",this,"onFirstMove"),_4.connect(d,"onmousemove",this,"onMouseMove"),_4.connect(d,"ontouchmove",this,"onMouseMove"),_4.connect(d,"onmouseup",this,"destroy"),_4.connect(d,"ontouchend",this,"destroy"),_4.connect(d,"ondragstart",_4,"stopEvent"),_4.connect(d,"onselectstart",_4,"stopEvent")];if(h&&h.onMoveStart){h.onMoveStart(this);}},onMouseMove:function(e){var pos=e.touches?e.touches[0]:e;var x=pos.clientX;var y=pos.clientY;this.host.onMove(this,{dx:x-this.lastX,dy:y-this.lastY});this.lastX=x;this.lastY=y;_4.stopEvent(e);},onFirstMove:function(){this.host.onFirstMove(this);_4.disconnect(this.events.shift());_4.disconnect(this.events.shift());},destroy:function(){_4.forEach(this.events,_4.disconnect);var h=this.host;if(h&&h.onMoveStop){h.onMoveStop(this);}this.events=this.shape=null;}});}if(!_4._hasResource["dojox.gfx.Moveable"]){_4._hasResource["dojox.gfx.Moveable"]=true;_4.provide("dojox.gfx.Moveable");_4.declare("dojox.gfx.Moveable",null,{constructor:function(_26f,_270){this.shape=_26f;this.delay=(_270&&_270.delay>0)?_270.delay:0;this.mover=(_270&&_270.mover)?_270.mover:_6.gfx.Mover;this.leftButtonOnly=_270&&_270.leftButtonOnly;this.events=[this.shape.connect("onmousedown",this,"onMouseDown"),this.shape.connect("ontouchstart",this,"onMouseDown")];},destroy:function(){_4.forEach(this.events,this.shape.disconnect,this.shape);this.events=this.shape=null;},onMouseDown:function(e){var pos=e.touches?e.touches[0]:e;if(this.delay){this.events.push(this.shape.connect("onmousemove",this,"onMouseMove"));this.events.push(this.shape.connect("ontouchmove",this,"onMouseMove"));this.events.push(this.shape.connect("onmouseup",this,"onMouseUp"));this.events.push(this.shape.connect("ontouchend",this,"onMouseUp"));this._lastX=pos.clientX;this._lastY=pos.clientY;}else{if(!this.leftButtonOnly||(pos.button===_4.mouseButtons.LEFT)){new this.mover(this.shape,pos,this);}}_4.stopEvent(e);},onMouseMove:function(e){var pos=e.touches?e.touches[0]:e;if(Math.abs(pos.clientX-this._lastX)>this.delay||Math.abs(pos.clientY-this._lastY)>this.delay){this.onMouseUp(e);new this.mover(this.shape,pos,this);}_4.stopEvent(e);},onMouseUp:function(e){this.shape.disconnect(this.events.shift());this.shape.disconnect(this.events.shift());},onMoveStart:function(_271){_4.publish("/gfx/move/start",[_271]);_4.addClass(_4.body(),"dojoMove");},onMoveStop:function(_272){_4.publish("/gfx/move/stop",[_272]);_4.removeClass(_4.body(),"dojoMove");},onFirstMove:function(_273){},onMove:function(_274,_275){this.onMoving(_274,_275);this.shape.applyLeftTransform(_275);this.onMoved(_274,_275);},onMoving:function(_276,_277){},onMoved:function(_278,_279){}});}if(!_4._hasResource["dojox.gfx.move"]){_4._hasResource["dojox.gfx.move"]=true;_4.provide("dojox.gfx.move");}if(!_4._hasResource["esri.toolbars._GraphicMover"]){_4._hasResource["esri.toolbars._GraphicMover"]=true;_4.provide("esri.toolbars._GraphicMover");_4.declare("esri.toolbars._Mover",_6.gfx.Mover,{constructor:function(_27a,e,host){this.__e=e;}});_4.declare("esri.toolbars._GraphicMover",null,{constructor:function(_27b,map,_27c){this.graphic=_27b;this.map=map;this.toolbar=_27c;this._enableGraphicMover();this._moved=false;},refresh:function(_27d){var _27e=this.graphic.getDojoShape();if(_27e&&(_27d||!_27e._hostGraphic)){this._disableGraphicMover();this._enableGraphicMover();}},destroy:function(){this._disableGraphicMover();},hasMoved:function(){return this._moved;},_enableGraphicMover:function(){var _27f=this.graphic;var _280=_27f.getDojoShape();if(_280){_280._hostGraphic=_27f;this._moveable=new _6.gfx.Moveable(_280,{mover:esri.toolbars._Mover});this._moveStartHandle=_4.connect(this._moveable,"onMoveStart",this,this._moveStartHandler);this._firstMoveHandle=_4.connect(this._moveable,"onFirstMove",this,this._firstMoveHandler);this._movingHandle=_4.connect(this._moveable,"onMoving",this,this._movingHandler);this._moveStopHandle=_4.connect(this._moveable,"onMoveStop",this,this._moveStopHandler);var node=_280.getEventSource();if(node){_4.style(node,"cursor",this.toolbar._cursors.move);}}},_disableGraphicMover:function(){var _281=this._moveable;if(_281){_4.disconnect(this._moveStartHandle);_4.disconnect(this._firstMoveHandle);_4.disconnect(this._movingHandle);_4.disconnect(this._moveStopHandle);var _282=_281.shape;if(_282){_282._hostGraphic=null;var node=_282.getEventSource();if(node){_4.style(node,"cursor",null);}}_281.destroy();}this._moveable=null;},_moveStartHandler:function(){var _283=this.graphic;this._startTx=_283.getDojoShape().getTransform();if(this.graphic.geometry.type==="point"){var map=this.map;if(map.snappingManager){map.snappingManager._setUpSnapping();}}this.toolbar.onGraphicMoveStart(_283);},_firstMoveHandler:function(){this.toolbar._beginOperation("MOVE");this.toolbar.onGraphicFirstMove(this.graphic);},_movingHandler:function(_284){this.toolbar.onGraphicMove(this.graphic,_284.shape.getTransform());},_moveStopHandler:function(_285){var _286=this.graphic,map=this.map,mx=_6.gfx.matrix,_287=_286.geometry,type=_287.type,_288=_286.getDojoShape(),tx=_288.getTransform();if(_4.toJson(tx)!==_4.toJson(this._startTx)){this._moved=true;switch(type){case "point":var _289=[tx,mx.invert(this._startTx)];var _28a;if(map.snappingManager){_28a=map.snappingManager._snappingPoint;}_287=_28a||map.toMap(mx.multiplyPoint(_289,map.toScreen(_287,true)));if(map.snappingManager){map.snappingManager._killOffSnapping();}break;case "polyline":_287=this._updatePolyGeometry(_287,_287.paths,tx);break;case "polygon":_287=this._updatePolyGeometry(_287,_287.rings,tx);break;}_288.setTransform(null);_286.setGeometry(_287);}else{this._moved=false;}this.toolbar._endOperation("MOVE");this.toolbar.onGraphicMoveStop(_286,tx);if(!this._moved){var e=_285.__e,_28b=this.map.position,pt=new esri.geometry.Point(e.pageX-_28b.x,e.pageY-_28b.y);this.toolbar.onGraphicClick(_286,{screenPoint:pt,mapPoint:this.map.toMap(pt)});}},_updatePolyGeometry:function(_28c,_28d,_28e){var map=this.map;var _28f=_28c.getPoint(0,0);var _290=map.toMap(map.toScreen(_28f).offset(_28e.dx,_28e.dy));var _291=_290.x-_28f.x;var _292=_290.y-_28f.y;for(var i=0;i<_28d.length;i++){var seg=_28d[i];for(var j=0;j<seg.length;j++){var _293=_28c.getPoint(i,j);_28c.setPoint(i,j,_293.offset(_291,_292));}}return _28c;}});}if(!_4._hasResource["dijit._KeyNavContainer"]){_4._hasResource["dijit._KeyNavContainer"]=true;_4.provide("dijit._KeyNavContainer");_4.declare("dijit._KeyNavContainer",_5._Container,{tabIndex:"0",_keyNavCodes:{},connectKeyNavHandlers:function(_294,_295){var _296=(this._keyNavCodes={});var prev=_4.hitch(this,this.focusPrev);var next=_4.hitch(this,this.focusNext);_4.forEach(_294,function(code){_296[code]=prev;});_4.forEach(_295,function(code){_296[code]=next;});_296[_4.keys.HOME]=_4.hitch(this,"focusFirstChild");_296[_4.keys.END]=_4.hitch(this,"focusLastChild");this.connect(this.domNode,"onkeypress","_onContainerKeypress");this.connect(this.domNode,"onfocus","_onContainerFocus");},startupKeyNavChildren:function(){_4.forEach(this.getChildren(),_4.hitch(this,"_startupChild"));},addChild:function(_297,_298){_5._KeyNavContainer.superclass.addChild.apply(this,arguments);this._startupChild(_297);},focus:function(){this.focusFirstChild();},focusFirstChild:function(){var _299=this._getFirstFocusableChild();if(_299){this.focusChild(_299);}},focusLastChild:function(){var _29a=this._getLastFocusableChild();if(_29a){this.focusChild(_29a);}},focusNext:function(){var _29b=this._getNextFocusableChild(this.focusedChild,1);this.focusChild(_29b);},focusPrev:function(){var _29c=this._getNextFocusableChild(this.focusedChild,-1);this.focusChild(_29c,true);},focusChild:function(_29d,last){if(this.focusedChild&&_29d!==this.focusedChild){this._onChildBlur(this.focusedChild);}_29d.set("tabIndex",this.tabIndex);_29d.focus(last?"end":"start");this._set("focusedChild",_29d);},_startupChild:function(_29e){_29e.set("tabIndex","-1");this.connect(_29e,"_onFocus",function(){_29e.set("tabIndex",this.tabIndex);});this.connect(_29e,"_onBlur",function(){_29e.set("tabIndex","-1");});},_onContainerFocus:function(evt){if(evt.target!==this.domNode){return;}this.focusFirstChild();_4.attr(this.domNode,"tabIndex","-1");},_onBlur:function(evt){if(this.tabIndex){_4.attr(this.domNode,"tabIndex",this.tabIndex);}this.inherited(arguments);},_onContainerKeypress:function(evt){if(evt.ctrlKey||evt.altKey){return;}var func=this._keyNavCodes[evt.charOrCode];if(func){func();_4.stopEvent(evt);}},_onChildBlur:function(_29f){},_getFirstFocusableChild:function(){return this._getNextFocusableChild(null,1);},_getLastFocusableChild:function(){return this._getNextFocusableChild(null,-1);},_getNextFocusableChild:function(_2a0,dir){if(_2a0){_2a0=this._getSiblingOfChild(_2a0,dir);}var _2a1=this.getChildren();for(var i=0;i<_2a1.length;i++){if(!_2a0){_2a0=_2a1[(dir>0)?0:(_2a1.length-1)];}if(_2a0.isFocusable()){return _2a0;}_2a0=this._getSiblingOfChild(_2a0,dir);}return null;}});}if(!_4._hasResource["dijit._Contained"]){_4._hasResource["dijit._Contained"]=true;_4.provide("dijit._Contained");_4.declare("dijit._Contained",null,{getParent:function(){var _2a2=_5.getEnclosingWidget(this.domNode.parentNode);return _2a2&&_2a2.isContainer?_2a2:null;},_getSibling:function(_2a3){var node=this.domNode;do{node=node[_2a3+"Sibling"];}while(node&&node.nodeType!=1);return node&&_5.byNode(node);},getPreviousSibling:function(){return this._getSibling("previous");},getNextSibling:function(){return this._getSibling("next");},getIndexInParent:function(){var p=this.getParent();if(!p||!p.getIndexOfChild){return -1;}return p.getIndexOfChild(this);}});}if(!_4._hasResource["dijit.MenuItem"]){_4._hasResource["dijit.MenuItem"]=true;_4.provide("dijit.MenuItem");_4.declare("dijit.MenuItem",[_5._Widget,_5._Templated,_5._Contained,_5._CssStateMixin],{templateString:_4.cache("dijit","templates/MenuItem.html","<tr class=\"dijitReset dijitMenuItem\" dojoAttachPoint=\"focusNode\" role=\"menuitem\" tabIndex=\"-1\"\r\n\t\tdojoAttachEvent=\"onmouseenter:_onHover,onmouseleave:_onUnhover,ondijitclick:_onClick\">\r\n\t<td class=\"dijitReset dijitMenuItemIconCell\" role=\"presentation\">\r\n\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitIcon dijitMenuItemIcon\" dojoAttachPoint=\"iconNode\"/>\r\n\t</td>\r\n\t<td class=\"dijitReset dijitMenuItemLabel\" colspan=\"2\" dojoAttachPoint=\"containerNode\"></td>\r\n\t<td class=\"dijitReset dijitMenuItemAccelKey\" style=\"display: none\" dojoAttachPoint=\"accelKeyNode\"></td>\r\n\t<td class=\"dijitReset dijitMenuArrowCell\" role=\"presentation\">\r\n\t\t<div dojoAttachPoint=\"arrowWrapper\" style=\"visibility: hidden\">\r\n\t\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitMenuExpand\"/>\r\n\t\t\t<span class=\"dijitMenuExpandA11y\">+</span>\r\n\t\t</div>\r\n\t</td>\r\n</tr>\r\n"),attributeMap:_4.delegate(_5._Widget.prototype.attributeMap,{label:{node:"containerNode",type:"innerHTML"},iconClass:{node:"iconNode",type:"class"}}),baseClass:"dijitMenuItem",label:"",iconClass:"",accelKey:"",disabled:false,_fillContent:function(_2a4){if(_2a4&&!("label" in this.params)){this.set("label",_2a4.innerHTML);}},buildRendering:function(){this.inherited(arguments);var _2a5=this.id+"_text";_4.attr(this.containerNode,"id",_2a5);if(this.accelKeyNode){_4.attr(this.accelKeyNode,"id",this.id+"_accel");_2a5+=" "+this.id+"_accel";}_5.setWaiState(this.domNode,"labelledby",_2a5);_4.setSelectable(this.domNode,false);},_onHover:function(){this.getParent().onItemHover(this);},_onUnhover:function(){this.getParent().onItemUnhover(this);this._set("hovering",false);},_onClick:function(evt){this.getParent().onItemClick(this,evt);_4.stopEvent(evt);},onClick:function(evt){},focus:function(){try{if(_4.isIE==8){this.containerNode.focus();}_5.focus(this.focusNode);}catch(e){}},_onFocus:function(){this._setSelected(true);this.getParent()._onItemFocus(this);this.inherited(arguments);},_setSelected:function(_2a6){_4.toggleClass(this.domNode,"dijitMenuItemSelected",_2a6);},setLabel:function(_2a7){_4.deprecated("dijit.MenuItem.setLabel() is deprecated.  Use set('label', ...) instead.","","2.0");this.set("label",_2a7);},setDisabled:function(_2a8){_4.deprecated("dijit.Menu.setDisabled() is deprecated.  Use set('disabled', bool) instead.","","2.0");this.set("disabled",_2a8);},_setDisabledAttr:function(_2a9){_5.setWaiState(this.focusNode,"disabled",_2a9?"true":"false");this._set("disabled",_2a9);},_setAccelKeyAttr:function(_2aa){this.accelKeyNode.style.display=_2aa?"":"none";this.accelKeyNode.innerHTML=_2aa;_4.attr(this.containerNode,"colSpan",_2aa?"1":"2");this._set("accelKey",_2aa);}});}if(!_4._hasResource["dijit.PopupMenuItem"]){_4._hasResource["dijit.PopupMenuItem"]=true;_4.provide("dijit.PopupMenuItem");_4.declare("dijit.PopupMenuItem",_5.MenuItem,{_fillContent:function(){if(this.srcNodeRef){var _2ab=_4.query("*",this.srcNodeRef);_5.PopupMenuItem.superclass._fillContent.call(this,_2ab[0]);this.dropDownContainer=this.srcNodeRef;}},startup:function(){if(this._started){return;}this.inherited(arguments);if(!this.popup){var node=_4.query("[widgetId]",this.dropDownContainer)[0];this.popup=_5.byNode(node);}_4.body().appendChild(this.popup.domNode);this.popup.startup();this.popup.domNode.style.display="none";if(this.arrowWrapper){_4.style(this.arrowWrapper,"visibility","");}_5.setWaiState(this.focusNode,"haspopup","true");},destroyDescendants:function(){if(this.popup){if(!this.popup._destroyed){this.popup.destroyRecursive();}delete this.popup;}this.inherited(arguments);}});}if(!_4._hasResource["dijit.CheckedMenuItem"]){_4._hasResource["dijit.CheckedMenuItem"]=true;_4.provide("dijit.CheckedMenuItem");_4.declare("dijit.CheckedMenuItem",_5.MenuItem,{templateString:_4.cache("dijit","templates/CheckedMenuItem.html","<tr class=\"dijitReset dijitMenuItem\" dojoAttachPoint=\"focusNode\" role=\"menuitemcheckbox\" tabIndex=\"-1\"\r\n\t\tdojoAttachEvent=\"onmouseenter:_onHover,onmouseleave:_onUnhover,ondijitclick:_onClick\">\r\n\t<td class=\"dijitReset dijitMenuItemIconCell\" role=\"presentation\">\r\n\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitMenuItemIcon dijitCheckedMenuItemIcon\" dojoAttachPoint=\"iconNode\"/>\r\n\t\t<span class=\"dijitCheckedMenuItemIconChar\">&#10003;</span>\r\n\t</td>\r\n\t<td class=\"dijitReset dijitMenuItemLabel\" colspan=\"2\" dojoAttachPoint=\"containerNode,labelNode\"></td>\r\n\t<td class=\"dijitReset dijitMenuItemAccelKey\" style=\"display: none\" dojoAttachPoint=\"accelKeyNode\"></td>\r\n\t<td class=\"dijitReset dijitMenuArrowCell\" role=\"presentation\">&nbsp;</td>\r\n</tr>\r\n"),checked:false,_setCheckedAttr:function(_2ac){_4.toggleClass(this.domNode,"dijitCheckedMenuItemChecked",_2ac);_5.setWaiState(this.domNode,"checked",_2ac);this._set("checked",_2ac);},onChange:function(_2ad){},_onClick:function(e){if(!this.disabled){this.set("checked",!this.checked);this.onChange(this.checked);}this.inherited(arguments);}});}if(!_4._hasResource["dijit.MenuSeparator"]){_4._hasResource["dijit.MenuSeparator"]=true;_4.provide("dijit.MenuSeparator");_4.declare("dijit.MenuSeparator",[_5._Widget,_5._Templated,_5._Contained],{templateString:_4.cache("dijit","templates/MenuSeparator.html","<tr class=\"dijitMenuSeparator\">\r\n\t<td class=\"dijitMenuSeparatorIconCell\">\r\n\t\t<div class=\"dijitMenuSeparatorTop\"></div>\r\n\t\t<div class=\"dijitMenuSeparatorBottom\"></div>\r\n\t</td>\r\n\t<td colspan=\"3\" class=\"dijitMenuSeparatorLabelCell\">\r\n\t\t<div class=\"dijitMenuSeparatorTop dijitMenuSeparatorLabel\"></div>\r\n\t\t<div class=\"dijitMenuSeparatorBottom\"></div>\r\n\t</td>\r\n</tr>\r\n"),buildRendering:function(){this.inherited(arguments);_4.setSelectable(this.domNode,false);},isFocusable:function(){return false;}});}if(!_4._hasResource["dijit.Menu"]){_4._hasResource["dijit.Menu"]=true;_4.provide("dijit.Menu");_4.declare("dijit._MenuBase",[_5._Widget,_5._Templated,_5._KeyNavContainer],{parentMenu:null,popupDelay:500,startup:function(){if(this._started){return;}_4.forEach(this.getChildren(),function(_2ae){_2ae.startup();});this.startupKeyNavChildren();this.inherited(arguments);},onExecute:function(){},onCancel:function(_2af){},_moveToPopup:function(evt){if(this.focusedChild&&this.focusedChild.popup&&!this.focusedChild.disabled){this.focusedChild._onClick(evt);}else{var _2b0=this._getTopMenu();if(_2b0&&_2b0._isMenuBar){_2b0.focusNext();}}},_onPopupHover:function(evt){if(this.currentPopup&&this.currentPopup._pendingClose_timer){var _2b1=this.currentPopup.parentMenu;if(_2b1.focusedChild){_2b1.focusedChild._setSelected(false);}_2b1.focusedChild=this.currentPopup.from_item;_2b1.focusedChild._setSelected(true);this._stopPendingCloseTimer(this.currentPopup);}},onItemHover:function(item){if(this.isActive){this.focusChild(item);if(this.focusedChild.popup&&!this.focusedChild.disabled&&!this.hover_timer){this.hover_timer=setTimeout(_4.hitch(this,"_openPopup"),this.popupDelay);}}if(this.focusedChild){this.focusChild(item);}this._hoveredChild=item;},_onChildBlur:function(item){this._stopPopupTimer();item._setSelected(false);var _2b2=item.popup;if(_2b2){this._stopPendingCloseTimer(_2b2);_2b2._pendingClose_timer=setTimeout(function(){_2b2._pendingClose_timer=null;if(_2b2.parentMenu){_2b2.parentMenu.currentPopup=null;}_5.popup.close(_2b2);},this.popupDelay);}},onItemUnhover:function(item){if(this.isActive){this._stopPopupTimer();}if(this._hoveredChild==item){this._hoveredChild=null;}},_stopPopupTimer:function(){if(this.hover_timer){clearTimeout(this.hover_timer);this.hover_timer=null;}},_stopPendingCloseTimer:function(_2b3){if(_2b3._pendingClose_timer){clearTimeout(_2b3._pendingClose_timer);_2b3._pendingClose_timer=null;}},_stopFocusTimer:function(){if(this._focus_timer){clearTimeout(this._focus_timer);this._focus_timer=null;}},_getTopMenu:function(){for(var top=this;top.parentMenu;top=top.parentMenu){}return top;},onItemClick:function(item,evt){if(typeof this.isShowingNow=="undefined"){this._markActive();}this.focusChild(item);if(item.disabled){return false;}if(item.popup){this._openPopup();}else{this.onExecute();item.onClick(evt);}},_openPopup:function(){this._stopPopupTimer();var _2b4=this.focusedChild;if(!_2b4){return;}var _2b5=_2b4.popup;if(_2b5.isShowingNow){return;}if(this.currentPopup){this._stopPendingCloseTimer(this.currentPopup);_5.popup.close(this.currentPopup);}_2b5.parentMenu=this;_2b5.from_item=_2b4;var self=this;_5.popup.open({parent:this,popup:_2b5,around:_2b4.domNode,orient:this._orient||(this.isLeftToRight()?{"TR":"TL","TL":"TR","BR":"BL","BL":"BR"}:{"TL":"TR","TR":"TL","BL":"BR","BR":"BL"}),onCancel:function(){self.focusChild(_2b4);self._cleanUp();_2b4._setSelected(true);self.focusedChild=_2b4;},onExecute:_4.hitch(this,"_cleanUp")});this.currentPopup=_2b5;_2b5.connect(_2b5.domNode,"onmouseenter",_4.hitch(self,"_onPopupHover"));if(_2b5.focus){_2b5._focus_timer=setTimeout(_4.hitch(_2b5,function(){this._focus_timer=null;this.focus();}),0);}},_markActive:function(){this.isActive=true;_4.replaceClass(this.domNode,"dijitMenuActive","dijitMenuPassive");},onOpen:function(e){this.isShowingNow=true;this._markActive();},_markInactive:function(){this.isActive=false;_4.replaceClass(this.domNode,"dijitMenuPassive","dijitMenuActive");},onClose:function(){this._stopFocusTimer();this._markInactive();this.isShowingNow=false;this.parentMenu=null;},_closeChild:function(){this._stopPopupTimer();var _2b6=this.focusedChild&&this.focusedChild.from_item;if(this.currentPopup){if(_5._curFocus&&_4.isDescendant(_5._curFocus,this.currentPopup.domNode)){this.focusedChild.focusNode.focus();}_5.popup.close(this.currentPopup);this.currentPopup=null;}if(this.focusedChild){this.focusedChild._setSelected(false);this.focusedChild._onUnhover();this.focusedChild=null;}},_onItemFocus:function(item){if(this._hoveredChild&&this._hoveredChild!=item){this._hoveredChild._onUnhover();}},_onBlur:function(){this._cleanUp();this.inherited(arguments);},_cleanUp:function(){this._closeChild();if(typeof this.isShowingNow=="undefined"){this._markInactive();}}});_4.declare("dijit.Menu",_5._MenuBase,{constructor:function(){this._bindings=[];},templateString:_4.cache("dijit","templates/Menu.html","<table class=\"dijit dijitMenu dijitMenuPassive dijitReset dijitMenuTable\" role=\"menu\" tabIndex=\"${tabIndex}\" dojoAttachEvent=\"onkeypress:_onKeyPress\" cellspacing=\"0\">\r\n\t<tbody class=\"dijitReset\" dojoAttachPoint=\"containerNode\"></tbody>\r\n</table>\r\n"),baseClass:"dijitMenu",targetNodeIds:[],contextMenuForWindow:false,leftClickToOpen:false,refocus:true,postCreate:function(){if(this.contextMenuForWindow){this.bindDomNode(_4.body());}else{_4.forEach(this.targetNodeIds,this.bindDomNode,this);}var k=_4.keys,l=this.isLeftToRight();this._openSubMenuKey=l?k.RIGHT_ARROW:k.LEFT_ARROW;this._closeSubMenuKey=l?k.LEFT_ARROW:k.RIGHT_ARROW;this.connectKeyNavHandlers([k.UP_ARROW],[k.DOWN_ARROW]);},_onKeyPress:function(evt){if(evt.ctrlKey||evt.altKey){return;}switch(evt.charOrCode){case this._openSubMenuKey:this._moveToPopup(evt);_4.stopEvent(evt);break;case this._closeSubMenuKey:if(this.parentMenu){if(this.parentMenu._isMenuBar){this.parentMenu.focusPrev();}else{this.onCancel(false);}}else{_4.stopEvent(evt);}break;}},_iframeContentWindow:function(_2b7){var win=_4.window.get(this._iframeContentDocument(_2b7))||this._iframeContentDocument(_2b7)["__parent__"]||(_2b7.name&&_4.doc.frames[_2b7.name])||null;return win;},_iframeContentDocument:function(_2b8){var doc=_2b8.contentDocument||(_2b8.contentWindow&&_2b8.contentWindow.document)||(_2b8.name&&_4.doc.frames[_2b8.name]&&_4.doc.frames[_2b8.name].document)||null;return doc;},bindDomNode:function(node){node=_4.byId(node);var cn;if(node.tagName.toLowerCase()=="iframe"){var _2b9=node,win=this._iframeContentWindow(_2b9);cn=_4.withGlobal(win,_4.body);}else{cn=(node==_4.body()?_4.doc.documentElement:node);}var _2ba={node:node,iframe:_2b9};_4.attr(node,"_dijitMenu"+this.id,this._bindings.push(_2ba));var _2bb=_4.hitch(this,function(cn){return [_4.connect(cn,this.leftClickToOpen?"onclick":"oncontextmenu",this,function(evt){_4.stopEvent(evt);this._scheduleOpen(evt.target,_2b9,{x:evt.pageX,y:evt.pageY});}),_4.connect(cn,"onkeydown",this,function(evt){if(evt.shiftKey&&evt.keyCode==_4.keys.F10){_4.stopEvent(evt);this._scheduleOpen(evt.target,_2b9);}})];});_2ba.connects=cn?_2bb(cn):[];if(_2b9){_2ba.onloadHandler=_4.hitch(this,function(){var win=this._iframeContentWindow(_2b9);cn=_4.withGlobal(win,_4.body);_2ba.connects=_2bb(cn);});if(_2b9.addEventListener){_2b9.addEventListener("load",_2ba.onloadHandler,false);}else{_2b9.attachEvent("onload",_2ba.onloadHandler);}}},unBindDomNode:function(_2bc){var node;try{node=_4.byId(_2bc);}catch(e){return;}var _2bd="_dijitMenu"+this.id;if(node&&_4.hasAttr(node,_2bd)){var bid=_4.attr(node,_2bd)-1,b=this._bindings[bid];_4.forEach(b.connects,_4.disconnect);var _2be=b.iframe;if(_2be){if(_2be.removeEventListener){_2be.removeEventListener("load",b.onloadHandler,false);}else{_2be.detachEvent("onload",b.onloadHandler);}}_4.removeAttr(node,_2bd);delete this._bindings[bid];}},_scheduleOpen:function(_2bf,_2c0,_2c1){if(!this._openTimer){this._openTimer=setTimeout(_4.hitch(this,function(){delete this._openTimer;this._openMyself({target:_2bf,iframe:_2c0,coords:_2c1});}),1);}},_openMyself:function(args){var _2c2=args.target,_2c3=args.iframe,_2c4=args.coords;if(_2c4){if(_2c3){var od=_2c2.ownerDocument,ifc=_4.position(_2c3,true),win=this._iframeContentWindow(_2c3),_2c5=_4.withGlobal(win,"_docScroll",_4);var cs=_4.getComputedStyle(_2c3),tp=_4._toPixelValue,left=(_4.isIE&&_4.isQuirks?0:tp(_2c3,cs.paddingLeft))+(_4.isIE&&_4.isQuirks?tp(_2c3,cs.borderLeftWidth):0),top=(_4.isIE&&_4.isQuirks?0:tp(_2c3,cs.paddingTop))+(_4.isIE&&_4.isQuirks?tp(_2c3,cs.borderTopWidth):0);_2c4.x+=ifc.x+left-_2c5.x;_2c4.y+=ifc.y+top-_2c5.y;}}else{_2c4=_4.position(_2c2,true);_2c4.x+=10;_2c4.y+=10;}var self=this;var _2c6=_5.getFocus(this);function _2c7(){if(self.refocus){_5.focus(_2c6);}_5.popup.close(self);};_5.popup.open({popup:this,x:_2c4.x,y:_2c4.y,onExecute:_2c7,onCancel:_2c7,orient:this.isLeftToRight()?"L":"R"});this.focus();this._onBlur=function(){this.inherited("_onBlur",arguments);_5.popup.close(this);};},uninitialize:function(){_4.forEach(this._bindings,function(b){if(b){this.unBindDomNode(b.node);}},this);this.inherited(arguments);}});}if(!_4._hasResource["esri.toolbars._VertexMover"]){_4._hasResource["esri.toolbars._VertexMover"]=true;_4.provide("esri.toolbars._VertexMover");_4.declare("esri.toolbars.VertexMover",null,{constructor:function(_2c8,_2c9,_2ca,_2cb,_2cc,_2cd,_2ce,_2cf){this.point=_2c8;this.symbol=_2c9;this.relatedGraphic=_2ca;this.segIndex=_2cb;this.ptIndex=_2cc;this.segLength=_2cd;this.editor=_2ce;this.map=_2ce.map;this._scratchGL=_2ce.toolbar._scratchGL;this._placeholder=_2cf||false;this._type=_2ca.geometry.type;this._init();this._enable();},refresh:function(_2d0){if(_2d0||this._needRefresh()){this._disable();this._enable();}},destroy:function(){this._disable();if(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 _2d1=new esri.geometry.Point(this.point.toJson());var _2d2=new esri.Graphic(_2d1,this.symbol);switch(this._type){case "multipoint":_2d2._shape=this.relatedGraphic.getDojoShape().children[this.ptIndex];break;case "polyline":case "polygon":this._scratchGL.add(_2d2);break;}this.graphic=_2d2;},_enable:function(){var _2d3=this.graphic.getDojoShape();if(_2d3){_2d3._hasMover=true;this._moveable=this._getMoveable(_2d3);var node=_2d3.getEventSource();if(node){_4.style(node,"cursor",this.editor.toolbar._cursors[this._placeholder?"move-gv":"move-v"]);}}},_disable:function(){var _2d4=this._moveable;if(_2d4){_4.disconnect(this._startHandle);_4.disconnect(this._firstHandle);_4.disconnect(this._movingHandle);_4.disconnect(this._stopHandle);var _2d5=_2d4.shape;if(_2d5){var node=_2d5.getEventSource();if(node){_4.style(node,"cursor",null);}}_2d4.destroy();this._moveable=null;}},_needRefresh:function(){var _2d6=this.graphic.getDojoShape(),need=false;if(_2d6){switch(this._type){case "multipoint":var _2d7=this.relatedGraphic.getDojoShape();if(_2d7){var _2d8=_2d7.children[this.ptIndex];if(_2d6!==_2d8){_2d6=_2d8;this.graphic._shape=_2d6;need=true;}}break;case "polyline":case "polygon":need=!_2d6._hasMover;break;}}return need;},_getMoveable:function(_2d9){var _2da=new _6.gfx.Moveable(_2d9,_4.isMac&&_4.isFF&&!esri.isTouchEnabled&&{leftButtonOnly:true});this._startHandle=_4.connect(_2da,"onMoveStart",this,this._moveStartHandler);this._firstHandle=_4.connect(_2da,"onFirstMove",this,this._firstMoveHandler);this._movingHandle=_4.connect(_2da,"onMoving",this,this._movingHandler);this._stopHandle=_4.connect(_2da,"onMoveStop",this,this._moveStopHandler);return _2da;},_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(_2db){var map=this.map;if(map.snappingManager){map.snappingManager._setUpSnapping();}_2db.shape.moveToFront();this.constructor.onMoveStart(this);this.editor.toolbar.onVertexMoveStart(this.relatedGraphic,this._getInfo());},_firstMoveHandler:function(_2dc){var _2dd=_2dc.shape;var _2de=this._getControlEdges();var _2df=this._scratchGL._div;var i,_2e0=[],_2e1=_2dc.host.shape._wrapOffsets[0]||0;for(i=0;i<_2de.length;i++){var edge=_2de[i];edge.x1+=_2e1;edge.x2+=_2e1;_2e0.push([_2df.createLine({x1:edge.x1,y1:edge.y1,x2:edge.x2,y2:edge.y2}).setStroke(this.editor._lineStroke),edge.x1,edge.y1,edge.x2,edge.y2]);}_2dd._lines=_2e0;_2dc.shape.moveToFront();this.constructor.onFirstMove(this);this.editor.toolbar.onVertexFirstMove(this.relatedGraphic,this._getInfo());},_movingHandler:function(_2e2){var _2e3=_2e2.shape,tx=_2e3.getTransform();var i,_2e4=_2e3._lines;for(i=0;i<_2e4.length;i++){var line=_2e4[i];line[0].setShape({x1:line[1]+tx.dx,y1:line[2]+tx.dy,x2:line[3],y2:line[4]});}this.editor.toolbar.onVertexMove(this.relatedGraphic,this._getInfo(),tx);},_moveStopHandler:function(_2e5){var _2e6=_2e5.shape,tx=_2e6.getTransform(),map=this.map;var host=this.graphic;var i,_2e7=_2e6._lines;if(_2e7){for(i=0;i<_2e7.length;i++){_2e7[i][0].removeShape();}_2e6._lines=null;}var ph=false,_2e8=true,info=this._getInfo();if(tx&&(tx.dx||tx.dy)){if(this._placeholder){this._placeholder=false;ph=true;}}else{_2e8=false;}var _2e9;if(this.map.snappingManager){_2e9=this.map.snappingManager._snappingPoint;}var _2ea=_2e9||map.toMap(map.toScreen(host.geometry).offset(tx.dx,tx.dy));if(this.map.snappingManager){this.map.snappingManager._killOffSnapping();}_2e6.setTransform(null);host.setGeometry(_2ea);this.constructor.onMoveStop(this,tx);this.editor.toolbar.onVertexMoveStop(this.relatedGraphic,info,tx);if(!_2e8){this.editor.toolbar.onVertexClick(this.relatedGraphic,info);}if(ph){this.editor.toolbar.onVertexAdd(this.relatedGraphic,this._getInfo());}},_getControlEdges:function(){var map=this.map;var _2eb=this.relatedGraphic.geometry;var _2ec=this.segIndex,_2ed=this.ptIndex,_2ee=this.segLength;var _2ef=this._scratchGL._div;var _2f0=_2ef.getTransform();var sdx=_2f0.dx,sdy=_2f0.dy;var pt=map.toScreen(this.graphic.geometry);var x=pt.x-sdx,y=pt.y-sdy;var _2f1=[];var _2f2=this.editor._getControlPoints(this,_2eb,_2ec,_2ed,_2ee);if(_2f2[0]){_2f1.push({x1:x,y1:y,x2:_2f2[0].x-sdx,y2:_2f2[0].y-sdy});}if(_2f2[1]){_2f1.push({x1:x,y1:y,x2:_2f2[1].x-sdx,y2:_2f2[1].y-sdy});}return _2f1;}});_4.mixin(esri.toolbars.VertexMover,{onMoveStart:function(){},onFirstMove:function(){},onMoveStop:function(){}});}if(!_4._hasResource["esri.toolbars._VertexEditor"]){_4._hasResource["esri.toolbars._VertexEditor"]=true;_4.provide("esri.toolbars._VertexEditor");_4.declare("esri.toolbars._GraphicVertexEditor",null,{constructor:function(_2f3,map,_2f4){this.graphic=_2f3;this.map=map;this.toolbar=_2f4;var _2f5=_2f4._options;this._symbol1=_2f5.vertexSymbol;this._symbol2=_2f5.ghostVertexSymbol;var _2f6=_2f5.ghostLineSymbol;this._lineStroke={style:_2f6.style,width:_2f6.width,color:_2f6.color};this._canDel=_2f5.allowDeleteVertices;this._canAdd=_2f5.allowAddVertices;this._addControllers();},destroy:function(){this._removeControllers();},refresh:function(_2f7){if(_2f7){this._removeControllers();this._addControllers();}else{this._refresh(this._vertexMovers);this._refresh(this._mpVertexMovers);}},suspend:function(){if(!this._suspended){this._removeControllers();}this._suspended=true;},resume:function(){if(this._suspended){this._addControllers();}this._suspended=false;},_addControllers:function(){this._firstMoveHandle=_4.connect(esri.toolbars.VertexMover,"onFirstMove",this,this._firstMoveHandler);this._moveStopHandle=_4.connect(esri.toolbars.VertexMover,"onMoveStop",this,this._moveStopHandler);this._vertexMovers=this._add(this._getSegments(this.graphic.geometry),this._symbol1);if(this._canAdd){this._mpVertexMovers=this._add(this._getMidpointSegments(this.graphic.geometry),this._symbol2,true);}var _2f8=this._getGraphicsLayer();this._mouseOverHandle=_4.connect(_2f8,"onMouseOver",this,this._mouseOverHandler);this._mouseOutHandle=_4.connect(_2f8,"onMouseOut",this,this._mouseOutHandler);if(this._canDel){this._ctxMenu=new _5.Menu({style:"font-size: 12px; margin-left: 5px; margin-top: 5px;"});var _2f9=(this._ctxDelete=new _5.MenuItem({label:esri.bundle.toolbars.edit.deleteLabel,iconClass:"vertexDeleteIcon",style:"outline: none;"}));this._deleteHandle=_4.connect(_2f9,"onClick",this,this._deleteHandler);this._ctxMenu.addChild(_2f9);this._ctxMenu.startup();}},_removeControllers:function(){_4.disconnect(this._firstMoveHandle);_4.disconnect(this._moveStopHandle);_4.disconnect(this._mouseOverHandle);_4.disconnect(this._mouseOutHandle);_4.disconnect(this._deleteHandle);if(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(_2fa,_2fb,_2fc){var i,j,_2fd=this.graphic,_2fe=[];for(i=0;i<_2fa.length;i++){var _2ff=_2fa[i],_300=[];for(j=0;j<_2ff.length;j++){_300.push(new esri.toolbars.VertexMover(_2ff[j],_2fb,_2fd,i,j,_2ff.length,this,_2fc));}_2fe.push(_300);}return _2fe;},_remove:function(_301){if(_301){_4.forEach(_301,function(_302){_4.forEach(_302,function(_303){_303.destroy();});});}},_refresh:function(_304){if(_304){_4.forEach(_304,function(_305){_4.forEach(_305,function(_306){_306.refresh();});});}},_isNew:function(_307){return (_4.indexOf(this._vertexMovers[_307.segIndex],_307)===-1)?true:false;},_getGraphicsLayer:function(){return this.toolbar._scratchGL;},_deleteHandler:function(evt){var _308=this._selectedMover,_309=_308.ptIndex;this._updateRelatedGraphic(_308,_308.relatedGraphic,_308.graphic.geometry,_308.segIndex,_308.ptIndex,_308.segLength,false,true);if(this._canAdd){this._deleteMidpoints(_308);}this._deleteVertex(_308);this.toolbar._endOperation("VERTICES");},_mouseOverHandler:function(evt){var _30a=evt.graphic,_30b=this._findMover(_30a);if(_30b){this.toolbar.onVertexMouseOver(this.graphic,_30b._getInfo());if(!_30b._placeholder){this._selectedMover=_30b;if(this._canDel){this._bindCtxNode(_30a.getDojoShape().getNode());}}}},_mouseOutHandler:function(evt){var _30c=evt.graphic,_30d=this._findMover(_30c);if(_30d){this.toolbar.onVertexMouseOut(this.graphic,_30d._getInfo());}},_bindCtxNode:function(node){this._unbindCtxNode();this._ctxDelete.set("disabled",(this._selectedMover.segLength<=this.minLength)?true:false);this._ctxMenu.bindDomNode(node);this._bindNode=node;},_unbindCtxNode:function(){var node=this._bindNode;if(node){this._ctxMenu.unBindDomNode(node);}},_findMover:function(_30e){var i,_30f=[],_310=this._mpVertexMovers;_4.forEach(this._vertexMovers,function(_311){_30f=_30f.concat(_311);});if(_310){_4.forEach(_310,function(_312){_30f=_30f.concat(_312);});}for(i=0;i<_30f.length;i++){var _313=_30f[i];if(_313.graphic===_30e){return _313;}}},_firstMoveHandler:function(_314){if(!this._isNew(_314)&&this._canAdd){this._hideRelatedMidpoints(_314);}this.toolbar._beginOperation("VERTICES");},_moveStopHandler:function(_315,tx){var add=this._isNew(_315);if(!tx||!tx.dx&&!tx.dy){if(!add&&this._canAdd){this._showRelatedMidpoints(_315);}return;}this._updateRelatedGraphic(_315,_315.relatedGraphic,_315.graphic.geometry,_315.segIndex,_315.ptIndex,_315.segLength,add);if(this._canAdd){if(add){this._addMidpoints(_315);}else{this._repositionRelatedMidpoints(_315);this._showRelatedMidpoints(_315);}}this.toolbar._endOperation("VERTICES");},_showRelatedMidpoints:function(_316){var i,_317=this._getAdjacentMidpoints(_316.ptIndex,_316.segLength),_318=this._mpVertexMovers[_316.segIndex];for(i=0;i<_317.length;i++){var mvr=_318[_317[i]];mvr.graphic.show();mvr.refresh();}},_hideRelatedMidpoints:function(_319){var i,_31a=this._getAdjacentMidpoints(_319.ptIndex,_319.segLength),_31b=this._mpVertexMovers[_319.segIndex];for(i=0;i<_31a.length;i++){_31b[_31a[i]].graphic.hide();}},_repositionRelatedMidpoints:function(_31c){var i,_31d=this._getAdjacentMidpoints(_31c.ptIndex,_31c.segLength),_31e=this._mpVertexMovers[_31c.segIndex];for(i=0;i<_31d.length;i++){var _31f=this._getAdjacentVertices(_31d[i],_31c.segLength);var _320=_31c.relatedGraphic.geometry.getPoint(_31c.segIndex,_31f[0]),_321=_31c.relatedGraphic.geometry.getPoint(_31c.segIndex,_31f[1]);var _322=new esri.geometry.Point({x:(_320.x+_321.x)/2,y:(_320.y+_321.y)/2,spatialReference:_320.spatialReference.toJson()});_31e[_31d[i]].graphic.setGeometry(_322);}},_addMidpoints:function(_323){var _324=_323.segIndex,_325=_323.ptIndex,_326=_323.segLength;var _327=_325+1;var i,_328=_326+1;this._mpVertexMovers[_324].splice(_325,1);var _329=this._vertexMovers[_324];for(i=0;i<_327;i++){_329[i].segLength+=1;}for(i=_327;i<_329.length;i++){_329[i].ptIndex+=1;_329[i].segLength+=1;}_323.ptIndex=_327;_323.segLength=_329.length+1;_329.splice(_327,0,_323);_323.graphic.setSymbol(this._symbol1);_329=this._mpVertexMovers[_324];for(i=0;i<_325;i++){_329[i].segLength+=1;}for(i=_325;i<_326-1;i++){_329[i].ptIndex+=1;_329[i].segLength+=1;}var _32a=this._getAdjacentVertices(_325,_328);var _32b=this._getAdjacentVertices(_325+1,_328);var _32c,_32d;_32c=_323.relatedGraphic.geometry.getPoint(_323.segIndex,_32a[0]);_32d=_323.relatedGraphic.geometry.getPoint(_323.segIndex,_32a[1]);var _32e=new esri.geometry.Point({x:(_32c.x+_32d.x)/2,y:(_32c.y+_32d.y)/2,spatialReference:_32c.spatialReference.toJson()});_32c=_323.relatedGraphic.geometry.getPoint(_323.segIndex,_32b[0]);_32d=_323.relatedGraphic.geometry.getPoint(_323.segIndex,_32b[1]);var _32f=new esri.geometry.Point({x:(_32c.x+_32d.x)/2,y:(_32c.y+_32d.y)/2,spatialReference:_32c.spatialReference.toJson()});var mvr1=new esri.toolbars.VertexMover(_32e,this._symbol2,this.graphic,_323.segIndex,_325,_328,this,true);var mvr2=new esri.toolbars.VertexMover(_32f,this._symbol2,this.graphic,_323.segIndex,_325+1,_328,this,true);_329.splice(_325,0,mvr1,mvr2);},_deleteVertex:function(_330){var i,_331=_330.segIndex,_332=_330.ptIndex;var _333=this._vertexMovers[_331];for(i=0;i<_332;i++){_333[i].segLength-=1;}for(i=_332+1;i<_333.length;i++){var mvr=_333[i];mvr.ptIndex-=1;mvr.segLength-=1;}_333.splice(_332,1);var info=_330._getInfo();_330.destroy();this.toolbar.onVertexDelete(this.graphic,info);}});_4.mixin(esri.toolbars._GraphicVertexEditor,{create:function(_334,map,_335){var type=_334.geometry.type;switch(type){case "multipoint":return new esri.toolbars._MultipointVertexEditor(_334,map,_335);break;case "polyline":return new esri.toolbars._PolylineVertexEditor(_334,map,_335);break;case "polygon":return new esri.toolbars._PolygonVertexEditor(_334,map,_335);break;}}});_4.declare("esri.toolbars._MultipointVertexEditor",esri.toolbars._GraphicVertexEditor,{minLength:1,constructor:function(){this._moveStartHandle=_4.connect(esri.toolbars.VertexMover,"onMoveStart",this,this._moveStartHandler);_4.disconnect(this._firstMoveHandle);},destroy:function(){this.inherited(arguments);_4.disconnect(this._moveStartHandle);},_getSegments:function(_336){var i,_337=_336.points,_338=[],sr=_336.spatialReference;for(i=0;i<_337.length;i++){var _339=_337[i];_338.push(new esri.geometry.Point({x:_339[0],y:_339[1],spatialReference:sr.toJson()}));}return [_338];},_getMidpointSegments:function(_33a){return [];},_getControlPoints:function(_33b,_33c,_33d,_33e,_33f){return [];},_getGraphicsLayer:function(){return this.graphic._graphicsLayer;},_mouseOverHandler:function(evt){var _340=evt.graphic,_341=this._findMover(evt);if(_341){this.toolbar.onVertexMouseOver(_340,_341._getInfo());this._selectedMover=_341;if(this._canDel){this._bindCtxNode(_341.graphic.getDojoShape().getNode());}}},_mouseOutHandler:function(evt){var _342=evt.graphic,_343=this._findMover(evt);if(_343){this.toolbar.onVertexMouseOut(_342,_343._getInfo());}},_findMover:function(evt){var i,_344=[].concat(this._vertexMovers[0]),_345=evt.target;for(i=0;i<_344.length;i++){var _346=_344[i];if(_346.graphic.getDojoShape().getNode()===_345){return _346;}}},_moveStartHandler:function(_347){var geom=_347.relatedGraphic.geometry,_348=_347.ptIndex;var _349=_347.segLength-1;var _34a=geom.points;var _34b=_34a.splice(_348,1);_34a.push(_34b[0]);var j,_34c=this._vertexMovers[0];for(j=_349;j>_348;j--){_34c[j].ptIndex-=1;}_34b=_34c.splice(_348,1);_34c.push(_34b[0]);_34b[0].ptIndex=_349;},_moveStopHandler:function(_34d){this._updateRelatedGraphic(_34d,_34d.relatedGraphic,_34d.graphic.geometry,_34d.segIndex,_34d.ptIndex,_34d.segLength);this.toolbar._endOperation("VERTICES");},_updateRelatedGraphic:function(_34e,_34f,_350,_351,_352,_353,add,del){var geom=_34f.geometry;if(del){geom.removePoint(_352);}else{geom.setPoint(_352,_350);}_34f.setGeometry(geom);},_deleteMidpoints:function(_354){}});_4.declare("esri.toolbars._PolylineVertexEditor",esri.toolbars._GraphicVertexEditor,{minLength:2,_getSegments:function(_355){var i,j,_356=_355.paths,_357=[];for(i=0;i<_356.length;i++){var path=_356[i],_358=[];for(j=0;j<path.length;j++){_358.push(_355.getPoint(i,j));}_357.push(_358);}return _357;},_getMidpointSegments:function(_359){var i,j,_35a=_359.paths,_35b=[],sr=_359.spatialReference;for(i=0;i<_35a.length;i++){var path=_35a[i],_35c=[];for(j=0;j<path.length-1;j++){var _35d=_359.getPoint(i,j),_35e=_359.getPoint(i,j+1);var midX=(_35d.x+_35e.x)/2,midY=(_35d.y+_35e.y)/2;var _35f=new esri.geometry.Point({x:midX,y:midY,spatialReference:sr.toJson()});_35c.push(_35f);}_35b.push(_35c);}return _35b;},_getControlPoints:function(_360,_361,_362,_363,_364){var map=this.map,idx1,idx2,pt1,pt2;if(this._isNew(_360)){idx1=_363;idx2=_363+1;if(idx1>=0){pt1=map.toScreen(_361.getPoint(_362,idx1));}if(idx2<=_364){pt2=map.toScreen(_361.getPoint(_362,idx2));}}else{idx1=_363-1;idx2=_363+1;if(idx1>=0){pt1=map.toScreen(_361.getPoint(_362,idx1));}if(idx2<_364){pt2=map.toScreen(_361.getPoint(_362,idx2));}}return [pt1,pt2];},_getAdjacentMidpoints:function(_365,_366){var _367=[];var idx1=_365-1;if(idx1>=0){_367.push(idx1);}var idx2=_365;if(idx2<_366-1){_367.push(idx2);}return _367;},_getAdjacentVertices:function(_368,_369){return [_368,_368+1];},_deleteMidpoints:function(_36a){var _36b=_36a.segIndex,_36c=_36a.ptIndex,_36d=_36a.segLength;var _36e=this._mpVertexMovers[_36b],_36f=_36e.length-1;var _370=this._getAdjacentMidpoints(_36c,_36d).sort();var i,min=_370[0];for(i=0;i<min;i++){_36e[i].segLength-=1;}for(i=min+1;i<_36e.length;i++){var mvr=_36e[i];mvr.ptIndex-=1;mvr.segLength-=1;}if(_370.length===1){_36e.splice(min,1)[0].destroy();}else{var _371=this._getAdjacentVertices(min,_36f);var _372=_36a.relatedGraphic.geometry.getPoint(_36a.segIndex,_371[0]);var _373=_36a.relatedGraphic.geometry.getPoint(_36a.segIndex,_371[1]);var _374=new esri.geometry.Point({x:(_372.x+_373.x)/2,y:(_372.y+_373.y)/2,spatialReference:_372.spatialReference.toJson()});var mvr1=new esri.toolbars.VertexMover(_374,this._symbol2,this.graphic,_36a.segIndex,min,_36f,this,true);var _375=_36e.splice(min,_370.length,mvr1);for(i=0;i<_375.length;i++){_375[i].destroy();}}},_updateRelatedGraphic:function(_376,_377,_378,_379,_37a,_37b,add,del){var geom=_377.geometry;if(add){geom.insertPoint(_379,_37a+1,esri.geometry.fromJson(_378.toJson()));}else{if(del){geom.removePoint(_379,_37a);}else{geom.setPoint(_379,_37a,esri.geometry.fromJson(_378.toJson()));}}_377.setGeometry(geom);}});_4.declare("esri.toolbars._PolygonVertexEditor",esri.toolbars._GraphicVertexEditor,{minLength:3,_getSegments:function(_37c){var i,j,_37d=_37c.rings,_37e=[];for(i=0;i<_37d.length;i++){var ring=_37d[i],_37f=[];for(j=0;j<ring.length-1;j++){_37f.push(_37c.getPoint(i,j));}_37e.push(_37f);}return _37e;},_getMidpointSegments:function(_380){var i,j,_381=_380.rings,_382=[],sr=_380.spatialReference;for(i=0;i<_381.length;i++){var ring=_381[i],_383=[];for(j=0;j<ring.length-1;j++){var _384=_380.getPoint(i,j),_385=_380.getPoint(i,j+1);var midX=(_384.x+_385.x)/2,midY=(_384.y+_385.y)/2;var _386=new esri.geometry.Point({x:midX,y:midY,spatialReference:sr.toJson()});_383.push(_386);}_382.push(_383);}return _382;},_getControlPoints:function(_387,_388,_389,_38a,_38b){var map=this.map,idx1,idx2,pt1,pt2;if(this._isNew(_387)){idx1=_38a;idx2=(_38a+1)%_38b;}else{idx1=_38a-1;idx1=idx1<0?(_38b+idx1)%_38b:idx1;idx2=(_38a+1)%_38b;}pt1=map.toScreen(_388.getPoint(_389,idx1));pt2=map.toScreen(_388.getPoint(_389,idx2));return [pt1,pt2];},_getAdjacentMidpoints:function(_38c,_38d){var idx1=_38c-1;idx1=idx1<0?(_38d+idx1)%_38d:idx1;var idx2=_38c;return [idx1,idx2];},_getAdjacentVertices:function(_38e,_38f){return [_38e,(_38e+1)%_38f];},_deleteMidpoints:function(_390){var _391=_390.segIndex,_392=_390.ptIndex,_393=_390.segLength;var _394=this._mpVertexMovers[_391],_395=_394.length-1,_396=this._getAdjacentMidpoints(_392,_393).sort(),_397,_398,_399,_39a,i,mvr1,mvr,min=_396[0],max=_396[_396.length-1];if(_392===0){_397=this._getAdjacentVertices(_395-1,_395);_398=_390.relatedGraphic.geometry.getPoint(_390.segIndex,_397[0]);_399=_390.relatedGraphic.geometry.getPoint(_390.segIndex,_397[1]);_39a=new esri.geometry.Point({x:(_398.x+_399.x)/2,y:(_398.y+_399.y)/2,spatialReference:_398.spatialReference.toJson()});mvr1=new esri.toolbars.VertexMover(_39a,this._symbol2,this.graphic,_390.segIndex,_395-1,_395,this,true);_394.splice(max,1,mvr1)[0].destroy();_394.splice(min,1)[0].destroy();for(i=0;i<_394.length-1;i++){mvr=_394[i];mvr.ptIndex-=1;mvr.segLength-=1;}}else{_397=this._getAdjacentVertices(min,_395);_398=_390.relatedGraphic.geometry.getPoint(_390.segIndex,_397[0]);_399=_390.relatedGraphic.geometry.getPoint(_390.segIndex,_397[1]);_39a=new esri.geometry.Point({x:(_398.x+_399.x)/2,y:(_398.y+_399.y)/2,spatialReference:_398.spatialReference.toJson()});mvr1=new esri.toolbars.VertexMover(_39a,this._symbol2,this.graphic,_390.segIndex,min,_395,this,true);var _39b=_394.splice(min,_396.length,mvr1);for(i=0;i<_39b.length;i++){_39b[i].destroy();}for(i=0;i<min;i++){_394[i].segLength-=1;}for(i=min+1;i<_394.length;i++){mvr=_394[i];mvr.ptIndex-=1;mvr.segLength-=1;}}},_updateRelatedGraphic:function(_39c,_39d,_39e,_39f,_3a0,_3a1,add,del){var geom=_39d.geometry;if(add){geom.insertPoint(_39f,_3a0+1,esri.geometry.fromJson(_39e.toJson()));}else{if(del){geom.removePoint(_39f,_3a0);if(_3a0===0){geom.setPoint(_39f,_3a1-1,esri.geometry.fromJson(geom.getPoint(_39f,0).toJson()));}}else{geom.setPoint(_39f,_3a0,esri.geometry.fromJson(_39e.toJson()));if(_3a0===0){geom.setPoint(_39f,_3a1,esri.geometry.fromJson(_39e.toJson()));}}}_39d.setGeometry(geom);}});}if(!_4._hasResource["esri.toolbars._Box"]){_4._hasResource["esri.toolbars._Box"]=true;_4.provide("esri.toolbars._Box");_4.declare("esri.toolbars._Box",null,{constructor:function(_3a2,map,_3a3,_3a4,_3a5){this._graphic=_3a2;this._map=map;this._toolbar=_3a3;this._scale=_3a4;this._rotate=_3a5;this._defaultEventArgs={};this._scaleEvent="Scale";this._rotateEvent="Rotate";var _3a6=_3a3._options;this._markerSymbol=_3a6.boxHandleSymbol;this._lineSymbol=_3a6.boxLineSymbol;this._moveStartHandler=_4.hitch(this,this._moveStartHandler);this._firstMoveHandler=_4.hitch(this,this._firstMoveHandler);this._moveStopHandler=_4.hitch(this,this._moveStopHandler);this._moveHandler=_4.hitch(this,this._moveHandler);this._init();},destroy:function(){this._cleanUp();this._graphic=this._map=this._toolbar=this._markerSymbol=this._lineSymbol=null;},refresh:function(){this._draw();},suspend:function(){_4.forEach(this._getAllGraphics(),function(g){g.hide();});},resume:function(){_4.forEach(this._getAllGraphics(),function(g){g.show();});this._draw();},_init:function(){this._draw();},_cleanUp:function(){if(this._connects){_4.forEach(this._connects,_4.disconnect,_4);}var _3a7=this._toolbar._scratchGL;if(this._anchors){_4.forEach(this._anchors,function(info){_3a7.remove(info.graphic);var mov=info.moveable;if(mov){mov.destroy();}});}if(this._box){_3a7.remove(this._box);}this._box=this._anchors=this._connects=null;},_draw:function(){if(!this._graphic.getDojoShape()){this._cleanUp();return;}var map=this._map,_3a8=this._toolbar._scratchGL;var _3a9=this._getBoxCoords();var _3aa=new esri.geometry.Polyline(map.spatialReference);var path=_4.clone(_4.filter(_3a9,function(pt,_3ab){return (_3ab!==8&&_3ab%2===0);}));if(path[0]){path.push([path[0][0],path[0][1]]);}_3aa.addPath(path);if(this._rotate){_3aa.addPath([_3a9[1],_3a9[8]]);}if(this._box){this._box.setGeometry(_3aa);}else{this._box=new esri.Graphic(_3aa,this._lineSymbol);_3a8.add(this._box);}if(this._anchors){_4.forEach(this._anchors,function(info,_3ac){if(!this._scale){_3ac=8;}var _3ad=new esri.geometry.Point(_3a9[_3ac],map.spatialReference);info.graphic.setGeometry(_3ad);var mov=info.moveable,_3ae=info.graphic.getDojoShape();if(_3ae){if(!mov){info.moveable=this._getMoveable(info.graphic,_3ac);}else{if(_3ae!==mov.shape){mov.destroy();info.moveable=this._getMoveable(info.graphic,_3ac);}}}},this);}else{this._anchors=[];this._connects=[];_4.forEach(_3a9,function(_3af,_3b0){if(!this._scale&&_3b0<8){return;}_3af=new esri.geometry.Point(_3af,map.spatialReference);var _3b1=new esri.Graphic(_3af,this._markerSymbol);_3a8.add(_3b1);this._anchors.push({graphic:_3b1,moveable:this._getMoveable(_3b1,_3b0)});},this);}},_getBoxCoords:function(_3b2){var _3b3=this._graphic,map=this._map,bbox=this._getTransformedBoundingBox(_3b3),_3b4=[],pt,next,_3b5;_4.forEach(bbox,function(_3b6,_3b7,arr){pt=_3b6;next=arr[_3b7+1];if(!next){next=arr[0];}_3b5={x:(pt.x+next.x)/2,y:(pt.y+next.y)/2};if(!_3b2){pt=map.toMap(pt);_3b5=map.toMap(_3b5);}_3b4.push([pt.x,pt.y]);_3b4.push([_3b5.x,_3b5.y]);});if(this._rotate){var _3b8=_4.clone(_3b4[1]);_3b8=_3b2?{x:_3b8[0],y:_3b8[1]}:map.toScreen({x:_3b8[0],y:_3b8[1]});_3b8.y-=this._toolbar._options.rotateHandleOffset;if(!_3b2){_3b8=map.toMap(_3b8);}_3b4.push([_3b8.x,_3b8.y]);}return _3b4;},_getTransformedBoundingBox:function(_3b9){var map=this._map;var _3ba=_3b9.geometry.getExtent();var _3bb=new esri.geometry.Point(_3ba.xmin,_3ba.ymax);var _3bc=new esri.geometry.Point(_3ba.xmax,_3ba.ymin);_3bb=map.toScreen(_3bb);_3bc=map.toScreen(_3bc);return [{x:_3bb.x,y:_3bb.y},{x:_3bc.x,y:_3bb.y},{x:_3bc.x,y:_3bc.y},{x:_3bb.x,y:_3bc.y}];},_getAllGraphics:function(){var _3bd=[this._box];if(this._anchors){_4.forEach(this._anchors,function(_3be){_3bd.push(_3be.graphic);});}_3bd=_4.filter(_3bd,esri._isDefined);return _3bd;},_getMoveable:function(_3bf,_3c0){var _3c1=_3bf.getDojoShape();if(!_3c1){return;}var _3c2=new _6.gfx.Moveable(_3c1);_3c2._index=_3c0;this._connects.push(_4.connect(_3c2,"onMoveStart",this._moveStartHandler));this._connects.push(_4.connect(_3c2,"onFirstMove",this._firstMoveHandler));this._connects.push(_4.connect(_3c2,"onMoveStop",this._moveStopHandler));_3c2.onMove=this._moveHandler;var node=_3c1.getEventSource();if(node){_4.style(node,"cursor",this._toolbar._cursors["box"+_3c0]);}return _3c2;},_moveStartHandler:function(_3c3){this._toolbar["on"+(_3c3.host._index===8?this._rotateEvent:this._scaleEvent)+"Start"](this._graphic);},_firstMoveHandler:function(_3c4){var _3c5=_3c4.host._index,_3c6=(this._wrapOffset=_3c4.host.shape._wrapOffsets[0]||0),_3c7=this._graphic.getLayer()._div.getTransform(),mx=_6.gfx.matrix,_3c8,_3c9,_3ca,_3cb=_4.map(this._getBoxCoords(true),function(arr){return {x:arr[0]+_3c6,y:arr[1]};});if(_3c5===8){_3c8=mx.multiplyPoint(mx.invert(_3c7),_3cb[1]);_3ca={x:_3cb[1].x,y:_3cb[3].y};_3c9=mx.multiplyPoint(mx.invert(_3c7),_3ca);this._startLine=[_3c9,_3c8];this._moveLine=_4.clone(this._startLine);}else{_3c8=mx.multiplyPoint(mx.invert(_3c7),_3cb[_3c5]);_3c9=mx.multiplyPoint(mx.invert(_3c7),_3cb[(_3c5+4)%8]);this._startBox=_3c9;this._startBox.width=(_3cb[4].x-_3cb[0].x);this._startBox.height=(_3cb[4].y-_3cb[0].y);this._moveBox=_4.clone(this._startBox);this._xfactor=_3c8.x>_3c9.x?1:-1;this._yfactor=_3c8.y>_3c9.y?1:-1;if(_3c5===1||_3c5===5){this._xfactor=0;}else{if(_3c5===3||_3c5===7){this._yfactor=0;}}}this._toolbar._beginOperation("BOX");this._toolbar["on"+(_3c5===8?this._rotateEvent:this._scaleEvent)+"FirstMove"](this._graphic);},_moveHandler:function(_3cc,_3cd){var _3ce=_3cc.host._index,args=this._defaultEventArgs,_3cf,move,tx,pt,_3d0,_3d1,_3d2;args.angle=0;args.scaleX=1;args.scaleY=1;if(_3ce===8){_3cf=this._startLine;move=this._moveLine;pt=move[1];pt.x+=_3cd.dx;pt.y+=_3cd.dy;_3d0=this._getAngle(_3cf,move);tx=_6.gfx.matrix.rotategAt(_3d0,_3cf[0]);this._graphic.getDojoShape().setTransform(tx);args.transform=tx;args.angle=_3d0;args.around=_3cf[0];}else{_3cf=this._startBox;move=this._moveBox;move.width+=(_3cd.dx*this._xfactor);move.height+=(_3cd.dy*this._yfactor);_3d1=move.width/_3cf.width;_3d2=move.height/_3cf.height;if(isNaN(_3d1)||_3d1===Infinity||_3d1===-Infinity){_3d1=1;}if(isNaN(_3d2)||_3d2===Infinity||_3d2===-Infinity){_3d2=1;}tx=_6.gfx.matrix.scaleAt(_3d1,_3d2,_3cf);this._graphic.getDojoShape().setTransform(tx);args.transform=tx;args.scaleX=_3d1;args.scaleY=_3d2;args.around=_3cf;}this._toolbar["on"+(_3ce===8?this._rotateEvent:this._scaleEvent)](this._graphic,args);},_moveStopHandler:function(_3d3){var _3d4=this._graphic,_3d5=_3d4.geometry.toJson(),_3d6=_3d4.getDojoShape(),_3d7=_3d6.getTransform(),_3d8=_3d4.getLayer()._div.getTransform();this._updateSegments(_3d5.paths||_3d5.rings,_3d7,_3d8);_3d6.setTransform(null);_3d4.setGeometry(esri.geometry.fromJson(_3d5));this._draw();this._startBox=this._moveBox=this._xfactor=this._yfactor=null;this._startLine=this._moveLine=null;this._toolbar._endOperation("BOX");this._defaultEventArgs.transform=_3d7;this._toolbar["on"+(_3d3.host._index===8?this._rotateEvent:this._scaleEvent)+"Stop"](this._graphic,this._defaultEventArgs);},_updateSegments:function(_3d9,_3da,_3db){var mx=_6.gfx.matrix,map=this._map,_3dc=this._wrapOffset||0;_4.forEach(_3d9,function(_3dd){_4.forEach(_3dd,function(_3de){var _3df=map.toScreen({x:_3de[0],y:_3de[1]},true);_3df.x+=_3dc;_3df=mx.multiplyPoint([_3db,_3da,mx.invert(_3db)],_3df);_3df.x-=_3dc;var _3e0=map.toMap(_3df);_3de[0]=_3e0.x;_3de[1]=_3e0.y;});});},_getAngle:function(_3e1,_3e2){var _3e3=Math.atan2(_3e1[0].y-_3e1[1].y,_3e1[0].x-_3e1[1].x)*180/Math.PI,_3e4=Math.atan2(_3e2[0].y-_3e2[1].y,_3e2[0].x-_3e2[1].x)*180/Math.PI;return _3e4-_3e3;}});}if(!_4._hasResource["esri.toolbars.edit"]){_4._hasResource["esri.toolbars.edit"]=true;_4.provide("esri.toolbars.edit");(function(){var link=document.createElement("link");link.type="text/css";link.rel="stylesheet";link.href=_4.moduleUrl("esri","toolbars/css/edit.css").toString();document.getElementsByTagName("head").item(0).appendChild(link);}());_4.declare("esri.toolbars.Edit",esri.toolbars._Toolbar,{constructor:function(map,_3e5){this._map=map;this._tool=0;this._scratchGL=map.graphics;var _3e6=esri.isTouchEnabled;this._defaultOptions=_4.mixin({vertexSymbol:new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE,_3e6?20:12,new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new _4.Color([0,0,0,0.5]),1),new _4.Color([128,128,128])),ghostVertexSymbol:new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE,_3e6?18:10,new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new _4.Color([0,0,0,0.5]),1),new _4.Color([255,255,255,0.75])),ghostLineSymbol:new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DOT,new _4.Color([128,128,128]),2),allowDeleteVertices:true,allowAddVertices:true,rotateHandleOffset:_3e6?24:16,boxLineSymbol:new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH,new _4.Color([64,64,64]),1),boxHandleSymbol:new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE,_3e6?16:9,new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new _4.Color([0,0,0,0.5]),1),new _4.Color([255,255,255,0.75]))},_3e5||{});},activate:function(tool,_3e7,_3e8){this.deactivate();this._graphic=_3e7;this._options=_4.mixin(_4.mixin({},this._defaultOptions),_3e8||{});var MOVE=esri.toolbars.Edit.MOVE,EDIT=esri.toolbars.Edit.EDIT_VERTICES;var _3e9=esri.toolbars.Edit.SCALE,_3ea=esri.toolbars.Edit.ROTATE;var move=false,edit=false,box=false;if((tool&MOVE)===MOVE){move=this._enableMove(_3e7);}var _3eb=((tool&_3e9)===_3e9),_3ec=((tool&_3ea)===_3ea);if(_3eb||_3ec){box=this._enableBoxEditing(_3e7,_3eb,_3ec);}if((tool&EDIT)===EDIT){edit=this._enableVertexEditing(_3e7);}if(!(move||edit||box)){throw new Error("[esri.toolbars.Edit::activate] "+esri.bundle.toolbars.edit.invalidType);}this._tool=tool;var map=this._map;if(this._tool){this._mapPanEndHandle=_4.connect(map,"onPanEnd",this,this._mapPanEndHandler);this._mapExtChgHandle=_4.connect(map,"onExtentChange",this,this._mapExtentChangeHandler);this.onActivate(this._tool,_3e7);}if(map.snappingManager&&(move||edit)){map.snappingManager._startSelectionLayerQuery();}},deactivate:function(){var tool=this._tool,_3ed=this._graphic;if(!tool){return;}var _3ee=!!this._modified;this._clear();_4.disconnect(this._mapPanEndHandle);_4.disconnect(this._mapExtChgHandle);this._graphic=null;this.onDeactivate(tool,_3ed,{isModified:_3ee});if(this._map.snappingManager){this._map.snappingManager._stopSelectionLayerQuery();}},refresh:function(){this._refreshMoveables(true);},getCurrentState:function(){return {tool:this._tool,graphic:this._graphic,isModified:!!this._modified};},onActivate:function(tool,_3ef){},onDeactivate:function(tool,_3f0,info){},onGraphicMoveStart:function(_3f1){},onGraphicFirstMove:function(_3f2){this._modified=true;},onGraphicMove:function(_3f3,_3f4){},onGraphicMoveStop:function(_3f5,_3f6){},onGraphicClick:function(_3f7,info){},onVertexMoveStart:function(_3f8,_3f9){},onVertexFirstMove:function(_3fa,_3fb){this._modified=true;},onVertexMove:function(_3fc,_3fd,_3fe){},onVertexMoveStop:function(_3ff,_400,_401){},onVertexAdd:function(_402,_403){this._modified=true;},onVertexClick:function(_404,_405){},onVertexMouseOver:function(_406,_407){},onVertexMouseOut:function(_408,_409){},onVertexDelete:function(_40a,_40b){this._modified=true;},onScaleStart:function(_40c){},onScaleFirstMove:function(_40d){this._modified=true;},onScale:function(_40e,info){},onScaleStop:function(_40f,info){},onRotateStart:function(_410){},onRotateFirstMove:function(_411){this._modified=true;},onRotate:function(_412,info){},onRotateStop:function(_413,info){},_enableMove:function(_414){var map=this._map,type=_414.geometry.type;switch(type){case "point":case "polyline":case "polygon":this._graphicMover=new esri.toolbars._GraphicMover(_414,map,this);return true;case "multipoint":break;}return false;},_enableVertexEditing:function(_415){var map=this._map,type=_415.geometry.type;switch(type){case "point":break;case "multipoint":case "polyline":case "polygon":this._vertexEditor=esri.toolbars._GraphicVertexEditor.create(_415,map,this);return true;}return false;},_enableBoxEditing:function(_416,_417,_418){var map=this._map,type=_416.geometry.type;switch(type){case "point":case "multipoint":break;case "polyline":case "polygon":this._boxEditor=new esri.toolbars._Box(_416,map,this,_417,_418);return true;}return false;},_disableMove:function(){var _419=this._graphicMover;if(_419){_419.destroy();this._graphicMover=null;}},_disableVertexEditing:function(){var _41a=this._vertexEditor;if(_41a){_41a.destroy();this._vertexEditor=null;}},_disableBoxEditing:function(){var box=this._boxEditor;if(box){box.destroy();this._boxEditor=null;}},_clear:function(){this._disableMove();this._disableVertexEditing();this._disableBoxEditing();this._tool=0;this._modified=false;},_mapPanEndHandler:function(){this._refreshMoveables();},_mapExtentChangeHandler:function(e,d,_41b){if(_41b){this._refreshMoveables();}},_refreshMoveables:function(_41c){var _41d=_4.filter([this._graphicMover,this._vertexEditor,this._boxEditor],esri._isDefined);_4.forEach(_41d,function(mov){mov.refresh(_41c);});},_beginOperation:function(_41e){_4.forEach(this._getAffectedTools(_41e),function(tool){tool.suspend();});},_endOperation:function(_41f){_4.forEach(this._getAffectedTools(_41f),function(tool){tool.resume();});},_getAffectedTools:function(_420){var _421=[];switch(_420){case "MOVE":_421=[this._vertexEditor,this._boxEditor];break;case "VERTICES":_421=[this._boxEditor];break;case "BOX":_421=[this._vertexEditor];break;}_421=_4.filter(_421,esri._isDefined);return _421;}});_4.mixin(esri.toolbars.Edit,{MOVE:1,EDIT_VERTICES:2,SCALE:4,ROTATE:8});}if(!_4._hasResource["dojo.data.util.filter"]){_4._hasResource["dojo.data.util.filter"]=true;_4.provide("dojo.data.util.filter");_4.getObject("data.util.filter",true,_4);_4.data.util.filter.patternToRegExp=function(_422,_423){var rxp="^";var c=null;for(var i=0;i<_422.length;i++){c=_422.charAt(i);switch(c){case "\\":rxp+=c;i++;rxp+=_422.charAt(i);break;case "*":rxp+=".*";break;case "?":rxp+=".";break;case "$":case "^":case "/":case "+":case ".":case "|":case "(":case ")":case "{":case "}":case "[":case "]":rxp+="\\";default:rxp+=c;}}rxp+="$";if(_423){return new RegExp(rxp,"mi");}else{return new RegExp(rxp,"m");}};}if(!_4._hasResource["dojo.data.util.sorter"]){_4._hasResource["dojo.data.util.sorter"]=true;_4.provide("dojo.data.util.sorter");_4.getObject("data.util.sorter",true,_4);_4.data.util.sorter.basicComparator=function(a,b){var r=-1;if(a===null){a=undefined;}if(b===null){b=undefined;}if(a==b){r=0;}else{if(a>b||a==null){r=1;}}return r;};_4.data.util.sorter.createSortFunction=function(_424,_425){var _426=[];function _427(attr,dir,comp,s){return function(_428,_429){var a=s.getValue(_428,attr);var b=s.getValue(_429,attr);return dir*comp(a,b);};};var _42a;var map=_425.comparatorMap;var bc=_4.data.util.sorter.basicComparator;for(var i=0;i<_424.length;i++){_42a=_424[i];var attr=_42a.attribute;if(attr){var dir=(_42a.descending)?-1:1;var comp=bc;if(map){if(typeof attr!=="string"&&("toString" in attr)){attr=attr.toString();}comp=map[attr]||bc;}_426.push(_427(attr,dir,comp,_425));}}return function(rowA,rowB){var i=0;while(i<_426.length){var ret=_426[i++](rowA,rowB);if(ret!==0){return ret;}}return 0;};};}if(!_4._hasResource["dojo.data.util.simpleFetch"]){_4._hasResource["dojo.data.util.simpleFetch"]=true;_4.provide("dojo.data.util.simpleFetch");_4.getObject("data.util.simpleFetch",true,_4);_4.data.util.simpleFetch.fetch=function(_42b){_42b=_42b||{};if(!_42b.store){_42b.store=this;}var self=this;var _42c=function(_42d,_42e){if(_42e.onError){var _42f=_42e.scope||_4.global;_42e.onError.call(_42f,_42d,_42e);}};var _430=function(_431,_432){var _433=_432.abort||null;var _434=false;var _435=_432.start?_432.start:0;var _436=(_432.count&&(_432.count!==Infinity))?(_435+_432.count):_431.length;_432.abort=function(){_434=true;if(_433){_433.call(_432);}};var _437=_432.scope||_4.global;if(!_432.store){_432.store=self;}if(_432.onBegin){_432.onBegin.call(_437,_431.length,_432);}if(_432.sort){_431.sort(_4.data.util.sorter.createSortFunction(_432.sort,self));}if(_432.onItem){for(var i=_435;(i<_431.length)&&(i<_436);++i){var item=_431[i];if(!_434){_432.onItem.call(_437,item,_432);}}}if(_432.onComplete&&!_434){var _438=null;if(!_432.onItem){_438=_431.slice(_435,_436);}_432.onComplete.call(_437,_438,_432);}};this._fetchItems(_42b,_430,_42c);return _42b;};}if(!_4._hasResource["dojo.data.ItemFileReadStore"]){_4._hasResource["dojo.data.ItemFileReadStore"]=true;_4.provide("dojo.data.ItemFileReadStore");_4.declare("dojo.data.ItemFileReadStore",null,{constructor:function(_439){this._arrayOfAllItems=[];this._arrayOfTopLevelItems=[];this._loadFinished=false;this._jsonFileUrl=_439.url;this._ccUrl=_439.url;this.url=_439.url;this._jsonData=_439.data;this.data=null;this._datatypeMap=_439.typeMap||{};if(!this._datatypeMap["Date"]){this._datatypeMap["Date"]={type:Date,deserialize:function(_43a){return _4.date.stamp.fromISOString(_43a);}};}this._features={"dojo.data.api.Read":true,"dojo.data.api.Identity":true};this._itemsByIdentity=null;this._storeRefPropName="_S";this._itemNumPropName="_0";this._rootItemPropName="_RI";this._reverseRefMap="_RRM";this._loadInProgress=false;this._queuedFetches=[];if(_439.urlPreventCache!==undefined){this.urlPreventCache=_439.urlPreventCache?true:false;}if(_439.hierarchical!==undefined){this.hierarchical=_439.hierarchical?true:false;}if(_439.clearOnClose){this.clearOnClose=true;}if("failOk" in _439){this.failOk=_439.failOk?true:false;}},url:"",_ccUrl:"",data:null,typeMap:null,clearOnClose:false,urlPreventCache:false,failOk:false,hierarchical:true,_assertIsItem:function(item){if(!this.isItem(item)){throw new Error("dojo.data.ItemFileReadStore: Invalid item argument.");}},_assertIsAttribute:function(_43b){if(typeof _43b!=="string"){throw new Error("dojo.data.ItemFileReadStore: Invalid attribute argument.");}},getValue:function(item,_43c,_43d){var _43e=this.getValues(item,_43c);return (_43e.length>0)?_43e[0]:_43d;},getValues:function(item,_43f){this._assertIsItem(item);this._assertIsAttribute(_43f);return (item[_43f]||[]).slice(0);},getAttributes:function(item){this._assertIsItem(item);var _440=[];for(var key in item){if((key!==this._storeRefPropName)&&(key!==this._itemNumPropName)&&(key!==this._rootItemPropName)&&(key!==this._reverseRefMap)){_440.push(key);}}return _440;},hasAttribute:function(item,_441){this._assertIsItem(item);this._assertIsAttribute(_441);return (_441 in item);},containsValue:function(item,_442,_443){var _444=undefined;if(typeof _443==="string"){_444=_4.data.util.filter.patternToRegExp(_443,false);}return this._containsValue(item,_442,_443,_444);},_containsValue:function(item,_445,_446,_447){return _4.some(this.getValues(item,_445),function(_448){if(_448!==null&&!_4.isObject(_448)&&_447){if(_448.toString().match(_447)){return true;}}else{if(_446===_448){return true;}}});},isItem:function(_449){if(_449&&_449[this._storeRefPropName]===this){if(this._arrayOfAllItems[_449[this._itemNumPropName]]===_449){return true;}}return false;},isItemLoaded:function(_44a){return this.isItem(_44a);},loadItem:function(_44b){this._assertIsItem(_44b.item);},getFeatures:function(){return this._features;},getLabel:function(item){if(this._labelAttr&&this.isItem(item)){return this.getValue(item,this._labelAttr);}return undefined;},getLabelAttributes:function(item){if(this._labelAttr){return [this._labelAttr];}return null;},_fetchItems:function(_44c,_44d,_44e){var self=this,_44f=function(_450,_451){var _452=[],i,key;if(_450.query){var _453,_454=_450.queryOptions?_450.queryOptions.ignoreCase:false;var _455={};for(key in _450.query){_453=_450.query[key];if(typeof _453==="string"){_455[key]=_4.data.util.filter.patternToRegExp(_453,_454);}else{if(_453 instanceof RegExp){_455[key]=_453;}}}for(i=0;i<_451.length;++i){var _456=true;var _457=_451[i];if(_457===null){_456=false;}else{for(key in _450.query){_453=_450.query[key];if(!self._containsValue(_457,key,_453,_455[key])){_456=false;}}}if(_456){_452.push(_457);}}_44d(_452,_450);}else{for(i=0;i<_451.length;++i){var item=_451[i];if(item!==null){_452.push(item);}}_44d(_452,_450);}};if(this._loadFinished){_44f(_44c,this._getItemsArray(_44c.queryOptions));}else{if(this._jsonFileUrl!==this._ccUrl){_4.deprecated("dojo.data.ItemFileReadStore: ","To change the url, set the url property of the store,"+" not _jsonFileUrl.  _jsonFileUrl support will be removed in 2.0");this._ccUrl=this._jsonFileUrl;this.url=this._jsonFileUrl;}else{if(this.url!==this._ccUrl){this._jsonFileUrl=this.url;this._ccUrl=this.url;}}if(this.data!=null){this._jsonData=this.data;this.data=null;}if(this._jsonFileUrl){if(this._loadInProgress){this._queuedFetches.push({args:_44c,filter:_44f});}else{this._loadInProgress=true;var _458={url:self._jsonFileUrl,handleAs:"json-comment-optional",preventCache:this.urlPreventCache,failOk:this.failOk};var _459=_4.xhrGet(_458);_459.addCallback(function(data){try{self._getItemsFromLoadedData(data);self._loadFinished=true;self._loadInProgress=false;_44f(_44c,self._getItemsArray(_44c.queryOptions));self._handleQueuedFetches();}catch(e){self._loadFinished=true;self._loadInProgress=false;_44e(e,_44c);}});_459.addErrback(function(_45a){self._loadInProgress=false;_44e(_45a,_44c);});var _45b=null;if(_44c.abort){_45b=_44c.abort;}_44c.abort=function(){var df=_459;if(df&&df.fired===-1){df.cancel();df=null;}if(_45b){_45b.call(_44c);}};}}else{if(this._jsonData){try{this._loadFinished=true;this._getItemsFromLoadedData(this._jsonData);this._jsonData=null;_44f(_44c,this._getItemsArray(_44c.queryOptions));}catch(e){_44e(e,_44c);}}else{_44e(new Error("dojo.data.ItemFileReadStore: No JSON source data was provided as either URL or a nested Javascript object."),_44c);}}}},_handleQueuedFetches:function(){if(this._queuedFetches.length>0){for(var i=0;i<this._queuedFetches.length;i++){var _45c=this._queuedFetches[i],_45d=_45c.args,_45e=_45c.filter;if(_45e){_45e(_45d,this._getItemsArray(_45d.queryOptions));}else{this.fetchItemByIdentity(_45d);}}this._queuedFetches=[];}},_getItemsArray:function(_45f){if(_45f&&_45f.deep){return this._arrayOfAllItems;}return this._arrayOfTopLevelItems;},close:function(_460){if(this.clearOnClose&&this._loadFinished&&!this._loadInProgress){if(((this._jsonFileUrl==""||this._jsonFileUrl==null)&&(this.url==""||this.url==null))&&this.data==null){console.debug("dojo.data.ItemFileReadStore: WARNING!  Data reload "+" information has not been provided."+"  Please set 'url' or 'data' to the appropriate value before"+" the next fetch");}this._arrayOfAllItems=[];this._arrayOfTopLevelItems=[];this._loadFinished=false;this._itemsByIdentity=null;this._loadInProgress=false;this._queuedFetches=[];}},_getItemsFromLoadedData:function(_461){var _462=false,self=this;function _463(_464){var _465=((_464!==null)&&(typeof _464==="object")&&(!_4.isArray(_464)||_462)&&(!_4.isFunction(_464))&&(_464.constructor==Object||_4.isArray(_464))&&(typeof _464._reference==="undefined")&&(typeof _464._type==="undefined")&&(typeof _464._value==="undefined")&&self.hierarchical);return _465;};function _466(_467){self._arrayOfAllItems.push(_467);for(var _468 in _467){var _469=_467[_468];if(_469){if(_4.isArray(_469)){var _46a=_469;for(var k=0;k<_46a.length;++k){var _46b=_46a[k];if(_463(_46b)){_466(_46b);}}}else{if(_463(_469)){_466(_469);}}}}};this._labelAttr=_461.label;var i,item;this._arrayOfAllItems=[];this._arrayOfTopLevelItems=_461.items;for(i=0;i<this._arrayOfTopLevelItems.length;++i){item=this._arrayOfTopLevelItems[i];if(_4.isArray(item)){_462=true;}_466(item);item[this._rootItemPropName]=true;}var _46c={},key;for(i=0;i<this._arrayOfAllItems.length;++i){item=this._arrayOfAllItems[i];for(key in item){if(key!==this._rootItemPropName){var _46d=item[key];if(_46d!==null){if(!_4.isArray(_46d)){item[key]=[_46d];}}else{item[key]=[null];}}_46c[key]=key;}}while(_46c[this._storeRefPropName]){this._storeRefPropName+="_";}while(_46c[this._itemNumPropName]){this._itemNumPropName+="_";}while(_46c[this._reverseRefMap]){this._reverseRefMap+="_";}var _46e;var _46f=_461.identifier;if(_46f){this._itemsByIdentity={};this._features["dojo.data.api.Identity"]=_46f;for(i=0;i<this._arrayOfAllItems.length;++i){item=this._arrayOfAllItems[i];_46e=item[_46f];var _470=_46e[0];if(!Object.hasOwnProperty.call(this._itemsByIdentity,_470)){this._itemsByIdentity[_470]=item;}else{if(this._jsonFileUrl){throw new Error("dojo.data.ItemFileReadStore:  The json data as specified by: ["+this._jsonFileUrl+"] is malformed.  Items within the list have identifier: ["+_46f+"].  Value collided: ["+_470+"]");}else{if(this._jsonData){throw new Error("dojo.data.ItemFileReadStore:  The json data provided by the creation arguments is malformed.  Items within the list have identifier: ["+_46f+"].  Value collided: ["+_470+"]");}}}}}else{this._features["dojo.data.api.Identity"]=Number;}for(i=0;i<this._arrayOfAllItems.length;++i){item=this._arrayOfAllItems[i];item[this._storeRefPropName]=this;item[this._itemNumPropName]=i;}for(i=0;i<this._arrayOfAllItems.length;++i){item=this._arrayOfAllItems[i];for(key in item){_46e=item[key];for(var j=0;j<_46e.length;++j){_46d=_46e[j];if(_46d!==null&&typeof _46d=="object"){if(("_type" in _46d)&&("_value" in _46d)){var type=_46d._type;var _471=this._datatypeMap[type];if(!_471){throw new Error("dojo.data.ItemFileReadStore: in the typeMap constructor arg, no object class was specified for the datatype '"+type+"'");}else{if(_4.isFunction(_471)){_46e[j]=new _471(_46d._value);}else{if(_4.isFunction(_471.deserialize)){_46e[j]=_471.deserialize(_46d._value);}else{throw new Error("dojo.data.ItemFileReadStore: Value provided in typeMap was neither a constructor, nor a an object with a deserialize function");}}}}if(_46d._reference){var _472=_46d._reference;if(!_4.isObject(_472)){_46e[j]=this._getItemByIdentity(_472);}else{for(var k=0;k<this._arrayOfAllItems.length;++k){var _473=this._arrayOfAllItems[k],_474=true;for(var _475 in _472){if(_473[_475]!=_472[_475]){_474=false;}}if(_474){_46e[j]=_473;}}}if(this.referenceIntegrity){var _476=_46e[j];if(this.isItem(_476)){this._addReferenceToMap(_476,item,key);}}}else{if(this.isItem(_46d)){if(this.referenceIntegrity){this._addReferenceToMap(_46d,item,key);}}}}}}}},_addReferenceToMap:function(_477,_478,_479){},getIdentity:function(item){var _47a=this._features["dojo.data.api.Identity"];if(_47a===Number){return item[this._itemNumPropName];}else{var _47b=item[_47a];if(_47b){return _47b[0];}}return null;},fetchItemByIdentity:function(_47c){var item,_47d;if(!this._loadFinished){var self=this;if(this._jsonFileUrl!==this._ccUrl){_4.deprecated("dojo.data.ItemFileReadStore: ","To change the url, set the url property of the store,"+" not _jsonFileUrl.  _jsonFileUrl support will be removed in 2.0");this._ccUrl=this._jsonFileUrl;this.url=this._jsonFileUrl;}else{if(this.url!==this._ccUrl){this._jsonFileUrl=this.url;this._ccUrl=this.url;}}if(this.data!=null&&this._jsonData==null){this._jsonData=this.data;this.data=null;}if(this._jsonFileUrl){if(this._loadInProgress){this._queuedFetches.push({args:_47c});}else{this._loadInProgress=true;var _47e={url:self._jsonFileUrl,handleAs:"json-comment-optional",preventCache:this.urlPreventCache,failOk:this.failOk};var _47f=_4.xhrGet(_47e);_47f.addCallback(function(data){var _480=_47c.scope?_47c.scope:_4.global;try{self._getItemsFromLoadedData(data);self._loadFinished=true;self._loadInProgress=false;item=self._getItemByIdentity(_47c.identity);if(_47c.onItem){_47c.onItem.call(_480,item);}self._handleQueuedFetches();}catch(error){self._loadInProgress=false;if(_47c.onError){_47c.onError.call(_480,error);}}});_47f.addErrback(function(_481){self._loadInProgress=false;if(_47c.onError){var _482=_47c.scope?_47c.scope:_4.global;_47c.onError.call(_482,_481);}});}}else{if(this._jsonData){self._getItemsFromLoadedData(self._jsonData);self._jsonData=null;self._loadFinished=true;item=self._getItemByIdentity(_47c.identity);if(_47c.onItem){_47d=_47c.scope?_47c.scope:_4.global;_47c.onItem.call(_47d,item);}}}}else{item=this._getItemByIdentity(_47c.identity);if(_47c.onItem){_47d=_47c.scope?_47c.scope:_4.global;_47c.onItem.call(_47d,item);}}},_getItemByIdentity:function(_483){var item=null;if(this._itemsByIdentity&&Object.hasOwnProperty.call(this._itemsByIdentity,_483)){item=this._itemsByIdentity[_483];}else{if(Object.hasOwnProperty.call(this._arrayOfAllItems,_483)){item=this._arrayOfAllItems[_483];}}if(item===undefined){item=null;}return item;},getIdentityAttributes:function(item){var _484=this._features["dojo.data.api.Identity"];if(_484===Number){return null;}else{return [_484];}},_forceLoad:function(){var self=this;if(this._jsonFileUrl!==this._ccUrl){_4.deprecated("dojo.data.ItemFileReadStore: ","To change the url, set the url property of the store,"+" not _jsonFileUrl.  _jsonFileUrl support will be removed in 2.0");this._ccUrl=this._jsonFileUrl;this.url=this._jsonFileUrl;}else{if(this.url!==this._ccUrl){this._jsonFileUrl=this.url;this._ccUrl=this.url;}}if(this.data!=null){this._jsonData=this.data;this.data=null;}if(this._jsonFileUrl){var _485={url:this._jsonFileUrl,handleAs:"json-comment-optional",preventCache:this.urlPreventCache,failOk:this.failOk,sync:true};var _486=_4.xhrGet(_485);_486.addCallback(function(data){try{if(self._loadInProgress!==true&&!self._loadFinished){self._getItemsFromLoadedData(data);self._loadFinished=true;}else{if(self._loadInProgress){throw new Error("dojo.data.ItemFileReadStore:  Unable to perform a synchronous load, an async load is in progress.");}}}catch(e){console.log(e);throw e;}});_486.addErrback(function(_487){throw _487;});}else{if(this._jsonData){self._getItemsFromLoadedData(self._jsonData);self._jsonData=null;self._loadFinished=true;}}}});_4.extend(_4.data.ItemFileReadStore,_4.data.util.simpleFetch);}if(!_4._hasResource["dijit.layout._LayoutWidget"]){_4._hasResource["dijit.layout._LayoutWidget"]=true;_4.provide("dijit.layout._LayoutWidget");_4.declare("dijit.layout._LayoutWidget",[_5._Widget,_5._Container,_5._Contained],{baseClass:"dijitLayoutContainer",isLayoutContainer:true,buildRendering:function(){this.inherited(arguments);_4.addClass(this.domNode,"dijitContainer");},startup:function(){if(this._started){return;}this.inherited(arguments);var _488=this.getParent&&this.getParent();if(!(_488&&_488.isLayoutContainer)){this.resize();this.connect(_4.isIE?this.domNode:_4.global,"onresize",function(){this.resize();});}},resize:function(_489,_48a){var node=this.domNode;if(_489){_4.marginBox(node,_489);if(_489.t){node.style.top=_489.t+"px";}if(_489.l){node.style.left=_489.l+"px";}}var mb=_48a||{};_4.mixin(mb,_489||{});if(!("h" in mb)||!("w" in mb)){mb=_4.mixin(_4.marginBox(node),mb);}var cs=_4.getComputedStyle(node);var me=_4._getMarginExtents(node,cs);var be=_4._getBorderExtents(node,cs);var bb=(this._borderBox={w:mb.w-(me.w+be.w),h:mb.h-(me.h+be.h)});var pe=_4._getPadExtents(node,cs);this._contentBox={l:_4._toPixelValue(node,cs.paddingLeft),t:_4._toPixelValue(node,cs.paddingTop),w:bb.w-pe.w,h:bb.h-pe.h};this.layout();},layout:function(){},_setupChild:function(_48b){var cls=this.baseClass+"-child "+(_48b.baseClass?this.baseClass+"-"+_48b.baseClass:"");_4.addClass(_48b.domNode,cls);},addChild:function(_48c,_48d){this.inherited(arguments);if(this._started){this._setupChild(_48c);}},removeChild:function(_48e){var cls=this.baseClass+"-child"+(_48e.baseClass?" "+this.baseClass+"-"+_48e.baseClass:"");_4.removeClass(_48e.domNode,cls);this.inherited(arguments);}});_5.layout.marginBox2contentBox=function(node,mb){var cs=_4.getComputedStyle(node);var me=_4._getMarginExtents(node,cs);var pb=_4._getPadBorderExtents(node,cs);return {l:_4._toPixelValue(node,cs.paddingLeft),t:_4._toPixelValue(node,cs.paddingTop),w:mb.w-(me.w+pb.w),h:mb.h-(me.h+pb.h)};};(function(){var _48f=function(word){return word.substring(0,1).toUpperCase()+word.substring(1);};var size=function(_490,dim){var _491=_490.resize?_490.resize(dim):_4.marginBox(_490.domNode,dim);if(_491){_4.mixin(_490,_491);}else{_4.mixin(_490,_4.marginBox(_490.domNode));_4.mixin(_490,dim);}};_5.layout.layoutChildren=function(_492,dim,_493,_494,_495){dim=_4.mixin({},dim);_4.addClass(_492,"dijitLayoutContainer");_493=_4.filter(_493,function(item){return item.region!="center"&&item.layoutAlign!="client";}).concat(_4.filter(_493,function(item){return item.region=="center"||item.layoutAlign=="client";}));_4.forEach(_493,function(_496){var elm=_496.domNode,pos=(_496.region||_496.layoutAlign);var _497=elm.style;_497.left=dim.l+"px";_497.top=dim.t+"px";_497.position="absolute";_4.addClass(elm,"dijitAlign"+_48f(pos));var _498={};if(_494&&_494==_496.id){_498[_496.region=="top"||_496.region=="bottom"?"h":"w"]=_495;}if(pos=="top"||pos=="bottom"){_498.w=dim.w;size(_496,_498);dim.h-=_496.h;if(pos=="top"){dim.t+=_496.h;}else{_497.top=dim.t+dim.h+"px";}}else{if(pos=="left"||pos=="right"){_498.h=dim.h;size(_496,_498);dim.w-=_496.w;if(pos=="left"){dim.l+=_496.w;}else{_497.left=dim.l+dim.w+"px";}}else{if(pos=="client"||pos=="center"){size(_496,dim);}}}});};})();}if(!_4._hasResource["dijit.dijit"]){_4._hasResource["dijit.dijit"]=true;_4.provide("dijit.dijit");}if(!_4._hasResource["dojox.html.metrics"]){_4._hasResource["dojox.html.metrics"]=true;_4.provide("dojox.html.metrics");(function(){var dhm=_6.html.metrics;dhm.getFontMeasurements=function(){var _499={"1em":0,"1ex":0,"100%":0,"12pt":0,"16px":0,"xx-small":0,"x-small":0,"small":0,"medium":0,"large":0,"x-large":0,"xx-large":0};if(_4.isIE){_4.doc.documentElement.style.fontSize="100%";}var div=_4.doc.createElement("div");var ds=div.style;ds.position="absolute";ds.left="-100px";ds.top="0";ds.width="30px";ds.height="1000em";ds.borderWidth="0";ds.margin="0";ds.padding="0";ds.outline="0";ds.lineHeight="1";ds.overflow="hidden";_4.body().appendChild(div);for(var p in _499){ds.fontSize=p;_499[p]=Math.round(div.offsetHeight*12/16)*16/12/1000;}_4.body().removeChild(div);div=null;return _499;};var _49a=null;dhm.getCachedFontMeasurements=function(_49b){if(_49b||!_49a){_49a=dhm.getFontMeasurements();}return _49a;};var _49c=null,_49d={};dhm.getTextBox=function(text,_49e,_49f){var m,s;if(!_49c){m=_49c=_4.doc.createElement("div");var c=_4.doc.createElement("div");c.appendChild(m);s=c.style;s.overflow="scroll";s.position="absolute";s.left="0px";s.top="-10000px";s.width="1px";s.height="1px";s.visibility="hidden";s.borderWidth="0";s.margin="0";s.padding="0";s.outline="0";_4.body().appendChild(c);}else{m=_49c;}m.className="";s=m.style;s.borderWidth="0";s.margin="0";s.padding="0";s.outline="0";if(arguments.length>1&&_49e){for(var i in _49e){if(i in _49d){continue;}s[i]=_49e[i];}}if(arguments.length>2&&_49f){m.className=_49f;}m.innerHTML=text;var box=_4.position(m);box.w=m.parentNode.scrollWidth;return box;};var _4a0={w:16,h:16};dhm.getScrollbar=function(){return {w:_4a0.w,h:_4a0.h};};dhm._fontResizeNode=null;dhm.initOnFontResize=function(_4a1){var f=dhm._fontResizeNode=_4.doc.createElement("iframe");var fs=f.style;fs.position="absolute";fs.width="5em";fs.height="10em";fs.top="-10000px";if(_4.isIE){f.onreadystatechange=function(){if(f.contentWindow.document.readyState=="complete"){f.onresize=f.contentWindow.parent[_6._scopeName].html.metrics._fontresize;}};}else{f.onload=function(){f.contentWindow.onresize=f.contentWindow.parent[_6._scopeName].html.metrics._fontresize;};}f.setAttribute("src","javascript:'<html><head><script>if(\"loadFirebugConsole\" in window){window.loadFirebugConsole();}</script></head><body></body></html>'");_4.body().appendChild(f);dhm.initOnFontResize=function(){};};dhm.onFontResize=function(){};dhm._fontresize=function(){dhm.onFontResize();};_4.addOnUnload(function(){var f=dhm._fontResizeNode;if(f){if(_4.isIE&&f.onresize){f.onresize=null;}else{if(f.contentWindow&&f.contentWindow.onresize){f.contentWindow.onresize=null;}}dhm._fontResizeNode=null;}});_4.addOnLoad(function(){try{var n=_4.doc.createElement("div");n.style.cssText="top:0;left:0;width:100px;height:100px;overflow:scroll;position:absolute;visibility:hidden;";_4.body().appendChild(n);_4a0.w=n.offsetWidth-n.clientWidth;_4a0.h=n.offsetHeight-n.clientHeight;_4.body().removeChild(n);delete n;}catch(e){}if("fontSizeWatch" in _4.config&&!!_4.config.fontSizeWatch){dhm.initOnFontResize();}});})();}if(!_4._hasResource["dojox.grid.util"]){_4._hasResource["dojox.grid.util"]=true;_4.provide("dojox.grid.util");(function(){var dgu=_6.grid.util;dgu.na="...";dgu.rowIndexTag="gridRowIndex";dgu.gridViewTag="gridView";dgu.fire=function(ob,ev,args){var fn=ob&&ev&&ob[ev];return fn&&(args?fn.apply(ob,args):ob[ev]());};dgu.setStyleHeightPx=function(_4a2,_4a3){if(_4a3>=0){var s=_4a2.style;var v=_4a3+"px";if(_4a2&&s["height"]!=v){s["height"]=v;}}};dgu.mouseEvents=["mouseover","mouseout","mousedown","mouseup","click","dblclick","contextmenu"];dgu.keyEvents=["keyup","keydown","keypress"];dgu.funnelEvents=function(_4a4,_4a5,_4a6,_4a7){var evts=(_4a7?_4a7:dgu.mouseEvents.concat(dgu.keyEvents));for(var i=0,l=evts.length;i<l;i++){_4a5.connect(_4a4,"on"+evts[i],_4a6);}};dgu.removeNode=function(_4a8){_4a8=_4.byId(_4a8);_4a8&&_4a8.parentNode&&_4a8.parentNode.removeChild(_4a8);return _4a8;};dgu.arrayCompare=function(inA,inB){for(var i=0,l=inA.length;i<l;i++){if(inA[i]!=inB[i]){return false;}}return (inA.length==inB.length);};dgu.arrayInsert=function(_4a9,_4aa,_4ab){if(_4a9.length<=_4aa){_4a9[_4aa]=_4ab;}else{_4a9.splice(_4aa,0,_4ab);}};dgu.arrayRemove=function(_4ac,_4ad){_4ac.splice(_4ad,1);};dgu.arraySwap=function(_4ae,inI,inJ){var _4af=_4ae[inI];_4ae[inI]=_4ae[inJ];_4ae[inJ]=_4af;};})();}if(!_4._hasResource["dojox.grid._Scroller"]){_4._hasResource["dojox.grid._Scroller"]=true;_4.provide("dojox.grid._Scroller");(function(){var _4b0=function(_4b1){var i=0,n,p=_4b1.parentNode;while((n=p.childNodes[i++])){if(n==_4b1){return i-1;}}return -1;};var _4b2=function(_4b3){if(!_4b3){return;}var _4b4=function(inW){return inW.domNode&&_4.isDescendant(inW.domNode,_4b3,true);};var ws=_5.registry.filter(_4b4);for(var i=0,w;(w=ws[i]);i++){w.destroy();}delete ws;};var _4b5=function(_4b6){var node=_4.byId(_4b6);return (node&&node.tagName?node.tagName.toLowerCase():"");};var _4b7=function(_4b8,_4b9){var _4ba=[];var i=0,n;while((n=_4b8.childNodes[i])){i++;if(_4b5(n)==_4b9){_4ba.push(n);}}return _4ba;};var _4bb=function(_4bc){return _4b7(_4bc,"div");};_4.declare("dojox.grid._Scroller",null,{constructor:function(_4bd){this.setContentNodes(_4bd);this.pageHeights=[];this.pageNodes=[];this.stack=[];},rowCount:0,defaultRowHeight:32,keepRows:100,contentNode:null,scrollboxNode:null,defaultPageHeight:0,keepPages:10,pageCount:0,windowHeight:0,firstVisibleRow:0,lastVisibleRow:0,averageRowHeight:0,page:0,pageTop:0,init:function(_4be,_4bf,_4c0){switch(arguments.length){case 3:this.rowsPerPage=_4c0;case 2:this.keepRows=_4bf;case 1:this.rowCount=_4be;default:break;}this.defaultPageHeight=this.defaultRowHeight*this.rowsPerPage;this.pageCount=this._getPageCount(this.rowCount,this.rowsPerPage);this.setKeepInfo(this.keepRows);this.invalidate();if(this.scrollboxNode){this.scrollboxNode.scrollTop=0;this.scroll(0);this.scrollboxNode.onscroll=_4.hitch(this,"onscroll");}},_getPageCount:function(_4c1,_4c2){return _4c1?(Math.ceil(_4c1/_4c2)||1):0;},destroy:function(){this.invalidateNodes();delete this.contentNodes;delete this.contentNode;delete this.scrollboxNode;},setKeepInfo:function(_4c3){this.keepRows=_4c3;this.keepPages=!this.keepRows?this.keepPages:Math.max(Math.ceil(this.keepRows/this.rowsPerPage),2);},setContentNodes:function(_4c4){this.contentNodes=_4c4;this.colCount=(this.contentNodes?this.contentNodes.length:0);this.pageNodes=[];for(var i=0;i<this.colCount;i++){this.pageNodes[i]=[];}},getDefaultNodes:function(){return this.pageNodes[0]||[];},invalidate:function(){this._invalidating=true;this.invalidateNodes();this.pageHeights=[];this.height=(this.pageCount?(this.pageCount-1)*this.defaultPageHeight+this.calcLastPageHeight():0);this.resize();this._invalidating=false;},updateRowCount:function(_4c5){this.invalidateNodes();this.rowCount=_4c5;var _4c6=this.pageCount;if(_4c6===0){this.height=1;}this.pageCount=this._getPageCount(this.rowCount,this.rowsPerPage);if(this.pageCount<_4c6){for(var i=_4c6-1;i>=this.pageCount;i--){this.height-=this.getPageHeight(i);delete this.pageHeights[i];}}else{if(this.pageCount>_4c6){this.height+=this.defaultPageHeight*(this.pageCount-_4c6-1)+this.calcLastPageHeight();}}this.resize();},pageExists:function(_4c7){return Boolean(this.getDefaultPageNode(_4c7));},measurePage:function(_4c8){if(this.grid.rowHeight){var _4c9=this.grid.rowHeight+1;return ((_4c8+1)*this.rowsPerPage>this.rowCount?this.rowCount-_4c8*this.rowsPerPage:this.rowsPerPage)*_4c9;}var n=this.getDefaultPageNode(_4c8);return (n&&n.innerHTML)?n.offsetHeight:undefined;},positionPage:function(_4ca,_4cb){for(var i=0;i<this.colCount;i++){this.pageNodes[i][_4ca].style.top=_4cb+"px";}},repositionPages:function(_4cc){var _4cd=this.getDefaultNodes();var last=0;for(var i=0;i<this.stack.length;i++){last=Math.max(this.stack[i],last);}var n=_4cd[_4cc];var y=(n?this.getPageNodePosition(n)+this.getPageHeight(_4cc):0);for(var p=_4cc+1;p<=last;p++){n=_4cd[p];if(n){if(this.getPageNodePosition(n)==y){return;}this.positionPage(p,y);}y+=this.getPageHeight(p);}},installPage:function(_4ce){for(var i=0;i<this.colCount;i++){this.contentNodes[i].appendChild(this.pageNodes[i][_4ce]);}},preparePage:function(_4cf,_4d0){var p=(_4d0?this.popPage():null);for(var i=0;i<this.colCount;i++){var _4d1=this.pageNodes[i];var _4d2=(p===null?this.createPageNode():this.invalidatePageNode(p,_4d1));_4d2.pageIndex=_4cf;_4d1[_4cf]=_4d2;}},renderPage:function(_4d3){var _4d4=[];var i,j;for(i=0;i<this.colCount;i++){_4d4[i]=this.pageNodes[i][_4d3];}for(i=0,j=_4d3*this.rowsPerPage;(i<this.rowsPerPage)&&(j<this.rowCount);i++,j++){this.renderRow(j,_4d4);}},removePage:function(_4d5){for(var i=0,j=_4d5*this.rowsPerPage;i<this.rowsPerPage;i++,j++){this.removeRow(j);}},destroyPage:function(_4d6){for(var i=0;i<this.colCount;i++){var n=this.invalidatePageNode(_4d6,this.pageNodes[i]);if(n){_4.destroy(n);}}},pacify:function(_4d7){},pacifying:false,pacifyTicks:200,setPacifying:function(_4d8){if(this.pacifying!=_4d8){this.pacifying=_4d8;this.pacify(this.pacifying);}},startPacify:function(){this.startPacifyTicks=new Date().getTime();},doPacify:function(){var _4d9=(new Date().getTime()-this.startPacifyTicks)>this.pacifyTicks;this.setPacifying(true);this.startPacify();return _4d9;},endPacify:function(){this.setPacifying(false);},resize:function(){if(this.scrollboxNode){this.windowHeight=this.scrollboxNode.clientHeight;}for(var i=0;i<this.colCount;i++){_6.grid.util.setStyleHeightPx(this.contentNodes[i],Math.max(1,this.height));}var _4da=(!this._invalidating);if(!_4da){var ah=this.grid.get("autoHeight");if(typeof ah=="number"&&ah<=Math.min(this.rowsPerPage,this.rowCount)){_4da=true;}}if(_4da){this.needPage(this.page,this.pageTop);}var _4db=(this.page<this.pageCount-1)?this.rowsPerPage:((this.rowCount%this.rowsPerPage)||this.rowsPerPage);var _4dc=this.getPageHeight(this.page);this.averageRowHeight=(_4dc>0&&_4db>0)?(_4dc/_4db):0;},calcLastPageHeight:function(){if(!this.pageCount){return 0;}var _4dd=this.pageCount-1;var _4de=((this.rowCount%this.rowsPerPage)||(this.rowsPerPage))*this.defaultRowHeight;this.pageHeights[_4dd]=_4de;return _4de;},updateContentHeight:function(inDh){this.height+=inDh;this.resize();},updatePageHeight:function(_4df,_4e0,_4e1){if(this.pageExists(_4df)){var oh=this.getPageHeight(_4df);var h=(this.measurePage(_4df));if(h===undefined){h=oh;}this.pageHeights[_4df]=h;if(oh!=h){this.updateContentHeight(h-oh);var ah=this.grid.get("autoHeight");if((typeof ah=="number"&&ah>this.rowCount)||(ah===true&&!_4e0)){if(!_4e1){this.grid.sizeChange();}else{var ns=this.grid.viewsNode.style;ns.height=parseInt(ns.height)+h-oh+"px";this.repositionPages(_4df);}}else{this.repositionPages(_4df);}}return h;}return 0;},rowHeightChanged:function(_4e2,_4e3){this.updatePageHeight(Math.floor(_4e2/this.rowsPerPage),false,_4e3);},invalidateNodes:function(){while(this.stack.length){this.destroyPage(this.popPage());}},createPageNode:function(){var p=document.createElement("div");_4.attr(p,"role","presentation");p.style.position="absolute";p.style[_4._isBodyLtr()?"left":"right"]="0";return p;},getPageHeight:function(_4e4){var ph=this.pageHeights[_4e4];return (ph!==undefined?ph:this.defaultPageHeight);},pushPage:function(_4e5){return this.stack.push(_4e5);},popPage:function(){return this.stack.shift();},findPage:function(_4e6){var i=0,h=0;for(var ph=0;i<this.pageCount;i++,h+=ph){ph=this.getPageHeight(i);if(h+ph>=_4e6){break;}}this.page=i;this.pageTop=h;},buildPage:function(_4e7,_4e8,_4e9){this.preparePage(_4e7,_4e8);this.positionPage(_4e7,_4e9);this.installPage(_4e7);this.renderPage(_4e7);this.pushPage(_4e7);},needPage:function(_4ea,_4eb){var h=this.getPageHeight(_4ea),oh=h;if(!this.pageExists(_4ea)){this.buildPage(_4ea,(!this.grid._autoHeight&&this.keepPages&&(this.stack.length>=this.keepPages)),_4eb);h=this.updatePageHeight(_4ea,true);}else{this.positionPage(_4ea,_4eb);}return h;},onscroll:function(){this.scroll(this.scrollboxNode.scrollTop);},scroll:function(_4ec){this.grid.scrollTop=_4ec;if(this.colCount){this.startPacify();this.findPage(_4ec);var h=this.height;var b=this.getScrollBottom(_4ec);for(var p=this.page,y=this.pageTop;(p<this.pageCount)&&((b<0)||(y<b));p++){y+=this.needPage(p,y);}this.firstVisibleRow=this.getFirstVisibleRow(this.page,this.pageTop,_4ec);this.lastVisibleRow=this.getLastVisibleRow(p-1,y,b);if(h!=this.height){this.repositionPages(p-1);}this.endPacify();}},getScrollBottom:function(_4ed){return (this.windowHeight>=0?_4ed+this.windowHeight:-1);},processNodeEvent:function(e,_4ee){var t=e.target;while(t&&(t!=_4ee)&&t.parentNode&&(t.parentNode.parentNode!=_4ee)){t=t.parentNode;}if(!t||!t.parentNode||(t.parentNode.parentNode!=_4ee)){return false;}var page=t.parentNode;e.topRowIndex=page.pageIndex*this.rowsPerPage;e.rowIndex=e.topRowIndex+_4b0(t);e.rowTarget=t;return true;},processEvent:function(e){return this.processNodeEvent(e,this.contentNode);},renderRow:function(_4ef,_4f0){},removeRow:function(_4f1){},getDefaultPageNode:function(_4f2){return this.getDefaultNodes()[_4f2];},positionPageNode:function(_4f3,_4f4){},getPageNodePosition:function(_4f5){return _4f5.offsetTop;},invalidatePageNode:function(_4f6,_4f7){var p=_4f7[_4f6];if(p){delete _4f7[_4f6];this.removePage(_4f6,p);_4b2(p);p.innerHTML="";}return p;},getPageRow:function(_4f8){return _4f8*this.rowsPerPage;},getLastPageRow:function(_4f9){return Math.min(this.rowCount,this.getPageRow(_4f9+1))-1;},getFirstVisibleRow:function(_4fa,_4fb,_4fc){if(!this.pageExists(_4fa)){return 0;}var row=this.getPageRow(_4fa);var _4fd=this.getDefaultNodes();var rows=_4bb(_4fd[_4fa]);for(var i=0,l=rows.length;i<l&&_4fb<_4fc;i++,row++){_4fb+=rows[i].offsetHeight;}return (row?row-1:row);},getLastVisibleRow:function(_4fe,_4ff,_500){if(!this.pageExists(_4fe)){return 0;}var _501=this.getDefaultNodes();var row=this.getLastPageRow(_4fe);var rows=_4bb(_501[_4fe]);for(var i=rows.length-1;i>=0&&_4ff>_500;i--,row--){_4ff-=rows[i].offsetHeight;}return row+1;},findTopRow:function(_502){var _503=this.getDefaultNodes();var rows=_4bb(_503[this.page]);for(var i=0,l=rows.length,t=this.pageTop,h;i<l;i++){h=rows[i].offsetHeight;t+=h;if(t>=_502){this.offset=h-(t-_502);return i+this.page*this.rowsPerPage;}}return -1;},findScrollTop:function(_504){var _505=Math.floor(_504/this.rowsPerPage);var t=0;var i,l;for(i=0;i<_505;i++){t+=this.getPageHeight(i);}this.pageTop=t;this.page=_505;this.needPage(_505,this.pageTop);var _506=this.getDefaultNodes();var rows=_4bb(_506[_505]);var r=_504-this.rowsPerPage*_505;for(i=0,l=rows.length;i<l&&i<r;i++){t+=rows[i].offsetHeight;}return t;},dummy:0});})();}if(!_4._hasResource["dojox.grid.cells._base"]){_4._hasResource["dojox.grid.cells._base"]=true;_4.provide("dojox.grid.cells._base");_4.declare("dojox.grid._DeferredTextWidget",_5._Widget,{deferred:null,_destroyOnRemove:true,postCreate:function(){if(this.deferred){this.deferred.addBoth(_4.hitch(this,function(text){if(this.domNode){this.domNode.innerHTML=text;}}));}}});(function(){var _507=function(_508){try{_6.grid.util.fire(_508,"focus");_6.grid.util.fire(_508,"select");}catch(e){}};var _509=function(){setTimeout(_4.hitch.apply(_4,arguments),0);};var dgc=_6.grid.cells;_4.declare("dojox.grid.cells._Base",null,{styles:"",classes:"",editable:false,alwaysEditing:false,formatter:null,defaultValue:"...",value:null,hidden:false,noresize:false,draggable:true,_valueProp:"value",_formatPending:false,constructor:function(_50a){this._props=_50a||{};_4.mixin(this,_50a);if(this.draggable===undefined){this.draggable=true;}},_defaultFormat:function(_50b,_50c){var s=this.grid.formatterScope||this;var f=this.formatter;if(f&&s&&typeof f=="string"){f=this.formatter=s[f];}var v=(_50b!=this.defaultValue&&f)?f.apply(s,_50c):_50b;if(typeof v=="undefined"){return this.defaultValue;}if(v&&v.addBoth){v=new _6.grid._DeferredTextWidget({deferred:v},_4.create("span",{innerHTML:this.defaultValue}));}if(v&&v.declaredClass&&v.startup){return "<div class='dojoxGridStubNode' linkWidget='"+v.id+"' cellIdx='"+this.index+"'>"+this.defaultValue+"</div>";}return v;},format:function(_50d,_50e){var f,i=this.grid.edit.info,d=this.get?this.get(_50d,_50e):(this.value||this.defaultValue);d=(d&&d.replace&&this.grid.escapeHTMLInData)?d.replace(/&(?![a-z0-9]{1,8}\;)/ig,"&amp;").replace(/</g,"&lt;"):d;if(this.editable&&(this.alwaysEditing||(i.rowIndex==_50d&&i.cell==this))){return this.formatEditing(d,_50d);}else{return this._defaultFormat(d,[d,_50d,this]);}},formatEditing:function(_50f,_510){},getNode:function(_511){return this.view.getCellNode(_511,this.index);},getHeaderNode:function(){return this.view.getHeaderCellNode(this.index);},getEditNode:function(_512){return (this.getNode(_512)||0).firstChild||0;},canResize:function(){var uw=this.unitWidth;return uw&&(uw!=="auto");},isFlex:function(){var uw=this.unitWidth;return uw&&_4.isString(uw)&&(uw=="auto"||uw.slice(-1)=="%");},applyEdit:function(_513,_514){this.grid.edit.applyCellEdit(_513,this,_514);},cancelEdit:function(_515){this.grid.doCancelEdit(_515);},_onEditBlur:function(_516){if(this.grid.edit.isEditCell(_516,this.index)){this.grid.edit.apply();}},registerOnBlur:function(_517,_518){if(this.commitOnBlur){_4.connect(_517,"onblur",function(e){setTimeout(_4.hitch(this,"_onEditBlur",_518),250);});}},needFormatNode:function(_519,_51a){this._formatPending=true;_509(this,"_formatNode",_519,_51a);},cancelFormatNode:function(){this._formatPending=false;},_formatNode:function(_51b,_51c){if(this._formatPending){this._formatPending=false;_4.setSelectable(this.grid.domNode,true);this.formatNode(this.getEditNode(_51c),_51b,_51c);}},formatNode:function(_51d,_51e,_51f){if(_4.isIE){_509(this,"focus",_51f,_51d);}else{this.focus(_51f,_51d);}},dispatchEvent:function(m,e){if(m in this){return this[m](e);}},getValue:function(_520){return this.getEditNode(_520)[this._valueProp];},setValue:function(_521,_522){var n=this.getEditNode(_521);if(n){n[this._valueProp]=_522;}},focus:function(_523,_524){_507(_524||this.getEditNode(_523));},save:function(_525){this.value=this.value||this.getValue(_525);},restore:function(_526){this.setValue(_526,this.value);},_finish:function(_527){_4.setSelectable(this.grid.domNode,false);this.cancelFormatNode();},apply:function(_528){this.applyEdit(this.getValue(_528),_528);this._finish(_528);},cancel:function(_529){this.cancelEdit(_529);this._finish(_529);}});dgc._Base.markupFactory=function(node,_52a){var d=_4;var _52b=d.trim(d.attr(node,"formatter")||"");if(_52b){_52a.formatter=_4.getObject(_52b)||_52b;}var get=d.trim(d.attr(node,"get")||"");if(get){_52a.get=_4.getObject(get);}var _52c=function(attr,cell,_52d){var _52e=d.trim(d.attr(node,attr)||"");if(_52e){cell[_52d||attr]=!(_52e.toLowerCase()=="false");}};_52c("sortDesc",_52a);_52c("editable",_52a);_52c("alwaysEditing",_52a);_52c("noresize",_52a);_52c("draggable",_52a);var _52f=d.trim(d.attr(node,"loadingText")||d.attr(node,"defaultValue")||"");if(_52f){_52a.defaultValue=_52f;}var _530=function(attr,cell,_531){var _532=d.trim(d.attr(node,attr)||"")||undefined;if(_532){cell[_531||attr]=_532;}};_530("styles",_52a);_530("headerStyles",_52a);_530("cellStyles",_52a);_530("classes",_52a);_530("headerClasses",_52a);_530("cellClasses",_52a);};_4.declare("dojox.grid.cells.Cell",dgc._Base,{constructor:function(){this.keyFilter=this.keyFilter;},keyFilter:null,formatEditing:function(_533,_534){this.needFormatNode(_533,_534);return "<input class=\"dojoxGridInput\" type=\"text\" value=\""+_533+"\">";},formatNode:function(_535,_536,_537){this.inherited(arguments);this.registerOnBlur(_535,_537);},doKey:function(e){if(this.keyFilter){var key=String.fromCharCode(e.charCode);if(key.search(this.keyFilter)==-1){_4.stopEvent(e);}}},_finish:function(_538){this.inherited(arguments);var n=this.getEditNode(_538);try{_6.grid.util.fire(n,"blur");}catch(e){}}});dgc.Cell.markupFactory=function(node,_539){dgc._Base.markupFactory(node,_539);var d=_4;var _53a=d.trim(d.attr(node,"keyFilter")||"");if(_53a){_539.keyFilter=new RegExp(_53a);}};_4.declare("dojox.grid.cells.RowIndex",dgc.Cell,{name:"Row",postscript:function(){this.editable=false;},get:function(_53b){return _53b+1;}});dgc.RowIndex.markupFactory=function(node,_53c){dgc.Cell.markupFactory(node,_53c);};_4.declare("dojox.grid.cells.Select",dgc.Cell,{options:null,values:null,returnIndex:-1,constructor:function(_53d){this.values=this.values||this.options;},formatEditing:function(_53e,_53f){this.needFormatNode(_53e,_53f);var h=["<select class=\"dojoxGridSelect\">"];for(var i=0,o,v;((o=this.options[i])!==undefined)&&((v=this.values[i])!==undefined);i++){h.push("<option",(_53e==v?" selected":"")," value=\""+v+"\"",">",o,"</option>");}h.push("</select>");return h.join("");},getValue:function(_540){var n=this.getEditNode(_540);if(n){var i=n.selectedIndex,o=n.options[i];return this.returnIndex>-1?i:o.value||o.innerHTML;}}});dgc.Select.markupFactory=function(node,cell){dgc.Cell.markupFactory(node,cell);var d=_4;var _541=d.trim(d.attr(node,"options")||"");if(_541){var o=_541.split(",");if(o[0]!=_541){cell.options=o;}}var _542=d.trim(d.attr(node,"values")||"");if(_542){var v=_542.split(",");if(v[0]!=_542){cell.values=v;}}};_4.declare("dojox.grid.cells.AlwaysEdit",dgc.Cell,{alwaysEditing:true,_formatNode:function(_543,_544){this.formatNode(this.getEditNode(_544),_543,_544);},applyStaticValue:function(_545){var e=this.grid.edit;e.applyCellEdit(this.getValue(_545),this,_545);e.start(this,_545,true);}});dgc.AlwaysEdit.markupFactory=function(node,cell){dgc.Cell.markupFactory(node,cell);};_4.declare("dojox.grid.cells.Bool",dgc.AlwaysEdit,{_valueProp:"checked",formatEditing:function(_546,_547){return "<input class=\"dojoxGridInput\" type=\"checkbox\""+(_546?" checked=\"checked\"":"")+" style=\"width: auto\" />";},doclick:function(e){if(e.target.tagName=="INPUT"){this.applyStaticValue(e.rowIndex);}}});dgc.Bool.markupFactory=function(node,cell){dgc.AlwaysEdit.markupFactory(node,cell);};})();}if(!_4._hasResource["dojox.grid.cells"]){_4._hasResource["dojox.grid.cells"]=true;_4.provide("dojox.grid.cells");}if(!_4._hasResource["dojox.grid._Builder"]){_4._hasResource["dojox.grid._Builder"]=true;_4.provide("dojox.grid._Builder");(function(){var dg=_6.grid;var _548=function(td){return td.cellIndex>=0?td.cellIndex:_4.indexOf(td.parentNode.cells,td);};var _549=function(tr){return tr.rowIndex>=0?tr.rowIndex:_4.indexOf(tr.parentNode.childNodes,tr);};var _54a=function(_54b,_54c){return _54b&&((_54b.rows||0)[_54c]||_54b.childNodes[_54c]);};var _54d=function(node){for(var n=node;n&&n.tagName!="TABLE";n=n.parentNode){}return n;};var _54e=function(_54f,_550){for(var n=_54f;n&&_550(n);n=n.parentNode){}return n;};var _551=function(_552){var name=_552.toUpperCase();return function(node){return node.tagName!=name;};};var _553=_6.grid.util.rowIndexTag;var _554=_6.grid.util.gridViewTag;dg._Builder=_4.extend(function(view){if(view){this.view=view;this.grid=view.grid;}},{view:null,_table:"<table class=\"dojoxGridRowTable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" role=\"presentation\"",getTableArray:function(){var html=[this._table];if(this.view.viewWidth){html.push([" style=\"width:",this.view.viewWidth,";\""].join(""));}html.push(">");return html;},generateCellMarkup:function(_555,_556,_557,_558){var _559=[],html;if(_558){var _55a=_555.index!=_555.grid.getSortIndex()?"":_555.grid.sortInfo>0?"aria-sort=\"ascending\"":"aria-sort=\"descending\"";if(!_555.id){_555.id=this.grid.id+"Hdr"+_555.index;}html=["<th tabIndex=\"-1\" aria-readonly=\"true\" role=\"columnheader\"",_55a,"id=\"",_555.id,"\""];}else{var _55b=this.grid.editable&&!_555.editable?"aria-readonly=\"true\"":"";html=["<td tabIndex=\"-1\" role=\"gridcell\"",_55b];}if(_555.colSpan){html.push(" colspan=\"",_555.colSpan,"\"");}if(_555.rowSpan){html.push(" rowspan=\"",_555.rowSpan,"\"");}html.push(" class=\"dojoxGridCell ");if(_555.classes){html.push(_555.classes," ");}if(_557){html.push(_557," ");}_559.push(html.join(""));_559.push("");html=["\" idx=\"",_555.index,"\" style=\""];if(_556&&_556[_556.length-1]!=";"){_556+=";";}html.push(_555.styles,_556||"",_555.hidden?"display:none;":"");if(_555.unitWidth){html.push("width:",_555.unitWidth,";");}_559.push(html.join(""));_559.push("");html=["\""];if(_555.attrs){html.push(" ",_555.attrs);}html.push(">");_559.push(html.join(""));_559.push("");_559.push(_558?"</th>":"</td>");return _559;},isCellNode:function(_55c){return Boolean(_55c&&_55c!=_4.doc&&_4.attr(_55c,"idx"));},getCellNodeIndex:function(_55d){return _55d?Number(_4.attr(_55d,"idx")):-1;},getCellNode:function(_55e,_55f){for(var i=0,row;((row=_54a(_55e.firstChild,i))&&row.cells);i++){for(var j=0,cell;(cell=row.cells[j]);j++){if(this.getCellNodeIndex(cell)==_55f){return cell;}}}return null;},findCellTarget:function(_560,_561){var n=_560;while(n&&(!this.isCellNode(n)||(n.offsetParent&&_554 in n.offsetParent.parentNode&&n.offsetParent.parentNode[_554]!=this.view.id))&&(n!=_561)){n=n.parentNode;}return n!=_561?n:null;},baseDecorateEvent:function(e){e.dispatch="do"+e.type;e.grid=this.grid;e.sourceView=this.view;e.cellNode=this.findCellTarget(e.target,e.rowNode);e.cellIndex=this.getCellNodeIndex(e.cellNode);e.cell=(e.cellIndex>=0?this.grid.getCell(e.cellIndex):null);},findTarget:function(_562,_563){var n=_562;while(n&&(n!=this.domNode)&&(!(_563 in n)||(_554 in n&&n[_554]!=this.view.id))){n=n.parentNode;}return (n!=this.domNode)?n:null;},findRowTarget:function(_564){return this.findTarget(_564,_553);},isIntraNodeEvent:function(e){try{return (e.cellNode&&e.relatedTarget&&_4.isDescendant(e.relatedTarget,e.cellNode));}catch(x){return false;}},isIntraRowEvent:function(e){try{var row=e.relatedTarget&&this.findRowTarget(e.relatedTarget);return !row&&(e.rowIndex==-1)||row&&(e.rowIndex==row.gridRowIndex);}catch(x){return false;}},dispatchEvent:function(e){if(e.dispatch in this){return this[e.dispatch](e);}return false;},domouseover:function(e){if(e.cellNode&&(e.cellNode!=this.lastOverCellNode)){this.lastOverCellNode=e.cellNode;this.grid.onMouseOver(e);}this.grid.onMouseOverRow(e);},domouseout:function(e){if(e.cellNode&&(e.cellNode==this.lastOverCellNode)&&!this.isIntraNodeEvent(e,this.lastOverCellNode)){this.lastOverCellNode=null;this.grid.onMouseOut(e);if(!this.isIntraRowEvent(e)){this.grid.onMouseOutRow(e);}}},domousedown:function(e){if(e.cellNode){this.grid.onMouseDown(e);}this.grid.onMouseDownRow(e);}});dg._ContentBuilder=_4.extend(function(view){dg._Builder.call(this,view);},dg._Builder.prototype,{update:function(){this.prepareHtml();},prepareHtml:function(){var _565=this.grid.get,_566=this.view.structure.cells;for(var j=0,row;(row=_566[j]);j++){for(var i=0,cell;(cell=row[i]);i++){cell.get=cell.get||(cell.value==undefined)&&_565;cell.markup=this.generateCellMarkup(cell,cell.cellStyles,cell.cellClasses,false);if(!this.grid.editable&&cell.editable){this.grid.editable=true;}}}},generateHtml:function(_567,_568){var html=this.getTableArray(),v=this.view,_569=v.structure.cells,item=this.grid.getItem(_568);_6.grid.util.fire(this.view,"onBeforeRow",[_568,_569]);for(var j=0,row;(row=_569[j]);j++){if(row.hidden||row.header){continue;}html.push(!row.invisible?"<tr>":"<tr class=\"dojoxGridInvisible\">");for(var i=0,cell,m,cc,cs;(cell=row[i]);i++){m=cell.markup;cc=cell.customClasses=[];cs=cell.customStyles=[];m[5]=cell.format(_568,item);m[1]=cc.join(" ");m[3]=cs.join(";");html.push.apply(html,m);}html.push("</tr>");}html.push("</table>");return html.join("");},decorateEvent:function(e){e.rowNode=this.findRowTarget(e.target);if(!e.rowNode){return false;}e.rowIndex=e.rowNode[_553];this.baseDecorateEvent(e);e.cell=this.grid.getCell(e.cellIndex);return true;}});dg._HeaderBuilder=_4.extend(function(view){this.moveable=null;dg._Builder.call(this,view);},dg._Builder.prototype,{_skipBogusClicks:false,overResizeWidth:4,minColWidth:1,update:function(){if(this.tableMap){this.tableMap.mapRows(this.view.structure.cells);}else{this.tableMap=new dg._TableMap(this.view.structure.cells);}},generateHtml:function(_56a,_56b){var html=this.getTableArray(),_56c=this.view.structure.cells;_6.grid.util.fire(this.view,"onBeforeRow",[-1,_56c]);for(var j=0,row;(row=_56c[j]);j++){if(row.hidden){continue;}html.push(!row.invisible?"<tr>":"<tr class=\"dojoxGridInvisible\">");for(var i=0,cell,_56d;(cell=row[i]);i++){cell.customClasses=[];cell.customStyles=[];if(this.view.simpleStructure){if(cell.draggable){if(cell.headerClasses){if(cell.headerClasses.indexOf("dojoDndItem")==-1){cell.headerClasses+=" dojoDndItem";}}else{cell.headerClasses="dojoDndItem";}}if(cell.attrs){if(cell.attrs.indexOf("dndType='gridColumn_")==-1){cell.attrs+=" dndType='gridColumn_"+this.grid.id+"'";}}else{cell.attrs="dndType='gridColumn_"+this.grid.id+"'";}}_56d=this.generateCellMarkup(cell,cell.headerStyles,cell.headerClasses,true);_56d[5]=(_56b!=undefined?_56b:_56a(cell));_56d[3]=cell.customStyles.join(";");_56d[1]=cell.customClasses.join(" ");html.push(_56d.join(""));}html.push("</tr>");}html.push("</table>");return html.join("");},getCellX:function(e){var n,x=e.layerX;if(_4.isMoz||_4.isIE>=9){n=_54e(e.target,_551("th"));x-=(n&&n.offsetLeft)||0;var t=e.sourceView.getScrollbarWidth();if(!_4._isBodyLtr()){table=_54e(n,_551("table"));x-=(table&&table.offsetLeft)||0;}}n=_54e(e.target,function(){if(!n||n==e.cellNode){return false;}x+=(n.offsetLeft<0?0:n.offsetLeft);return true;});return x;},decorateEvent:function(e){this.baseDecorateEvent(e);e.rowIndex=-1;e.cellX=this.getCellX(e);return true;},prepareResize:function(e,mod){do{var i=_548(e.cellNode);e.cellNode=(i?e.cellNode.parentNode.cells[i+mod]:null);e.cellIndex=(e.cellNode?this.getCellNodeIndex(e.cellNode):-1);}while(e.cellNode&&e.cellNode.style.display=="none");return Boolean(e.cellNode);},canResize:function(e){if(!e.cellNode||e.cellNode.colSpan>1){return false;}var cell=this.grid.getCell(e.cellIndex);return !cell.noresize&&cell.canResize();},overLeftResizeArea:function(e){if(_4.hasClass(_4.body(),"dojoDndMove")){return false;}if(_4.isIE){var tN=e.target;if(_4.hasClass(tN,"dojoxGridArrowButtonNode")||_4.hasClass(tN,"dojoxGridArrowButtonChar")){return false;}}if(_4._isBodyLtr()){return (e.cellIndex>0)&&(e.cellX>0&&e.cellX<this.overResizeWidth)&&this.prepareResize(e,-1);}var t=e.cellNode&&(e.cellX>0&&e.cellX<this.overResizeWidth);return t;},overRightResizeArea:function(e){if(_4.hasClass(_4.body(),"dojoDndMove")){return false;}if(_4.isIE){var tN=e.target;if(_4.hasClass(tN,"dojoxGridArrowButtonNode")||_4.hasClass(tN,"dojoxGridArrowButtonChar")){return false;}}if(_4._isBodyLtr()){return e.cellNode&&(e.cellX>=e.cellNode.offsetWidth-this.overResizeWidth);}return (e.cellIndex>0)&&(e.cellX>=e.cellNode.offsetWidth-this.overResizeWidth)&&this.prepareResize(e,-1);},domousemove:function(e){if(!this.moveable){var c=(this.overRightResizeArea(e)?"dojoxGridColResize":(this.overLeftResizeArea(e)?"dojoxGridColResize":""));if(c&&!this.canResize(e)){c="dojoxGridColNoResize";}_4.toggleClass(e.sourceView.headerNode,"dojoxGridColNoResize",(c=="dojoxGridColNoResize"));_4.toggleClass(e.sourceView.headerNode,"dojoxGridColResize",(c=="dojoxGridColResize"));if(_4.isIE){var t=e.sourceView.headerNode.scrollLeft;e.sourceView.headerNode.scrollLeft=t;}if(c){_4.stopEvent(e);}}},domousedown:function(e){if(!this.moveable){if((this.overRightResizeArea(e)||this.overLeftResizeArea(e))&&this.canResize(e)){this.beginColumnResize(e);}else{this.grid.onMouseDown(e);this.grid.onMouseOverRow(e);}}},doclick:function(e){if(this._skipBogusClicks){_4.stopEvent(e);return true;}return false;},colResizeSetup:function(e,_56e){var _56f=_4.contentBox(e.sourceView.headerNode);if(_56e){this.lineDiv=document.createElement("div");var vw=(_4.position||_4._abs)(e.sourceView.headerNode,true);var _570=_4.contentBox(e.sourceView.domNode);var l=e.pageX;if(!_4._isBodyLtr()&&_4.isIE<8){l-=_6.html.metrics.getScrollbar().w;}_4.style(this.lineDiv,{top:vw.y+"px",left:l+"px",height:(_570.h+_56f.h)+"px"});_4.addClass(this.lineDiv,"dojoxGridResizeColLine");this.lineDiv._origLeft=l;_4.body().appendChild(this.lineDiv);}var _571=[],_572=this.tableMap.findOverlappingNodes(e.cellNode);for(var i=0,cell;(cell=_572[i]);i++){_571.push({node:cell,index:this.getCellNodeIndex(cell),width:cell.offsetWidth});}var view=e.sourceView;var adj=_4._isBodyLtr()?1:-1;var _573=e.grid.views.views;var _574=[];for(var j=view.idx+adj,_575;(_575=_573[j]);j=j+adj){_574.push({node:_575.headerNode,left:window.parseInt(_575.headerNode.style.left)});}var _576=view.headerContentNode.firstChild;var drag={scrollLeft:e.sourceView.headerNode.scrollLeft,view:view,node:e.cellNode,index:e.cellIndex,w:_4.contentBox(e.cellNode).w,vw:_56f.w,table:_576,tw:_4.contentBox(_576).w,spanners:_571,followers:_574};return drag;},beginColumnResize:function(e){this.moverDiv=document.createElement("div");_4.style(this.moverDiv,{position:"absolute",left:0});_4.body().appendChild(this.moverDiv);_4.addClass(this.grid.domNode,"dojoxGridColumnResizing");var m=(this.moveable=new _4.dnd.Moveable(this.moverDiv));var drag=this.colResizeSetup(e,true);m.onMove=_4.hitch(this,"doResizeColumn",drag);_4.connect(m,"onMoveStop",_4.hitch(this,function(){this.endResizeColumn(drag);if(drag.node.releaseCapture){drag.node.releaseCapture();}this.moveable.destroy();delete this.moveable;this.moveable=null;_4.removeClass(this.grid.domNode,"dojoxGridColumnResizing");}));if(e.cellNode.setCapture){e.cellNode.setCapture();}m.onMouseDown(e);},doResizeColumn:function(_577,_578,_579){var _57a=_579.l;var data={deltaX:_57a,w:_577.w+(_4._isBodyLtr()?_57a:-_57a),vw:_577.vw+_57a,tw:_577.tw+_57a};this.dragRecord={inDrag:_577,mover:_578,leftTop:_579};if(data.w>=this.minColWidth){if(!_578){this.doResizeNow(_577,data);}else{_4.style(this.lineDiv,"left",(this.lineDiv._origLeft+data.deltaX)+"px");}}},endResizeColumn:function(_57b){if(this.dragRecord){var _57c=this.dragRecord.leftTop;var _57d=_4._isBodyLtr()?_57c.l:-_57c.l;_57d+=Math.max(_57b.w+_57d,this.minColWidth)-(_57b.w+_57d);if(_4.isWebKit&&_57b.spanners.length){_57d+=_4._getPadBorderExtents(_57b.spanners[0].node).w;}var data={deltaX:_57d,w:_57b.w+_57d,vw:_57b.vw+_57d,tw:_57b.tw+_57d};this.doResizeNow(_57b,data);delete this.dragRecord;}_4.destroy(this.lineDiv);_4.destroy(this.moverDiv);_4.destroy(this.moverDiv);delete this.moverDiv;this._skipBogusClicks=true;_57b.view.update();this._skipBogusClicks=false;this.grid.onResizeColumn(_57b.index);},doResizeNow:function(_57e,data){_57e.view.convertColPctToFixed();if(_57e.view.flexCells&&!_57e.view.testFlexCells()){var t=_54d(_57e.node);if(t){(t.style.width="");}}var i,s,sw,f,fl;for(i=0;(s=_57e.spanners[i]);i++){sw=s.width+data.deltaX;if(sw>0){s.node.style.width=sw+"px";_57e.view.setColWidth(s.index,sw);}}if(_4._isBodyLtr()||!_4.isIE){for(i=0;(f=_57e.followers[i]);i++){fl=f.left+data.deltaX;f.node.style.left=fl+"px";}}_57e.node.style.width=data.w+"px";_57e.view.setColWidth(_57e.index,data.w);_57e.view.headerNode.style.width=data.vw+"px";_57e.view.setColumnsWidth(data.tw);if(!_4._isBodyLtr()){_57e.view.headerNode.scrollLeft=_57e.scrollLeft+data.deltaX;}}});dg._TableMap=_4.extend(function(rows){this.mapRows(rows);},{map:null,mapRows:function(_57f){var _580=_57f.length;if(!_580){return;}this.map=[];var row;for(var k=0;(row=_57f[k]);k++){this.map[k]=[];}for(var j=0;(row=_57f[j]);j++){for(var i=0,x=0,cell,_581,_582;(cell=row[i]);i++){while(this.map[j][x]){x++;}this.map[j][x]={c:i,r:j};_582=cell.rowSpan||1;_581=cell.colSpan||1;for(var y=0;y<_582;y++){for(var s=0;s<_581;s++){this.map[j+y][x+s]=this.map[j][x];}}x+=_581;}}},dumpMap:function(){for(var j=0,row,h="";(row=this.map[j]);j++,h=""){for(var i=0,cell;(cell=row[i]);i++){h+=cell.r+","+cell.c+"   ";}}},getMapCoords:function(_583,_584){for(var j=0,row;(row=this.map[j]);j++){for(var i=0,cell;(cell=row[i]);i++){if(cell.c==_584&&cell.r==_583){return {j:j,i:i};}}}return {j:-1,i:-1};},getNode:function(_585,_586,_587){var row=_585&&_585.rows[_586];return row&&row.cells[_587];},_findOverlappingNodes:function(_588,_589,_58a){var _58b=[];var m=this.getMapCoords(_589,_58a);for(var j=0,row;(row=this.map[j]);j++){if(j==m.j){continue;}var rw=row[m.i];var n=(rw?this.getNode(_588,rw.r,rw.c):null);if(n){_58b.push(n);}}return _58b;},findOverlappingNodes:function(_58c){return this._findOverlappingNodes(_54d(_58c),_549(_58c.parentNode),_548(_58c));}});})();}if(!_4._hasResource["dojo.dnd.Container"]){_4._hasResource["dojo.dnd.Container"]=true;_4.provide("dojo.dnd.Container");_4.declare("dojo.dnd.Container",null,{skipForm:false,constructor:function(node,_58d){this.node=_4.byId(node);if(!_58d){_58d={};}this.creator=_58d.creator||null;this.skipForm=_58d.skipForm;this.parent=_58d.dropParent&&_4.byId(_58d.dropParent);this.map={};this.current=null;this.containerState="";_4.addClass(this.node,"dojoDndContainer");if(!(_58d&&_58d._skipStartup)){this.startup();}this.events=[_4.connect(this.node,"onmouseover",this,"onMouseOver"),_4.connect(this.node,"onmouseout",this,"onMouseOut"),_4.connect(this.node,"ondragstart",this,"onSelectStart"),_4.connect(this.node,"onselectstart",this,"onSelectStart")];},creator:function(){},getItem:function(key){return this.map[key];},setItem:function(key,data){this.map[key]=data;},delItem:function(key){delete this.map[key];},forInItems:function(f,o){o=o||_4.global;var m=this.map,e=_4.dnd._empty;for(var i in m){if(i in e){continue;}f.call(o,m[i],i,this);}return o;},clearItems:function(){this.map={};},getAllNodes:function(){return _4.query("> .dojoDndItem",this.parent);},sync:function(){var map={};this.getAllNodes().forEach(function(node){if(node.id){var item=this.getItem(node.id);if(item){map[node.id]=item;return;}}else{node.id=_4.dnd.getUniqueId();}var type=node.getAttribute("dndType"),data=node.getAttribute("dndData");map[node.id]={data:data||node.innerHTML,type:type?type.split(/\s*,\s*/):["text"]};},this);this.map=map;return this;},insertNodes:function(data,_58e,_58f){if(!this.parent.firstChild){_58f=null;}else{if(_58e){if(!_58f){_58f=this.parent.firstChild;}}else{if(_58f){_58f=_58f.nextSibling;}}}if(_58f){for(var i=0;i<data.length;++i){var t=this._normalizedCreator(data[i]);this.setItem(t.node.id,{data:t.data,type:t.type});this.parent.insertBefore(t.node,_58f);}}else{for(var i=0;i<data.length;++i){var t=this._normalizedCreator(data[i]);this.setItem(t.node.id,{data:t.data,type:t.type});this.parent.appendChild(t.node);}}return this;},destroy:function(){_4.forEach(this.events,_4.disconnect);this.clearItems();this.node=this.parent=this.current=null;},markupFactory:function(_590,node){_590._skipStartup=true;return new _4.dnd.Container(node,_590);},startup:function(){if(!this.parent){this.parent=this.node;if(this.parent.tagName.toLowerCase()=="table"){var c=this.parent.getElementsByTagName("tbody");if(c&&c.length){this.parent=c[0];}}}this.defaultCreator=_4.dnd._defaultCreator(this.parent);this.sync();},onMouseOver:function(e){var n=e.relatedTarget;while(n){if(n==this.node){break;}try{n=n.parentNode;}catch(x){n=null;}}if(!n){this._changeState("Container","Over");this.onOverEvent();}n=this._getChildByEvent(e);if(this.current==n){return;}if(this.current){this._removeItemClass(this.current,"Over");}if(n){this._addItemClass(n,"Over");}this.current=n;},onMouseOut:function(e){for(var n=e.relatedTarget;n;){if(n==this.node){return;}try{n=n.parentNode;}catch(x){n=null;}}if(this.current){this._removeItemClass(this.current,"Over");this.current=null;}this._changeState("Container","");this.onOutEvent();},onSelectStart:function(e){if(!this.skipForm||!_4.dnd.isFormElement(e)){_4.stopEvent(e);}},onOverEvent:function(){},onOutEvent:function(){},_changeState:function(type,_591){var _592="dojoDnd"+type;var _593=type.toLowerCase()+"State";_4.replaceClass(this.node,_592+_591,_592+this[_593]);this[_593]=_591;},_addItemClass:function(node,type){_4.addClass(node,"dojoDndItem"+type);},_removeItemClass:function(node,type){_4.removeClass(node,"dojoDndItem"+type);},_getChildByEvent:function(e){var node=e.target;if(node){for(var _594=node.parentNode;_594;node=_594,_594=node.parentNode){if(_594==this.parent&&_4.hasClass(node,"dojoDndItem")){return node;}}}return null;},_normalizedCreator:function(item,hint){var t=(this.creator||this.defaultCreator).call(this,item,hint);if(!_4.isArray(t.type)){t.type=["text"];}if(!t.node.id){t.node.id=_4.dnd.getUniqueId();}_4.addClass(t.node,"dojoDndItem");return t;}});_4.dnd._createNode=function(tag){if(!tag){return _4.dnd._createSpan;}return function(text){return _4.create(tag,{innerHTML:text});};};_4.dnd._createTrTd=function(text){var tr=_4.create("tr");_4.create("td",{innerHTML:text},tr);return tr;};_4.dnd._createSpan=function(text){return _4.create("span",{innerHTML:text});};_4.dnd._defaultCreatorNodes={ul:"li",ol:"li",div:"div",p:"div"};_4.dnd._defaultCreator=function(node){var tag=node.tagName.toLowerCase();var c=tag=="tbody"||tag=="thead"?_4.dnd._createTrTd:_4.dnd._createNode(_4.dnd._defaultCreatorNodes[tag]);return function(item,hint){var _595=item&&_4.isObject(item),data,type,n;if(_595&&item.tagName&&item.nodeType&&item.getAttribute){data=item.getAttribute("dndData")||item.innerHTML;type=item.getAttribute("dndType");type=type?type.split(/\s*,\s*/):["text"];n=item;}else{data=(_595&&item.data)?item.data:item;type=(_595&&item.type)?item.type:["text"];n=(hint=="avatar"?_4.dnd._createSpan:c)(String(data));}if(!n.id){n.id=_4.dnd.getUniqueId();}return {node:n,data:data,type:type};};};}if(!_4._hasResource["dojo.dnd.Selector"]){_4._hasResource["dojo.dnd.Selector"]=true;_4.provide("dojo.dnd.Selector");_4.declare("dojo.dnd.Selector",_4.dnd.Container,{constructor:function(node,_596){if(!_596){_596={};}this.singular=_596.singular;this.autoSync=_596.autoSync;this.selection={};this.anchor=null;this.simpleSelection=false;this.events.push(_4.connect(this.node,"onmousedown",this,"onMouseDown"),_4.connect(this.node,"onmouseup",this,"onMouseUp"));},singular:false,getSelectedNodes:function(){var t=new _4.NodeList();var e=_4.dnd._empty;for(var i in this.selection){if(i in e){continue;}t.push(_4.byId(i));}return t;},selectNone:function(){return this._removeSelection()._removeAnchor();},selectAll:function(){this.forInItems(function(data,id){this._addItemClass(_4.byId(id),"Selected");this.selection[id]=1;},this);return this._removeAnchor();},deleteSelectedNodes:function(){var e=_4.dnd._empty;for(var i in this.selection){if(i in e){continue;}var n=_4.byId(i);this.delItem(i);_4.destroy(n);}this.anchor=null;this.selection={};return this;},forInSelectedItems:function(f,o){o=o||_4.global;var s=this.selection,e=_4.dnd._empty;for(var i in s){if(i in e){continue;}f.call(o,this.getItem(i),i,this);}},sync:function(){_4.dnd.Selector.superclass.sync.call(this);if(this.anchor){if(!this.getItem(this.anchor.id)){this.anchor=null;}}var t=[],e=_4.dnd._empty;for(var i in this.selection){if(i in e){continue;}if(!this.getItem(i)){t.push(i);}}_4.forEach(t,function(i){delete this.selection[i];},this);return this;},insertNodes:function(_597,data,_598,_599){var _59a=this._normalizedCreator;this._normalizedCreator=function(item,hint){var t=_59a.call(this,item,hint);if(_597){if(!this.anchor){this.anchor=t.node;this._removeItemClass(t.node,"Selected");this._addItemClass(this.anchor,"Anchor");}else{if(this.anchor!=t.node){this._removeItemClass(t.node,"Anchor");this._addItemClass(t.node,"Selected");}}this.selection[t.node.id]=1;}else{this._removeItemClass(t.node,"Selected");this._removeItemClass(t.node,"Anchor");}return t;};_4.dnd.Selector.superclass.insertNodes.call(this,data,_598,_599);this._normalizedCreator=_59a;return this;},destroy:function(){_4.dnd.Selector.superclass.destroy.call(this);this.selection=this.anchor=null;},markupFactory:function(_59b,node){_59b._skipStartup=true;return new _4.dnd.Selector(node,_59b);},onMouseDown:function(e){if(this.autoSync){this.sync();}if(!this.current){return;}if(!this.singular&&!_4.isCopyKey(e)&&!e.shiftKey&&(this.current.id in this.selection)){this.simpleSelection=true;if(e.button===_4.mouseButtons.LEFT){_4.stopEvent(e);}return;}if(!this.singular&&e.shiftKey){if(!_4.isCopyKey(e)){this._removeSelection();}var c=this.getAllNodes();if(c.length){if(!this.anchor){this.anchor=c[0];this._addItemClass(this.anchor,"Anchor");}this.selection[this.anchor.id]=1;if(this.anchor!=this.current){var i=0;for(;i<c.length;++i){var node=c[i];if(node==this.anchor||node==this.current){break;}}for(++i;i<c.length;++i){var node=c[i];if(node==this.anchor||node==this.current){break;}this._addItemClass(node,"Selected");this.selection[node.id]=1;}this._addItemClass(this.current,"Selected");this.selection[this.current.id]=1;}}}else{if(this.singular){if(this.anchor==this.current){if(_4.isCopyKey(e)){this.selectNone();}}else{this.selectNone();this.anchor=this.current;this._addItemClass(this.anchor,"Anchor");this.selection[this.current.id]=1;}}else{if(_4.isCopyKey(e)){if(this.anchor==this.current){delete this.selection[this.anchor.id];this._removeAnchor();}else{if(this.current.id in this.selection){this._removeItemClass(this.current,"Selected");delete this.selection[this.current.id];}else{if(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;}}}else{if(!(this.current.id in this.selection)){this.selectNone();this.anchor=this.current;this._addItemClass(this.current,"Anchor");this.selection[this.current.id]=1;}}}}_4.stopEvent(e);},onMouseUp:function(e){if(!this.simpleSelection){return;}this.simpleSelection=false;this.selectNone();if(this.current){this.anchor=this.current;this._addItemClass(this.anchor,"Anchor");this.selection[this.current.id]=1;}},onMouseMove:function(e){this.simpleSelection=false;},onOverEvent:function(){this.onmousemoveEvent=_4.connect(this.node,"onmousemove",this,"onMouseMove");},onOutEvent:function(){_4.disconnect(this.onmousemoveEvent);delete this.onmousemoveEvent;},_removeSelection:function(){var e=_4.dnd._empty;for(var i in this.selection){if(i in e){continue;}var node=_4.byId(i);if(node){this._removeItemClass(node,"Selected");}}this.selection={};return this;},_removeAnchor:function(){if(this.anchor){this._removeItemClass(this.anchor,"Anchor");this.anchor=null;}return this;}});}if(!_4._hasResource["dojo.dnd.Avatar"]){_4._hasResource["dojo.dnd.Avatar"]=true;_4.provide("dojo.dnd.Avatar");_4.declare("dojo.dnd.Avatar",null,{constructor:function(_59c){this.manager=_59c;this.construct();},construct:function(){this.isA11y=_4.hasClass(_4.body(),"dijit_a11y");var a=_4.create("table",{"class":"dojoDndAvatar",style:{position:"absolute",zIndex:"1999",margin:"0px"}}),_59d=this.manager.source,node,b=_4.create("tbody",null,a),tr=_4.create("tr",null,b),td=_4.create("td",null,tr),icon=this.isA11y?_4.create("span",{id:"a11yIcon",innerHTML:this.manager.copy?"+":"<"},td):null,span=_4.create("span",{innerHTML:_59d.generateText?this._generateText():""},td),k=Math.min(5,this.manager.nodes.length),i=0;_4.attr(tr,{"class":"dojoDndAvatarHeader",style:{opacity:0.9}});for(;i<k;++i){if(_59d.creator){node=_59d._normalizedCreator(_59d.getItem(this.manager.nodes[i].id).data,"avatar").node;}else{node=this.manager.nodes[i].cloneNode(true);if(node.tagName.toLowerCase()=="tr"){var _59e=_4.create("table"),_59f=_4.create("tbody",null,_59e);_59f.appendChild(node);node=_59e;}}node.id="";tr=_4.create("tr",null,b);td=_4.create("td",null,tr);td.appendChild(node);_4.attr(tr,{"class":"dojoDndAvatarItem",style:{opacity:(9-i)/10}});}this.node=a;},destroy:function(){_4.destroy(this.node);this.node=false;},update:function(){_4[(this.manager.canDropFlag?"add":"remove")+"Class"](this.node,"dojoDndAvatarCanDrop");if(this.isA11y){var icon=_4.byId("a11yIcon");var text="+";if(this.manager.canDropFlag&&!this.manager.copy){text="< ";}else{if(!this.manager.canDropFlag&&!this.manager.copy){text="o";}else{if(!this.manager.canDropFlag){text="x";}}}icon.innerHTML=text;}_4.query(("tr.dojoDndAvatarHeader td span"+(this.isA11y?" span":"")),this.node).forEach(function(node){node.innerHTML=this._generateText();},this);},_generateText:function(){return this.manager.nodes.length.toString();}});}if(!_4._hasResource["dojo.dnd.Manager"]){_4._hasResource["dojo.dnd.Manager"]=true;_4.provide("dojo.dnd.Manager");_4.declare("dojo.dnd.Manager",null,{constructor:function(){this.avatar=null;this.source=null;this.nodes=[];this.copy=true;this.target=null;this.canDropFlag=false;this.events=[];},OFFSET_X:16,OFFSET_Y:16,overSource:function(_5a0){if(this.avatar){this.target=(_5a0&&_5a0.targetState!="Disabled")?_5a0:null;this.canDropFlag=Boolean(this.target);this.avatar.update();}_4.publish("/dnd/source/over",[_5a0]);},outSource:function(_5a1){if(this.avatar){if(this.target==_5a1){this.target=null;this.canDropFlag=false;this.avatar.update();_4.publish("/dnd/source/over",[null]);}}else{_4.publish("/dnd/source/over",[null]);}},startDrag:function(_5a2,_5a3,copy){this.source=_5a2;this.nodes=_5a3;this.copy=Boolean(copy);this.avatar=this.makeAvatar();_4.body().appendChild(this.avatar.node);_4.publish("/dnd/start",[_5a2,_5a3,this.copy]);this.events=[_4.connect(_4.doc,"onmousemove",this,"onMouseMove"),_4.connect(_4.doc,"onmouseup",this,"onMouseUp"),_4.connect(_4.doc,"onkeydown",this,"onKeyDown"),_4.connect(_4.doc,"onkeyup",this,"onKeyUp"),_4.connect(_4.doc,"ondragstart",_4.stopEvent),_4.connect(_4.body(),"onselectstart",_4.stopEvent)];var c="dojoDnd"+(copy?"Copy":"Move");_4.addClass(_4.body(),c);},canDrop:function(flag){var _5a4=Boolean(this.target&&flag);if(this.canDropFlag!=_5a4){this.canDropFlag=_5a4;this.avatar.update();}},stopDrag:function(){_4.removeClass(_4.body(),["dojoDndCopy","dojoDndMove"]);_4.forEach(this.events,_4.disconnect);this.events=[];this.avatar.destroy();this.avatar=null;this.source=this.target=null;this.nodes=[];},makeAvatar:function(){return new _4.dnd.Avatar(this);},updateAvatar:function(){this.avatar.update();},onMouseMove:function(e){var a=this.avatar;if(a){_4.dnd.autoScrollNodes(e);var s=a.node.style;s.left=(e.pageX+this.OFFSET_X)+"px";s.top=(e.pageY+this.OFFSET_Y)+"px";var copy=Boolean(this.source.copyState(_4.isCopyKey(e)));if(this.copy!=copy){this._setCopyStatus(copy);}}},onMouseUp:function(e){if(this.avatar){if(this.target&&this.canDropFlag){var copy=Boolean(this.source.copyState(_4.isCopyKey(e))),_5a5=[this.source,this.nodes,copy,this.target,e];_4.publish("/dnd/drop/before",_5a5);_4.publish("/dnd/drop",_5a5);}else{_4.publish("/dnd/cancel");}this.stopDrag();}},onKeyDown:function(e){if(this.avatar){switch(e.keyCode){case _4.keys.CTRL:var copy=Boolean(this.source.copyState(true));if(this.copy!=copy){this._setCopyStatus(copy);}break;case _4.keys.ESCAPE:_4.publish("/dnd/cancel");this.stopDrag();break;}}},onKeyUp:function(e){if(this.avatar&&e.keyCode==_4.keys.CTRL){var copy=Boolean(this.source.copyState(false));if(this.copy!=copy){this._setCopyStatus(copy);}}},_setCopyStatus:function(copy){this.copy=copy;this.source._markDndStatus(this.copy);this.updateAvatar();_4.replaceClass(_4.body(),"dojoDnd"+(this.copy?"Copy":"Move"),"dojoDnd"+(this.copy?"Move":"Copy"));}});_4.dnd._manager=null;_4.dnd.manager=function(){if(!_4.dnd._manager){_4.dnd._manager=new _4.dnd.Manager();}return _4.dnd._manager;};}if(!_4._hasResource["dojo.dnd.Source"]){_4._hasResource["dojo.dnd.Source"]=true;_4.provide("dojo.dnd.Source");_4.declare("dojo.dnd.Source",_4.dnd.Selector,{isSource:true,horizontal:false,copyOnly:false,selfCopy:false,selfAccept:true,skipForm:false,withHandles:false,autoSync:false,delay:0,accept:["text"],generateText:true,constructor:function(node,_5a6){_4.mixin(this,_4.mixin({},_5a6));var type=this.accept;if(type.length){this.accept={};for(var i=0;i<type.length;++i){this.accept[type[i]]=1;}}this.isDragging=false;this.mouseDown=false;this.targetAnchor=null;this.targetBox=null;this.before=true;this._lastX=0;this._lastY=0;this.sourceState="";if(this.isSource){_4.addClass(this.node,"dojoDndSource");}this.targetState="";if(this.accept){_4.addClass(this.node,"dojoDndTarget");}if(this.horizontal){_4.addClass(this.node,"dojoDndHorizontal");}this.topics=[_4.subscribe("/dnd/source/over",this,"onDndSourceOver"),_4.subscribe("/dnd/start",this,"onDndStart"),_4.subscribe("/dnd/drop",this,"onDndDrop"),_4.subscribe("/dnd/cancel",this,"onDndCancel")];},checkAcceptance:function(_5a7,_5a8){if(this==_5a7){return !this.copyOnly||this.selfAccept;}for(var i=0;i<_5a8.length;++i){var type=_5a7.getItem(_5a8[i].id).type;var flag=false;for(var j=0;j<type.length;++j){if(type[j] in this.accept){flag=true;break;}}if(!flag){return false;}}return true;},copyState:function(_5a9,self){if(_5a9){return true;}if(arguments.length<2){self=this==_4.dnd.manager().target;}if(self){if(this.copyOnly){return this.selfCopy;}}else{return this.copyOnly;}return false;},destroy:function(){_4.dnd.Source.superclass.destroy.call(this);_4.forEach(this.topics,_4.unsubscribe);this.targetAnchor=null;},markupFactory:function(_5aa,node){_5aa._skipStartup=true;return new _4.dnd.Source(node,_5aa);},onMouseMove:function(e){if(this.isDragging&&this.targetState=="Disabled"){return;}_4.dnd.Source.superclass.onMouseMove.call(this,e);var m=_4.dnd.manager();if(!this.isDragging){if(this.mouseDown&&this.isSource&&(Math.abs(e.pageX-this._lastX)>this.delay||Math.abs(e.pageY-this._lastY)>this.delay)){var _5ab=this.getSelectedNodes();if(_5ab.length){m.startDrag(this,_5ab,this.copyState(_4.isCopyKey(e),true));}}}if(this.isDragging){var _5ac=false;if(this.current){if(!this.targetBox||this.targetAnchor!=this.current){this.targetBox=_4.position(this.current,true);}if(this.horizontal){_5ac=(e.pageX-this.targetBox.x)<(this.targetBox.w/2);}else{_5ac=(e.pageY-this.targetBox.y)<(this.targetBox.h/2);}}if(this.current!=this.targetAnchor||_5ac!=this.before){this._markTargetAnchor(_5ac);m.canDrop(!this.current||m.source!=this||!(this.current.id in this.selection));}}},onMouseDown:function(e){if(!this.mouseDown&&this._legalMouseDown(e)&&(!this.skipForm||!_4.dnd.isFormElement(e))){this.mouseDown=true;this._lastX=e.pageX;this._lastY=e.pageY;_4.dnd.Source.superclass.onMouseDown.call(this,e);}},onMouseUp:function(e){if(this.mouseDown){this.mouseDown=false;_4.dnd.Source.superclass.onMouseUp.call(this,e);}},onDndSourceOver:function(_5ad){if(this!=_5ad){this.mouseDown=false;if(this.targetAnchor){this._unmarkTargetAnchor();}}else{if(this.isDragging){var m=_4.dnd.manager();m.canDrop(this.targetState!="Disabled"&&(!this.current||m.source!=this||!(this.current.id in this.selection)));}}},onDndStart:function(_5ae,_5af,copy){if(this.autoSync){this.sync();}if(this.isSource){this._changeState("Source",this==_5ae?(copy?"Copied":"Moved"):"");}var _5b0=this.accept&&this.checkAcceptance(_5ae,_5af);this._changeState("Target",_5b0?"":"Disabled");if(this==_5ae){_4.dnd.manager().overSource(this);}this.isDragging=true;},onDndDrop:function(_5b1,_5b2,copy,_5b3){if(this==_5b3){this.onDrop(_5b1,_5b2,copy);}this.onDndCancel();},onDndCancel:function(){if(this.targetAnchor){this._unmarkTargetAnchor();this.targetAnchor=null;}this.before=true;this.isDragging=false;this.mouseDown=false;this._changeState("Source","");this._changeState("Target","");},onDrop:function(_5b4,_5b5,copy){if(this!=_5b4){this.onDropExternal(_5b4,_5b5,copy);}else{this.onDropInternal(_5b5,copy);}},onDropExternal:function(_5b6,_5b7,copy){var _5b8=this._normalizedCreator;if(this.creator){this._normalizedCreator=function(node,hint){return _5b8.call(this,_5b6.getItem(node.id).data,hint);};}else{if(copy){this._normalizedCreator=function(node,hint){var t=_5b6.getItem(node.id);var n=node.cloneNode(true);n.id=_4.dnd.getUniqueId();return {node:n,data:t.data,type:t.type};};}else{this._normalizedCreator=function(node,hint){var t=_5b6.getItem(node.id);_5b6.delItem(node.id);return {node:node,data:t.data,type:t.type};};}}this.selectNone();if(!copy&&!this.creator){_5b6.selectNone();}this.insertNodes(true,_5b7,this.before,this.current);if(!copy&&this.creator){_5b6.deleteSelectedNodes();}this._normalizedCreator=_5b8;},onDropInternal:function(_5b9,copy){var _5ba=this._normalizedCreator;if(this.current&&this.current.id in this.selection){return;}if(copy){if(this.creator){this._normalizedCreator=function(node,hint){return _5ba.call(this,this.getItem(node.id).data,hint);};}else{this._normalizedCreator=function(node,hint){var t=this.getItem(node.id);var n=node.cloneNode(true);n.id=_4.dnd.getUniqueId();return {node:n,data:t.data,type:t.type};};}}else{if(!this.current){return;}this._normalizedCreator=function(node,hint){var t=this.getItem(node.id);return {node:node,data:t.data,type:t.type};};}this._removeSelection();this.insertNodes(true,_5b9,this.before,this.current);this._normalizedCreator=_5ba;},onDraggingOver:function(){},onDraggingOut:function(){},onOverEvent:function(){_4.dnd.Source.superclass.onOverEvent.call(this);_4.dnd.manager().overSource(this);if(this.isDragging&&this.targetState!="Disabled"){this.onDraggingOver();}},onOutEvent:function(){_4.dnd.Source.superclass.onOutEvent.call(this);_4.dnd.manager().outSource(this);if(this.isDragging&&this.targetState!="Disabled"){this.onDraggingOut();}},_markTargetAnchor:function(_5bb){if(this.current==this.targetAnchor&&this.before==_5bb){return;}if(this.targetAnchor){this._removeItemClass(this.targetAnchor,this.before?"Before":"After");}this.targetAnchor=this.current;this.targetBox=null;this.before=_5bb;if(this.targetAnchor){this._addItemClass(this.targetAnchor,this.before?"Before":"After");}},_unmarkTargetAnchor:function(){if(!this.targetAnchor){return;}this._removeItemClass(this.targetAnchor,this.before?"Before":"After");this.targetAnchor=null;this.targetBox=null;this.before=true;},_markDndStatus:function(copy){this._changeState("Source",copy?"Copied":"Moved");},_legalMouseDown:function(e){if(!_4.mouseButtons.isLeft(e)){return false;}if(!this.withHandles){return true;}for(var node=e.target;node&&node!==this.node;node=node.parentNode){if(_4.hasClass(node,"dojoDndHandle")){return true;}if(_4.hasClass(node,"dojoDndItem")||_4.hasClass(node,"dojoDndIgnore")){break;}}return false;}});_4.declare("dojo.dnd.Target",_4.dnd.Source,{constructor:function(node,_5bc){this.isSource=false;_4.removeClass(this.node,"dojoDndSource");},markupFactory:function(_5bd,node){_5bd._skipStartup=true;return new _4.dnd.Target(node,_5bd);}});_4.declare("dojo.dnd.AutoSource",_4.dnd.Source,{constructor:function(node,_5be){this.autoSync=true;},markupFactory:function(_5bf,node){_5bf._skipStartup=true;return new _4.dnd.AutoSource(node,_5bf);}});}if(!_4._hasResource["dojox.grid._View"]){_4._hasResource["dojox.grid._View"]=true;_4.provide("dojox.grid._View");(function(){var _5c0=function(_5c1,_5c2){return _5c1.style.cssText==undefined?_5c1.getAttribute("style"):_5c1.style.cssText;};_4.declare("dojox.grid._View",[_5._Widget,_5._Templated],{defaultWidth:"18em",viewWidth:"",templateString:"<div class=\"dojoxGridView\" role=\"presentation\">\r\n\t<div class=\"dojoxGridHeader\" dojoAttachPoint=\"headerNode\" role=\"presentation\">\r\n\t\t<div dojoAttachPoint=\"headerNodeContainer\" style=\"width:9000em\" role=\"presentation\">\r\n\t\t\t<div dojoAttachPoint=\"headerContentNode\" role=\"row\"></div>\r\n\t\t</div>\r\n\t</div>\r\n\t<input type=\"checkbox\" class=\"dojoxGridHiddenFocus\" dojoAttachPoint=\"hiddenFocusNode\" role=\"presentation\" />\r\n\t<input type=\"checkbox\" class=\"dojoxGridHiddenFocus\" role=\"presentation\" />\r\n\t<div class=\"dojoxGridScrollbox\" dojoAttachPoint=\"scrollboxNode\" role=\"presentation\">\r\n\t\t<div class=\"dojoxGridContent\" dojoAttachPoint=\"contentNode\" hidefocus=\"hidefocus\" role=\"presentation\"></div>\r\n\t</div>\r\n</div>\r\n",themeable:false,classTag:"dojoxGrid",marginBottom:0,rowPad:2,_togglingColumn:-1,_headerBuilderClass:_6.grid._HeaderBuilder,_contentBuilderClass:_6.grid._ContentBuilder,postMixInProperties:function(){this.rowNodes={};},postCreate:function(){this.connect(this.scrollboxNode,"onscroll","doscroll");_6.grid.util.funnelEvents(this.contentNode,this,"doContentEvent",["mouseover","mouseout","click","dblclick","contextmenu","mousedown"]);_6.grid.util.funnelEvents(this.headerNode,this,"doHeaderEvent",["dblclick","mouseover","mouseout","mousemove","mousedown","click","contextmenu"]);this.content=new this._contentBuilderClass(this);this.header=new this._headerBuilderClass(this);if(!_4._isBodyLtr()){this.headerNodeContainer.style.width="";}},destroy:function(){_4.destroy(this.headerNode);delete this.headerNode;for(var i in this.rowNodes){_4.destroy(this.rowNodes[i]);}this.rowNodes={};if(this.source){this.source.destroy();}this.inherited(arguments);},focus:function(){if(_4.isIE||_4.isWebKit||_4.isOpera){this.hiddenFocusNode.focus();}else{this.scrollboxNode.focus();}},setStructure:function(_5c3){var vs=(this.structure=_5c3);if(vs.width&&!isNaN(vs.width)){this.viewWidth=vs.width+"em";}else{this.viewWidth=vs.width||(vs.noscroll?"auto":this.viewWidth);}this._onBeforeRow=vs.onBeforeRow||function(){};this._onAfterRow=vs.onAfterRow||function(){};this.noscroll=vs.noscroll;if(this.noscroll){this.scrollboxNode.style.overflow="hidden";}this.simpleStructure=Boolean(vs.cells.length==1);this.testFlexCells();this.updateStructure();},_cleanupRowWidgets:function(_5c4){if(_5c4){_4.forEach(_4.query("[widgetId]",_5c4).map(_5.byNode),function(w){if(w._destroyOnRemove){w.destroy();delete w;}else{if(w.domNode&&w.domNode.parentNode){w.domNode.parentNode.removeChild(w.domNode);}}});}},onBeforeRow:function(_5c5,_5c6){this._onBeforeRow(_5c5,_5c6);if(_5c5>=0){this._cleanupRowWidgets(this.getRowNode(_5c5));}},onAfterRow:function(_5c7,_5c8,_5c9){this._onAfterRow(_5c7,_5c8,_5c9);var g=this.grid;_4.forEach(_4.query(".dojoxGridStubNode",_5c9),function(n){if(n&&n.parentNode){var lw=n.getAttribute("linkWidget");var _5ca=window.parseInt(_4.attr(n,"cellIdx"),10);var _5cb=g.getCell(_5ca);var w=_5.byId(lw);if(w){n.parentNode.replaceChild(w.domNode,n);if(!w._started){w.startup();}}else{n.innerHTML="";}}},this);},testFlexCells:function(){this.flexCells=false;for(var j=0,row;(row=this.structure.cells[j]);j++){for(var i=0,cell;(cell=row[i]);i++){cell.view=this;this.flexCells=this.flexCells||cell.isFlex();}}return this.flexCells;},updateStructure:function(){this.header.update();this.content.update();},getScrollbarWidth:function(){var _5cc=this.hasVScrollbar();var _5cd=_4.style(this.scrollboxNode,"overflow");if(this.noscroll||!_5cd||_5cd=="hidden"){_5cc=false;}else{if(_5cd=="scroll"){_5cc=true;}}return (_5cc?_6.html.metrics.getScrollbar().w:0);},getColumnsWidth:function(){var h=this.headerContentNode;return h&&h.firstChild?h.firstChild.offsetWidth:0;},setColumnsWidth:function(_5ce){this.headerContentNode.firstChild.style.width=_5ce+"px";if(this.viewWidth){this.viewWidth=_5ce+"px";}},getWidth:function(){return this.viewWidth||(this.getColumnsWidth()+this.getScrollbarWidth())+"px";},getContentWidth:function(){return Math.max(0,_4._getContentBox(this.domNode).w-this.getScrollbarWidth())+"px";},render:function(){this.scrollboxNode.style.height="";this.renderHeader();if(this._togglingColumn>=0){this.setColumnsWidth(this.getColumnsWidth()-this._togglingColumn);this._togglingColumn=-1;}var _5cf=this.grid.layout.cells;var _5d0=_4.hitch(this,function(node,_5d1){!_4._isBodyLtr()&&(_5d1=!_5d1);var inc=_5d1?-1:1;var idx=this.header.getCellNodeIndex(node)+inc;var cell=_5cf[idx];while(cell&&cell.getHeaderNode()&&cell.getHeaderNode().style.display=="none"){idx+=inc;cell=_5cf[idx];}if(cell){return cell.getHeaderNode();}return null;});if(this.grid.columnReordering&&this.simpleStructure){if(this.source){this.source.destroy();}var _5d2="dojoxGrid_bottomMarker";var _5d3="dojoxGrid_topMarker";if(this.bottomMarker){_4.destroy(this.bottomMarker);}this.bottomMarker=_4.byId(_5d2);if(this.topMarker){_4.destroy(this.topMarker);}this.topMarker=_4.byId(_5d3);if(!this.bottomMarker){this.bottomMarker=_4.create("div",{"id":_5d2,"class":"dojoxGridColPlaceBottom"},_4.body());this._hide(this.bottomMarker);this.topMarker=_4.create("div",{"id":_5d3,"class":"dojoxGridColPlaceTop"},_4.body());this._hide(this.topMarker);}this.arrowDim=_4.contentBox(this.bottomMarker);var _5d4=_4.contentBox(this.headerContentNode.firstChild.rows[0]).h;this.source=new _4.dnd.Source(this.headerContentNode.firstChild.rows[0],{horizontal:true,accept:["gridColumn_"+this.grid.id],viewIndex:this.index,generateText:false,onMouseDown:_4.hitch(this,function(e){this.header.decorateEvent(e);if((this.header.overRightResizeArea(e)||this.header.overLeftResizeArea(e))&&this.header.canResize(e)&&!this.header.moveable){this.header.beginColumnResize(e);}else{if(this.grid.headerMenu){this.grid.headerMenu.onCancel(true);}if(e.button===(_4.isIE?1:0)){_4.dnd.Source.prototype.onMouseDown.call(this.source,e);}}}),onMouseOver:_4.hitch(this,function(e){var src=this.source;if(src._getChildByEvent(e)){_4.dnd.Source.prototype.onMouseOver.apply(src,arguments);}}),_markTargetAnchor:_4.hitch(this,function(_5d5){var src=this.source;if(src.current==src.targetAnchor&&src.before==_5d5){return;}if(src.targetAnchor&&_5d0(src.targetAnchor,src.before)){src._removeItemClass(_5d0(src.targetAnchor,src.before),src.before?"After":"Before");}_4.dnd.Source.prototype._markTargetAnchor.call(src,_5d5);var _5d6=_5d5?src.targetAnchor:_5d0(src.targetAnchor,src.before);var _5d7=0;if(!_5d6){_5d6=src.targetAnchor;_5d7=_4.contentBox(_5d6).w+this.arrowDim.w/2+2;}var pos=(_4.position||_4._abs)(_5d6,true);var left=Math.floor(pos.x-this.arrowDim.w/2+_5d7);_4.style(this.bottomMarker,"visibility","visible");_4.style(this.topMarker,"visibility","visible");_4.style(this.bottomMarker,{"left":left+"px","top":(_5d4+pos.y)+"px"});_4.style(this.topMarker,{"left":left+"px","top":(pos.y-this.arrowDim.h)+"px"});if(src.targetAnchor&&_5d0(src.targetAnchor,src.before)){src._addItemClass(_5d0(src.targetAnchor,src.before),src.before?"After":"Before");}}),_unmarkTargetAnchor:_4.hitch(this,function(){var src=this.source;if(!src.targetAnchor){return;}if(src.targetAnchor&&_5d0(src.targetAnchor,src.before)){src._removeItemClass(_5d0(src.targetAnchor,src.before),src.before?"After":"Before");}this._hide(this.bottomMarker);this._hide(this.topMarker);_4.dnd.Source.prototype._unmarkTargetAnchor.call(src);}),destroy:_4.hitch(this,function(){_4.disconnect(this._source_conn);_4.unsubscribe(this._source_sub);_4.dnd.Source.prototype.destroy.call(this.source);if(this.bottomMarker){_4.destroy(this.bottomMarker);delete this.bottomMarker;}if(this.topMarker){_4.destroy(this.topMarker);delete this.topMarker;}}),onDndCancel:_4.hitch(this,function(){_4.dnd.Source.prototype.onDndCancel.call(this.source);this._hide(this.bottomMarker);this._hide(this.topMarker);})});this._source_conn=_4.connect(this.source,"onDndDrop",this,"_onDndDrop");this._source_sub=_4.subscribe("/dnd/drop/before",this,"_onDndDropBefore");this.source.startup();}},_hide:function(node){_4.style(node,{left:"-10000px",top:"-10000px","visibility":"hidden"});},_onDndDropBefore:function(_5d8,_5d9,copy){if(_4.dnd.manager().target!==this.source){return;}this.source._targetNode=this.source.targetAnchor;this.source._beforeTarget=this.source.before;var _5da=this.grid.views.views;var _5db=_5da[_5d8.viewIndex];var _5dc=_5da[this.index];if(_5dc!=_5db){_5db.convertColPctToFixed();_5dc.convertColPctToFixed();}},_onDndDrop:function(_5dd,_5de,copy){if(_4.dnd.manager().target!==this.source){if(_4.dnd.manager().source===this.source){this._removingColumn=true;}return;}this._hide(this.bottomMarker);this._hide(this.topMarker);var _5df=function(n){return n?_4.attr(n,"idx"):null;};var w=_4.marginBox(_5de[0]).w;if(_5dd.viewIndex!==this.index){var _5e0=this.grid.views.views;var _5e1=_5e0[_5dd.viewIndex];var _5e2=_5e0[this.index];if(_5e1.viewWidth&&_5e1.viewWidth!="auto"){_5e1.setColumnsWidth(_5e1.getColumnsWidth()-w);}if(_5e2.viewWidth&&_5e2.viewWidth!="auto"){_5e2.setColumnsWidth(_5e2.getColumnsWidth());}}var stn=this.source._targetNode;var stb=this.source._beforeTarget;!_4._isBodyLtr()&&(stb=!stb);var _5e3=this.grid.layout;var idx=this.index;delete this.source._targetNode;delete this.source._beforeTarget;_5e3.moveColumn(_5dd.viewIndex,idx,_5df(_5de[0]),_5df(stn),stb);},renderHeader:function(){this.headerContentNode.innerHTML=this.header.generateHtml(this._getHeaderContent);if(this.flexCells){this.contentWidth=this.getContentWidth();this.headerContentNode.firstChild.style.width=this.contentWidth;}_6.grid.util.fire(this,"onAfterRow",[-1,this.structure.cells,this.headerContentNode]);},_getHeaderContent:function(_5e4){var n=_5e4.name||_5e4.grid.getCellName(_5e4);var ret=["<div class=\"dojoxGridSortNode"];if(_5e4.index!=_5e4.grid.getSortIndex()){ret.push("\">");}else{ret=ret.concat([" ",_5e4.grid.sortInfo>0?"dojoxGridSortUp":"dojoxGridSortDown","\"><div class=\"dojoxGridArrowButtonChar\">",_5e4.grid.sortInfo>0?"&#9650;":"&#9660;","</div><div class=\"dojoxGridArrowButtonNode\" role=\"presentation\"></div>","<div class=\"dojoxGridColCaption\">"]);}ret=ret.concat([n,"</div></div>"]);return ret.join("");},resize:function(){this.adaptHeight();this.adaptWidth();},hasHScrollbar:function(_5e5){var _5e6=this._hasHScroll||false;if(this._hasHScroll==undefined||_5e5){if(this.noscroll){this._hasHScroll=false;}else{var _5e7=_4.style(this.scrollboxNode,"overflow");if(_5e7=="hidden"){this._hasHScroll=false;}else{if(_5e7=="scroll"){this._hasHScroll=true;}else{this._hasHScroll=(this.scrollboxNode.offsetWidth-this.getScrollbarWidth()<this.contentNode.offsetWidth);}}}}if(_5e6!==this._hasHScroll){this.grid.update();}return this._hasHScroll;},hasVScrollbar:function(_5e8){var _5e9=this._hasVScroll||false;if(this._hasVScroll==undefined||_5e8){if(this.noscroll){this._hasVScroll=false;}else{var _5ea=_4.style(this.scrollboxNode,"overflow");if(_5ea=="hidden"){this._hasVScroll=false;}else{if(_5ea=="scroll"){this._hasVScroll=true;}else{this._hasVScroll=(this.scrollboxNode.scrollHeight>this.scrollboxNode.clientHeight);}}}}if(_5e9!==this._hasVScroll){this.grid.update();}return this._hasVScroll;},convertColPctToFixed:function(){var _5eb=false;this.grid.initialWidth="";var _5ec=_4.query("th",this.headerContentNode);var _5ed=_4.map(_5ec,function(c,vIdx){var w=c.style.width;_4.attr(c,"vIdx",vIdx);if(w&&w.slice(-1)=="%"){_5eb=true;}else{if(w&&w.slice(-2)=="px"){return window.parseInt(w,10);}}return _4.contentBox(c).w;});if(_5eb){_4.forEach(this.grid.layout.cells,function(cell,idx){if(cell.view==this){var _5ee=cell.view.getHeaderCellNode(cell.index);if(_5ee&&_4.hasAttr(_5ee,"vIdx")){var vIdx=window.parseInt(_4.attr(_5ee,"vIdx"));this.setColWidth(idx,_5ed[vIdx]);_4.removeAttr(_5ee,"vIdx");}}},this);return true;}return false;},adaptHeight:function(_5ef){if(!this.grid._autoHeight){var h=(this.domNode.style.height&&parseInt(this.domNode.style.height.replace(/px/,""),10))||this.domNode.clientHeight;var self=this;var _5f0=function(){var v;for(var i in self.grid.views.views){v=self.grid.views.views[i];if(v!==self&&v.hasHScrollbar()){return true;}}return false;};if(_5ef||(this.noscroll&&_5f0())){h-=_6.html.metrics.getScrollbar().h;}_6.grid.util.setStyleHeightPx(this.scrollboxNode,h);}this.hasVScrollbar(true);},adaptWidth:function(){if(this.flexCells){this.contentWidth=this.getContentWidth();this.headerContentNode.firstChild.style.width=this.contentWidth;}var w=this.scrollboxNode.offsetWidth-this.getScrollbarWidth();if(!this._removingColumn){w=Math.max(w,this.getColumnsWidth())+"px";}else{w=Math.min(w,this.getColumnsWidth())+"px";this._removingColumn=false;}var cn=this.contentNode;cn.style.width=w;this.hasHScrollbar(true);},setSize:function(w,h){var ds=this.domNode.style;var hs=this.headerNode.style;if(w){ds.width=w;hs.width=w;}ds.height=(h>=0?h+"px":"");},renderRow:function(_5f1){var _5f2=this.createRowNode(_5f1);this.buildRow(_5f1,_5f2);this.grid.edit.restore(this,_5f1);return _5f2;},createRowNode:function(_5f3){var node=document.createElement("div");node.className=this.classTag+"Row";if(this instanceof _6.grid._RowSelector){_4.attr(node,"role","presentation");}else{_4.attr(node,"role","row");if(this.grid.selectionMode!="none"){_4.attr(node,"aria-selected","false");}}node[_6.grid.util.gridViewTag]=this.id;node[_6.grid.util.rowIndexTag]=_5f3;this.rowNodes[_5f3]=node;return node;},buildRow:function(_5f4,_5f5){this.buildRowContent(_5f4,_5f5);this.styleRow(_5f4,_5f5);},buildRowContent:function(_5f6,_5f7){_5f7.innerHTML=this.content.generateHtml(_5f6,_5f6);if(this.flexCells&&this.contentWidth){_5f7.firstChild.style.width=this.contentWidth;}_6.grid.util.fire(this,"onAfterRow",[_5f6,this.structure.cells,_5f7]);},rowRemoved:function(_5f8){if(_5f8>=0){this._cleanupRowWidgets(this.getRowNode(_5f8));}this.grid.edit.save(this,_5f8);delete this.rowNodes[_5f8];},getRowNode:function(_5f9){return this.rowNodes[_5f9];},getCellNode:function(_5fa,_5fb){var row=this.getRowNode(_5fa);if(row){return this.content.getCellNode(row,_5fb);}},getHeaderCellNode:function(_5fc){if(this.headerContentNode){return this.header.getCellNode(this.headerContentNode,_5fc);}},styleRow:function(_5fd,_5fe){_5fe._style=_5c0(_5fe);this.styleRowNode(_5fd,_5fe);},styleRowNode:function(_5ff,_600){if(_600){this.doStyleRowNode(_5ff,_600);}},doStyleRowNode:function(_601,_602){this.grid.styleRowNode(_601,_602);},updateRow:function(_603){var _604=this.getRowNode(_603);if(_604){_604.style.height="";this.buildRow(_603,_604);}return _604;},updateRowStyles:function(_605){this.styleRowNode(_605,this.getRowNode(_605));},lastTop:0,firstScroll:0,doscroll:function(_606){var _607=_4._isBodyLtr();if(this.firstScroll<2){if((!_607&&this.firstScroll==1)||(_607&&this.firstScroll===0)){var s=_4.marginBox(this.headerNodeContainer);if(_4.isIE){this.headerNodeContainer.style.width=s.w+this.getScrollbarWidth()+"px";}else{if(_4.isMoz){this.headerNodeContainer.style.width=s.w-this.getScrollbarWidth()+"px";this.scrollboxNode.scrollLeft=_607?this.scrollboxNode.clientWidth-this.scrollboxNode.scrollWidth:this.scrollboxNode.scrollWidth-this.scrollboxNode.clientWidth;}}}this.firstScroll++;}this.headerNode.scrollLeft=this.scrollboxNode.scrollLeft;var top=this.scrollboxNode.scrollTop;if(top!==this.lastTop){this.grid.scrollTo(top);}},setScrollTop:function(_608){this.lastTop=_608;this.scrollboxNode.scrollTop=_608;return this.scrollboxNode.scrollTop;},doContentEvent:function(e){if(this.content.decorateEvent(e)){this.grid.onContentEvent(e);}},doHeaderEvent:function(e){if(this.header.decorateEvent(e)){this.grid.onHeaderEvent(e);}},dispatchContentEvent:function(e){return this.content.dispatchEvent(e);},dispatchHeaderEvent:function(e){return this.header.dispatchEvent(e);},setColWidth:function(_609,_60a){this.grid.setCellWidth(_609,_60a+"px");},update:function(){if(!this.domNode){return;}this.content.update();this.grid.update();var left=this.scrollboxNode.scrollLeft;this.scrollboxNode.scrollLeft=left;this.headerNode.scrollLeft=left;}});_4.declare("dojox.grid._GridAvatar",_4.dnd.Avatar,{construct:function(){var dd=_4.doc;var a=dd.createElement("table");a.cellPadding=a.cellSpacing="0";a.className="dojoxGridDndAvatar";a.style.position="absolute";a.style.zIndex=1999;a.style.margin="0px";var b=dd.createElement("tbody");var tr=dd.createElement("tr");var td=dd.createElement("td");var img=dd.createElement("td");tr.className="dojoxGridDndAvatarItem";img.className="dojoxGridDndAvatarItemImage";img.style.width="16px";var _60b=this.manager.source,node;if(_60b.creator){node=_60b._normalizedCreator(_60b.getItem(this.manager.nodes[0].id).data,"avatar").node;}else{node=this.manager.nodes[0].cloneNode(true);var _60c,_60d;if(node.tagName.toLowerCase()=="tr"){_60c=dd.createElement("table");_60d=dd.createElement("tbody");_60d.appendChild(node);_60c.appendChild(_60d);node=_60c;}else{if(node.tagName.toLowerCase()=="th"){_60c=dd.createElement("table");_60d=dd.createElement("tbody");var r=dd.createElement("tr");_60c.cellPadding=_60c.cellSpacing="0";r.appendChild(node);_60d.appendChild(r);_60c.appendChild(_60d);node=_60c;}}}node.id="";td.appendChild(node);tr.appendChild(img);tr.appendChild(td);_4.style(tr,"opacity",0.9);b.appendChild(tr);a.appendChild(b);this.node=a;var m=_4.dnd.manager();this.oldOffsetY=m.OFFSET_Y;m.OFFSET_Y=1;},destroy:function(){_4.dnd.manager().OFFSET_Y=this.oldOffsetY;this.inherited(arguments);}});var _60e=_4.dnd.manager().makeAvatar;_4.dnd.manager().makeAvatar=function(){var src=this.source;if(src.viewIndex!==undefined&&!_4.hasClass(_4.body(),"dijit_a11y")){return new _6.grid._GridAvatar(this);}return _60e.call(_4.dnd.manager());};})();}if(!_4._hasResource["dojox.grid._RowSelector"]){_4._hasResource["dojox.grid._RowSelector"]=true;_4.provide("dojox.grid._RowSelector");_4.declare("dojox.grid._RowSelector",_6.grid._View,{defaultWidth:"2em",noscroll:true,padBorderWidth:2,buildRendering:function(){this.inherited("buildRendering",arguments);this.scrollboxNode.style.overflow="hidden";this.headerNode.style.visibility="hidden";},getWidth:function(){return this.viewWidth||this.defaultWidth;},buildRowContent:function(_60f,_610){var w=this.contentWidth||0;_610.innerHTML="<table class=\"dojoxGridRowbarTable\" style=\"width:"+w+"px;height:1px;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" role=\"presentation\"><tr><td class=\"dojoxGridRowbarInner\">&nbsp;</td></tr></table>";},renderHeader:function(){},updateRow:function(){},resize:function(){this.adaptHeight();},adaptWidth:function(){if(!("contentWidth" in this)&&this.contentNode){this.contentWidth=this.contentNode.offsetWidth-this.padBorderWidth;}},doStyleRowNode:function(_611,_612){var n=["dojoxGridRowbar dojoxGridNonNormalizedCell"];if(this.grid.rows.isOver(_611)){n.push("dojoxGridRowbarOver");}if(this.grid.selection.isSelected(_611)){n.push("dojoxGridRowbarSelected");}_612.className=n.join(" ");},domouseover:function(e){this.grid.onMouseOverRow(e);},domouseout:function(e){if(!this.isIntraRowEvent(e)){this.grid.onMouseOutRow(e);}}});}if(!_4._hasResource["dojox.grid._Layout"]){_4._hasResource["dojox.grid._Layout"]=true;_4.provide("dojox.grid._Layout");_4.declare("dojox.grid._Layout",null,{constructor:function(_613){this.grid=_613;},cells:[],structure:null,defaultWidth:"6em",moveColumn:function(_614,_615,_616,_617,_618){var _619=this.structure[_614].cells[0];var _61a=this.structure[_615].cells[0];var cell=null;var _61b=0;var _61c=0;for(var i=0,c;c=_619[i];i++){if(c.index==_616){_61b=i;break;}}cell=_619.splice(_61b,1)[0];cell.view=this.grid.views.views[_615];for(i=0,c=null;c=_61a[i];i++){if(c.index==_617){_61c=i;break;}}if(!_618){_61c+=1;}_61a.splice(_61c,0,cell);var _61d=this.grid.getCell(this.grid.getSortIndex());if(_61d){_61d._currentlySorted=this.grid.getSortAsc();}this.cells=[];_616=0;var v;for(i=0;v=this.structure[i];i++){for(var j=0,cs;cs=v.cells[j];j++){for(var k=0;c=cs[k];k++){c.index=_616;this.cells.push(c);if("_currentlySorted" in c){var si=_616+1;si*=c._currentlySorted?1:-1;this.grid.sortInfo=si;delete c._currentlySorted;}_616++;}}}_4.forEach(this.cells,function(c){var _61e=c.markup[2].split(" ");var _61f=parseInt(_61e[1].substring(5));if(_61f!=c.index){_61e[1]="idx=\""+c.index+"\"";c.markup[2]=_61e.join(" ");}});this.grid.setupHeaderMenu();},setColumnVisibility:function(_620,_621){var cell=this.cells[_620];if(cell.hidden==_621){cell.hidden=!_621;var v=cell.view,w=v.viewWidth;if(w&&w!="auto"){v._togglingColumn=_4.marginBox(cell.getHeaderNode()).w||0;}v.update();return true;}else{return false;}},addCellDef:function(_622,_623,_624){var self=this;var _625=function(_626){var w=0;if(_626.colSpan>1){w=0;}else{w=_626.width||self._defaultCellProps.width||self.defaultWidth;if(!isNaN(w)){w=w+"em";}}return w;};var _627={grid:this.grid,subrow:_622,layoutIndex:_623,index:this.cells.length};if(_624&&_624 instanceof _6.grid.cells._Base){var _628=_4.clone(_624);_627.unitWidth=_625(_628._props);_628=_4.mixin(_628,this._defaultCellProps,_624._props,_627);return _628;}var _629=_624.type||_624.cellType||this._defaultCellProps.type||this._defaultCellProps.cellType||_6.grid.cells.Cell;_627.unitWidth=_625(_624);return new _629(_4.mixin({},this._defaultCellProps,_624,_627));},addRowDef:function(_62a,_62b){var _62c=[];var _62d=0,_62e=0,_62f=true;for(var i=0,def,cell;(def=_62b[i]);i++){cell=this.addCellDef(_62a,i,def);_62c.push(cell);this.cells.push(cell);if(_62f&&cell.relWidth){_62d+=cell.relWidth;}else{if(cell.width){var w=cell.width;if(typeof w=="string"&&w.slice(-1)=="%"){_62e+=window.parseInt(w,10);}else{if(w=="auto"){_62f=false;}}}}}if(_62d&&_62f){_4.forEach(_62c,function(cell){if(cell.relWidth){cell.width=cell.unitWidth=((cell.relWidth/_62d)*(100-_62e))+"%";}});}return _62c;},addRowsDef:function(_630){var _631=[];if(_4.isArray(_630)){if(_4.isArray(_630[0])){for(var i=0,row;_630&&(row=_630[i]);i++){_631.push(this.addRowDef(i,row));}}else{_631.push(this.addRowDef(0,_630));}}return _631;},addViewDef:function(_632){this._defaultCellProps=_632.defaultCell||{};if(_632.width&&_632.width=="auto"){delete _632.width;}return _4.mixin({},_632,{cells:this.addRowsDef(_632.rows||_632.cells)});},setStructure:function(_633){this.fieldIndex=0;this.cells=[];var s=this.structure=[];if(this.grid.rowSelector){var sel={type:_6._scopeName+".grid._RowSelector"};if(_4.isString(this.grid.rowSelector)){var _634=this.grid.rowSelector;if(_634=="false"){sel=null;}else{if(_634!="true"){sel["width"]=_634;}}}else{if(!this.grid.rowSelector){sel=null;}}if(sel){s.push(this.addViewDef(sel));}}var _635=function(def){return ("name" in def||"field" in def||"get" in def);};var _636=function(def){if(_4.isArray(def)){if(_4.isArray(def[0])||_635(def[0])){return true;}}return false;};var _637=function(def){return (def!==null&&_4.isObject(def)&&("cells" in def||"rows" in def||("type" in def&&!_635(def))));};if(_4.isArray(_633)){var _638=false;for(var i=0,st;(st=_633[i]);i++){if(_637(st)){_638=true;break;}}if(!_638){s.push(this.addViewDef({cells:_633}));}else{for(i=0;(st=_633[i]);i++){if(_636(st)){s.push(this.addViewDef({cells:st}));}else{if(_637(st)){s.push(this.addViewDef(st));}}}}}else{if(_637(_633)){s.push(this.addViewDef(_633));}}this.cellCount=this.cells.length;this.grid.setupHeaderMenu();}});}if(!_4._hasResource["dojox.grid._ViewManager"]){_4._hasResource["dojox.grid._ViewManager"]=true;_4.provide("dojox.grid._ViewManager");_4.declare("dojox.grid._ViewManager",null,{constructor:function(_639){this.grid=_639;},defaultWidth:200,views:[],resize:function(){this.onEach("resize");},render:function(){this.onEach("render");},addView:function(_63a){_63a.idx=this.views.length;this.views.push(_63a);},destroyViews:function(){for(var i=0,v;v=this.views[i];i++){v.destroy();}this.views=[];},getContentNodes:function(){var _63b=[];for(var i=0,v;v=this.views[i];i++){_63b.push(v.contentNode);}return _63b;},forEach:function(_63c){for(var i=0,v;v=this.views[i];i++){_63c(v,i);}},onEach:function(_63d,_63e){_63e=_63e||[];for(var i=0,v;v=this.views[i];i++){if(_63d in v){v[_63d].apply(v,_63e);}}},normalizeHeaderNodeHeight:function(){var _63f=[];for(var i=0,v;(v=this.views[i]);i++){if(v.headerContentNode.firstChild){_63f.push(v.headerContentNode);}}this.normalizeRowNodeHeights(_63f);},normalizeRowNodeHeights:function(_640){var h=0;var _641=[];if(this.grid.rowHeight){h=this.grid.rowHeight;}else{if(_640.length<=1){return;}for(var i=0,n;(n=_640[i]);i++){if(!_4.hasClass(n,"dojoxGridNonNormalizedCell")){_641[i]=n.firstChild.offsetHeight;h=Math.max(h,_641[i]);}}h=(h>=0?h:0);if(_4.isMoz&&h){h++;}}for(i=0;(n=_640[i]);i++){if(_641[i]!=h){n.firstChild.style.height=h+"px";}}},resetHeaderNodeHeight:function(){for(var i=0,v,n;(v=this.views[i]);i++){n=v.headerContentNode.firstChild;if(n){n.style.height="";}}},renormalizeRow:function(_642){var _643=[];for(var i=0,v,n;(v=this.views[i])&&(n=v.getRowNode(_642));i++){n.firstChild.style.height="";_643.push(n);}this.normalizeRowNodeHeights(_643);},getViewWidth:function(_644){return this.views[_644].getWidth()||this.defaultWidth;},measureHeader:function(){this.resetHeaderNodeHeight();this.forEach(function(_645){_645.headerContentNode.style.height="";});var h=0;this.forEach(function(_646){h=Math.max(_646.headerNode.offsetHeight,h);});return h;},measureContent:function(){var h=0;this.forEach(function(_647){h=Math.max(_647.domNode.offsetHeight,h);});return h;},findClient:function(_648){var c=this.grid.elasticView||-1;if(c<0){for(var i=1,v;(v=this.views[i]);i++){if(v.viewWidth){for(i=1;(v=this.views[i]);i++){if(!v.viewWidth){c=i;break;}}break;}}}if(c<0){c=Math.floor(this.views.length/2);}return c;},arrange:function(l,w){var i,v,vw,len=this.views.length;var c=(w<=0?len:this.findClient());var _649=function(v,l){var ds=v.domNode.style;var hs=v.headerNode.style;if(!_4._isBodyLtr()){ds.right=l+"px";if(_4.isMoz){hs.right=l+v.getScrollbarWidth()+"px";hs.width=parseInt(hs.width,10)-v.getScrollbarWidth()+"px";}else{hs.right=l+"px";}}else{ds.left=l+"px";hs.left=l+"px";}ds.top=0+"px";hs.top=0;};for(i=0;(v=this.views[i])&&(i<c);i++){vw=this.getViewWidth(i);v.setSize(vw,0);_649(v,l);if(v.headerContentNode&&v.headerContentNode.firstChild){vw=v.getColumnsWidth()+v.getScrollbarWidth();}else{vw=v.domNode.offsetWidth;}l+=vw;}i++;var r=w;for(var j=len-1;(v=this.views[j])&&(i<=j);j--){vw=this.getViewWidth(j);v.setSize(vw,0);vw=v.domNode.offsetWidth;r-=vw;_649(v,r);}if(c<len){v=this.views[c];vw=Math.max(1,r-l);v.setSize(vw+"px",0);_649(v,l);}return l;},renderRow:function(_64a,_64b,_64c){var _64d=[];for(var i=0,v,n,_64e;(v=this.views[i])&&(n=_64b[i]);i++){_64e=v.renderRow(_64a);n.appendChild(_64e);_64d.push(_64e);}if(!_64c){this.normalizeRowNodeHeights(_64d);}},rowRemoved:function(_64f){this.onEach("rowRemoved",[_64f]);},updateRow:function(_650,_651){for(var i=0,v;v=this.views[i];i++){v.updateRow(_650);}if(!_651){this.renormalizeRow(_650);}},updateRowStyles:function(_652){this.onEach("updateRowStyles",[_652]);},setScrollTop:function(_653){var top=_653;for(var i=0,v;v=this.views[i];i++){top=v.setScrollTop(_653);if(_4.isIE&&v.headerNode&&v.scrollboxNode){v.headerNode.scrollLeft=v.scrollboxNode.scrollLeft;}}return top;},getFirstScrollingView:function(){for(var i=0,v;(v=this.views[i]);i++){if(v.hasHScrollbar()||v.hasVScrollbar()){return v;}}return null;}});}if(!_4._hasResource["dojox.grid._RowManager"]){_4._hasResource["dojox.grid._RowManager"]=true;_4.provide("dojox.grid._RowManager");(function(){var _654=function(_655,_656){if(_655.style.cssText==undefined){_655.setAttribute("style",_656);}else{_655.style.cssText=_656;}};_4.declare("dojox.grid._RowManager",null,{constructor:function(_657){this.grid=_657;},linesToEms:2,overRow:-2,prepareStylingRow:function(_658,_659){return {index:_658,node:_659,odd:Boolean(_658&1),selected:!!this.grid.selection.isSelected(_658),over:this.isOver(_658),customStyles:"",customClasses:"dojoxGridRow"};},styleRowNode:function(_65a,_65b){var row=this.prepareStylingRow(_65a,_65b);this.grid.onStyleRow(row);this.applyStyles(row);},applyStyles:function(_65c){var i=_65c;i.node.className=i.customClasses;var h=i.node.style.height;_654(i.node,i.customStyles+";"+(i.node._style||""));i.node.style.height=h;},updateStyles:function(_65d){this.grid.updateRowStyles(_65d);},setOverRow:function(_65e){var last=this.overRow;this.overRow=_65e;if((last!=this.overRow)&&(_4.isString(last)||last>=0)){this.updateStyles(last);}this.updateStyles(this.overRow);},isOver:function(_65f){return (this.overRow==_65f&&!_4.hasClass(this.grid.domNode,"dojoxGridColumnResizing"));}});})();}if(!_4._hasResource["dojox.grid._FocusManager"]){_4._hasResource["dojox.grid._FocusManager"]=true;_4.provide("dojox.grid._FocusManager");_4.declare("dojox.grid._FocusManager",null,{constructor:function(_660){this.grid=_660;this.cell=null;this.rowIndex=-1;this._connects=[];this._headerConnects=[];this.headerMenu=this.grid.headerMenu;this._connects.push(_4.connect(this.grid.domNode,"onfocus",this,"doFocus"));this._connects.push(_4.connect(this.grid.domNode,"onblur",this,"doBlur"));this._connects.push(_4.connect(this.grid.domNode,"oncontextmenu",this,"doContextMenu"));this._connects.push(_4.connect(this.grid.lastFocusNode,"onfocus",this,"doLastNodeFocus"));this._connects.push(_4.connect(this.grid.lastFocusNode,"onblur",this,"doLastNodeBlur"));this._connects.push(_4.connect(this.grid,"_onFetchComplete",this,"_delayedCellFocus"));this._connects.push(_4.connect(this.grid,"postrender",this,"_delayedHeaderFocus"));},destroy:function(){_4.forEach(this._connects,_4.disconnect);_4.forEach(this._headerConnects,_4.disconnect);delete this.grid;delete this.cell;},_colHeadNode:null,_colHeadFocusIdx:null,_contextMenuBindNode:null,tabbingOut:false,focusClass:"dojoxGridCellFocus",focusView:null,initFocusView:function(){this.focusView=this.grid.views.getFirstScrollingView()||this.focusView||this.grid.views.views[0];this._initColumnHeaders();},isFocusCell:function(_661,_662){return (this.cell==_661)&&(this.rowIndex==_662);},isLastFocusCell:function(){if(this.cell){return (this.rowIndex==this.grid.rowCount-1)&&(this.cell.index==this.grid.layout.cellCount-1);}return false;},isFirstFocusCell:function(){if(this.cell){return (this.rowIndex===0)&&(this.cell.index===0);}return false;},isNoFocusCell:function(){return (this.rowIndex<0)||!this.cell;},isNavHeader:function(){return (!!this._colHeadNode);},getHeaderIndex:function(){if(this._colHeadNode){return _4.indexOf(this._findHeaderCells(),this._colHeadNode);}else{return -1;}},_focusifyCellNode:function(_663){var n=this.cell&&this.cell.getNode(this.rowIndex);if(n){_4.toggleClass(n,this.focusClass,_663);if(_663){var sl=this.scrollIntoView();try{if(!this.grid.edit.isEditing()){_6.grid.util.fire(n,"focus");if(sl){this.cell.view.scrollboxNode.scrollLeft=sl;}}}catch(e){}}}},_delayedCellFocus:function(){if(this.isNavHeader()||!this.grid._focused){return;}var n=this.cell&&this.cell.getNode(this.rowIndex);if(n){try{if(!this.grid.edit.isEditing()){_4.toggleClass(n,this.focusClass,true);this.blurHeader();_6.grid.util.fire(n,"focus");}}catch(e){}}},_delayedHeaderFocus:function(){if(this.isNavHeader()){this.focusHeader();this.grid.domNode.focus();}},_initColumnHeaders:function(){_4.forEach(this._headerConnects,_4.disconnect);this._headerConnects=[];var _664=this._findHeaderCells();for(var i=0;i<_664.length;i++){this._headerConnects.push(_4.connect(_664[i],"onfocus",this,"doColHeaderFocus"));this._headerConnects.push(_4.connect(_664[i],"onblur",this,"doColHeaderBlur"));}},_findHeaderCells:function(){var _665=_4.query("th",this.grid.viewsHeaderNode);var _666=[];for(var i=0;i<_665.length;i++){var _667=_665[i];var _668=_4.hasAttr(_667,"tabIndex");var _669=_4.attr(_667,"tabIndex");if(_668&&_669<0){_666.push(_667);}}return _666;},_setActiveColHeader:function(_66a,_66b,_66c){_4.attr(this.grid.domNode,"aria-activedescendant",_66a.id);if(_66c!=null&&_66c>=0&&_66c!=_66b){_4.toggleClass(this._findHeaderCells()[_66c],this.focusClass,false);}_4.toggleClass(_66a,this.focusClass,true);this._colHeadNode=_66a;this._colHeadFocusIdx=_66b;this._scrollHeader(this._colHeadFocusIdx);},scrollIntoView:function(){var info=(this.cell?this._scrollInfo(this.cell):null);if(!info||!info.s){return null;}var rt=this.grid.scroller.findScrollTop(this.rowIndex);if(info.n&&info.sr){if(info.n.offsetLeft+info.n.offsetWidth>info.sr.l+info.sr.w){info.s.scrollLeft=info.n.offsetLeft+info.n.offsetWidth-info.sr.w;}else{if(info.n.offsetLeft<info.sr.l){info.s.scrollLeft=info.n.offsetLeft;}}}if(info.r&&info.sr){if(rt+info.r.offsetHeight>info.sr.t+info.sr.h){this.grid.setScrollTop(rt+info.r.offsetHeight-info.sr.h);}else{if(rt<info.sr.t){this.grid.setScrollTop(rt);}}}return info.s.scrollLeft;},_scrollInfo:function(cell,_66d){if(cell){var cl=cell,sbn=cl.view.scrollboxNode,sbnr={w:sbn.clientWidth,l:sbn.scrollLeft,t:sbn.scrollTop,h:sbn.clientHeight},rn=cl.view.getRowNode(this.rowIndex);return {c:cl,s:sbn,sr:sbnr,n:(_66d?_66d:cell.getNode(this.rowIndex)),r:rn};}return null;},_scrollHeader:function(_66e){var info=null;if(this._colHeadNode){var cell=this.grid.getCell(_66e);info=this._scrollInfo(cell,cell.getNode(0));}if(info&&info.s&&info.sr&&info.n){var _66f=info.sr.l+info.sr.w;if(info.n.offsetLeft+info.n.offsetWidth>_66f){info.s.scrollLeft=info.n.offsetLeft+info.n.offsetWidth-info.sr.w;}else{if(info.n.offsetLeft<info.sr.l){info.s.scrollLeft=info.n.offsetLeft;}else{if(_4.isIE<=7&&cell&&cell.view.headerNode){cell.view.headerNode.scrollLeft=info.s.scrollLeft;}}}}},_isHeaderHidden:function(){var _670=this.focusView;if(!_670){for(var i=0,_671;(_671=this.grid.views.views[i]);i++){if(_671.headerNode){_670=_671;break;}}}return (_670&&_4.getComputedStyle(_670.headerNode).display=="none");},colSizeAdjust:function(e,_672,_673){var _674=this._findHeaderCells();var view=this.focusView;if(!view){for(var i=0,_675;(_675=this.grid.views.views[i]);i++){if(_675.header.tableMap.map){view=_675;break;}}}var _676=_674[_672];if(!view||(_672==_674.length-1&&_672===0)){return;}view.content.baseDecorateEvent(e);e.cellNode=_676;e.cellIndex=view.content.getCellNodeIndex(e.cellNode);e.cell=(e.cellIndex>=0?this.grid.getCell(e.cellIndex):null);if(view.header.canResize(e)){var _677={l:_673};var drag=view.header.colResizeSetup(e,false);view.header.doResizeColumn(drag,null,_677);view.update();}},styleRow:function(_678){return;},setFocusIndex:function(_679,_67a){this.setFocusCell(this.grid.getCell(_67a),_679);},setFocusCell:function(_67b,_67c){if(_67b&&!this.isFocusCell(_67b,_67c)){this.tabbingOut=false;if(this._colHeadNode){this.blurHeader();}this._colHeadNode=this._colHeadFocusIdx=null;this.focusGridView();this._focusifyCellNode(false);this.cell=_67b;this.rowIndex=_67c;this._focusifyCellNode(true);}if(_4.isOpera){setTimeout(_4.hitch(this.grid,"onCellFocus",this.cell,this.rowIndex),1);}else{this.grid.onCellFocus(this.cell,this.rowIndex);}},next:function(){if(this.cell){var row=this.rowIndex,col=this.cell.index+1,cc=this.grid.layout.cellCount-1,rc=this.grid.rowCount-1;if(col>cc){col=0;row++;}if(row>rc){col=cc;row=rc;}if(this.grid.edit.isEditing()){var _67d=this.grid.getCell(col);if(!this.isLastFocusCell()&&(!_67d.editable||this.grid.canEdit&&!this.grid.canEdit(_67d,row))){this.cell=_67d;this.rowIndex=row;this.next();return;}}this.setFocusIndex(row,col);}},previous:function(){if(this.cell){var row=(this.rowIndex||0),col=(this.cell.index||0)-1;if(col<0){col=this.grid.layout.cellCount-1;row--;}if(row<0){row=0;col=0;}if(this.grid.edit.isEditing()){var _67e=this.grid.getCell(col);if(!this.isFirstFocusCell()&&!_67e.editable){this.cell=_67e;this.rowIndex=row;this.previous();return;}}this.setFocusIndex(row,col);}},move:function(_67f,_680){var _681=_680<0?-1:1;if(this.isNavHeader()){var _682=this._findHeaderCells();var _683=currentIdx=_4.indexOf(_682,this._colHeadNode);currentIdx+=_680;while(currentIdx>=0&&currentIdx<_682.length&&_682[currentIdx].style.display=="none"){currentIdx+=_681;}if((currentIdx>=0)&&(currentIdx<_682.length)){this._setActiveColHeader(_682[currentIdx],currentIdx,_683);}}else{if(this.cell){var sc=this.grid.scroller,r=this.rowIndex,rc=this.grid.rowCount-1,row=Math.min(rc,Math.max(0,r+_67f));if(_67f){if(_67f>0){if(row>sc.getLastPageRow(sc.page)){this.grid.setScrollTop(this.grid.scrollTop+sc.findScrollTop(row)-sc.findScrollTop(r));}}else{if(_67f<0){if(row<=sc.getPageRow(sc.page)){this.grid.setScrollTop(this.grid.scrollTop-sc.findScrollTop(r)-sc.findScrollTop(row));}}}}var cc=this.grid.layout.cellCount-1,i=this.cell.index,col=Math.min(cc,Math.max(0,i+_680));var cell=this.grid.getCell(col);while(col>=0&&col<cc&&cell&&cell.hidden===true){col+=_681;cell=this.grid.getCell(col);}if(!cell||cell.hidden===true){col=i;}var n=cell.getNode(row);if(!n&&_67f){if((row+_67f)>=0&&(row+_67f)<=rc){this.move(_67f>0?++_67f:--_67f,_680);}return;}else{if((!n||_4.style(n,"display")==="none")&&_680){if((col+_67f)>=0&&(col+_67f)<=cc){this.move(_67f,_680>0?++_680:--_680);}return;}}this.setFocusIndex(row,col);if(_67f){this.grid.updateRow(r);}}}},previousKey:function(e){if(this.grid.edit.isEditing()){_4.stopEvent(e);this.previous();}else{if(!this.isNavHeader()&&!this._isHeaderHidden()){this.grid.domNode.focus();_4.stopEvent(e);}else{this.tabOut(this.grid.domNode);if(this._colHeadFocusIdx!=null){_4.toggleClass(this._findHeaderCells()[this._colHeadFocusIdx],this.focusClass,false);this._colHeadFocusIdx=null;}this._focusifyCellNode(false);}}},nextKey:function(e){var _684=(this.grid.rowCount===0);if(e.target===this.grid.domNode&&this._colHeadFocusIdx==null){this.focusHeader();_4.stopEvent(e);}else{if(this.isNavHeader()){this.blurHeader();if(!this.findAndFocusGridCell()){this.tabOut(this.grid.lastFocusNode);}this._colHeadNode=this._colHeadFocusIdx=null;}else{if(this.grid.edit.isEditing()){_4.stopEvent(e);this.next();}else{this.tabOut(this.grid.lastFocusNode);}}}},tabOut:function(_685){this.tabbingOut=true;_685.focus();},focusGridView:function(){_6.grid.util.fire(this.focusView,"focus");},focusGrid:function(_686){this.focusGridView();this._focusifyCellNode(true);},findAndFocusGridCell:function(){var _687=true;var _688=(this.grid.rowCount===0);if(this.isNoFocusCell()&&!_688){var _689=0;var cell=this.grid.getCell(_689);if(cell.hidden){_689=this.isNavHeader()?this._colHeadFocusIdx:0;}this.setFocusIndex(0,_689);}else{if(this.cell&&!_688){if(this.focusView&&!this.focusView.rowNodes[this.rowIndex]){this.grid.scrollToRow(this.rowIndex);}this.focusGrid();}else{_687=false;}}this._colHeadNode=this._colHeadFocusIdx=null;return _687;},focusHeader:function(){var _68a=this._findHeaderCells();var _68b=this._colHeadFocusIdx;if(this._isHeaderHidden()){this.findAndFocusGridCell();}else{if(!this._colHeadFocusIdx){if(this.isNoFocusCell()){this._colHeadFocusIdx=0;}else{this._colHeadFocusIdx=this.cell.index;}}}this._colHeadNode=_68a[this._colHeadFocusIdx];while(this._colHeadNode&&this._colHeadFocusIdx>=0&&this._colHeadFocusIdx<_68a.length&&this._colHeadNode.style.display=="none"){this._colHeadFocusIdx++;this._colHeadNode=_68a[this._colHeadFocusIdx];}if(this._colHeadNode&&this._colHeadNode.style.display!="none"){if(this.headerMenu&&this._contextMenuBindNode!=this.grid.domNode){this.headerMenu.unBindDomNode(this.grid.viewsHeaderNode);this.headerMenu.bindDomNode(this.grid.domNode);this._contextMenuBindNode=this.grid.domNode;}this._setActiveColHeader(this._colHeadNode,this._colHeadFocusIdx,_68b);this._scrollHeader(this._colHeadFocusIdx);this._focusifyCellNode(false);}else{this.findAndFocusGridCell();}},blurHeader:function(){_4.removeClass(this._colHeadNode,this.focusClass);_4.removeAttr(this.grid.domNode,"aria-activedescendant");if(this.headerMenu&&this._contextMenuBindNode==this.grid.domNode){var _68c=this.grid.viewsHeaderNode;this.headerMenu.unBindDomNode(this.grid.domNode);this.headerMenu.bindDomNode(_68c);this._contextMenuBindNode=_68c;}},doFocus:function(e){if(e&&e.target!=e.currentTarget){_4.stopEvent(e);return;}if(!this.tabbingOut){this.focusHeader();}this.tabbingOut=false;_4.stopEvent(e);},doBlur:function(e){_4.stopEvent(e);},doContextMenu:function(e){if(!this.headerMenu){_4.stopEvent(e);}},doLastNodeFocus:function(e){if(this.tabbingOut){this._focusifyCellNode(false);}else{if(this.grid.rowCount>0){if(this.isNoFocusCell()){this.setFocusIndex(0,0);}this._focusifyCellNode(true);}else{this.focusHeader();}}this.tabbingOut=false;_4.stopEvent(e);},doLastNodeBlur:function(e){_4.stopEvent(e);},doColHeaderFocus:function(e){this._setActiveColHeader(e.target,_4.attr(e.target,"idx"),this._colHeadFocusIdx);this._scrollHeader(this.getHeaderIndex());_4.stopEvent(e);},doColHeaderBlur:function(e){_4.toggleClass(e.target,this.focusClass,false);}});}if(!_4._hasResource["dojox.grid._EditManager"]){_4._hasResource["dojox.grid._EditManager"]=true;_4.provide("dojox.grid._EditManager");_4.declare("dojox.grid._EditManager",null,{constructor:function(_68d){this.grid=_68d;if(_4.isIE){this.connections=[_4.connect(document.body,"onfocus",_4.hitch(this,"_boomerangFocus"))];}else{this.connections=[_4.connect(this.grid,"onBlur",this,"apply")];}},info:{},destroy:function(){_4.forEach(this.connections,_4.disconnect);},cellFocus:function(_68e,_68f){if(this.grid.singleClickEdit||this.isEditRow(_68f)){this.setEditCell(_68e,_68f);}else{this.apply();}if(this.isEditing()||(_68e&&_68e.editable&&_68e.alwaysEditing)){this._focusEditor(_68e,_68f);}},rowClick:function(e){if(this.isEditing()&&!this.isEditRow(e.rowIndex)){this.apply();}},styleRow:function(_690){if(_690.index==this.info.rowIndex){_690.customClasses+=" dojoxGridRowEditing";}},dispatchEvent:function(e){var c=e.cell,ed=(c&&c["editable"])?c:0;return ed&&ed.dispatchEvent(e.dispatch,e);},isEditing:function(){return this.info.rowIndex!==undefined;},isEditCell:function(_691,_692){return (this.info.rowIndex===_691)&&(this.info.cell.index==_692);},isEditRow:function(_693){return this.info.rowIndex===_693;},setEditCell:function(_694,_695){if(!this.isEditCell(_695,_694.index)&&this.grid.canEdit&&this.grid.canEdit(_694,_695)){this.start(_694,_695,this.isEditRow(_695)||_694.editable);}},_focusEditor:function(_696,_697){_6.grid.util.fire(_696,"focus",[_697]);},focusEditor:function(){if(this.isEditing()){this._focusEditor(this.info.cell,this.info.rowIndex);}},_boomerangWindow:500,_shouldCatchBoomerang:function(){return this._catchBoomerang>new Date().getTime();},_boomerangFocus:function(){if(this._shouldCatchBoomerang()){this.grid.focus.focusGrid();this.focusEditor();this._catchBoomerang=0;}},_doCatchBoomerang:function(){if(_4.isIE){this._catchBoomerang=new Date().getTime()+this._boomerangWindow;}},start:function(_698,_699,_69a){this.grid.beginUpdate();this.editorApply();if(this.isEditing()&&!this.isEditRow(_699)){this.applyRowEdit();this.grid.updateRow(_699);}if(_69a){this.info={cell:_698,rowIndex:_699};this.grid.doStartEdit(_698,_699);this.grid.updateRow(_699);}else{this.info={};}this.grid.endUpdate();this.grid.focus.focusGrid();this._focusEditor(_698,_699);this._doCatchBoomerang();},_editorDo:function(_69b){var c=this.info.cell;if(c&&c.editable){c[_69b](this.info.rowIndex);}},editorApply:function(){this._editorDo("apply");},editorCancel:function(){this._editorDo("cancel");},applyCellEdit:function(_69c,_69d,_69e){if(this.grid.canEdit(_69d,_69e)){this.grid.doApplyCellEdit(_69c,_69e,_69d.field);}},applyRowEdit:function(){this.grid.doApplyEdit(this.info.rowIndex,this.info.cell.field);},apply:function(){if(this.isEditing()){this.grid.beginUpdate();this.editorApply();this.applyRowEdit();this.info={};this.grid.endUpdate();this.grid.focus.focusGrid();this._doCatchBoomerang();}},cancel:function(){if(this.isEditing()){this.grid.beginUpdate();this.editorCancel();this.info={};this.grid.endUpdate();this.grid.focus.focusGrid();this._doCatchBoomerang();}},save:function(_69f,_6a0){var c=this.info.cell;if(this.isEditRow(_69f)&&(!_6a0||c.view==_6a0)&&c.editable){c.save(c,this.info.rowIndex);}},restore:function(_6a1,_6a2){var c=this.info.cell;if(this.isEditRow(_6a2)&&c.view==_6a1&&c.editable){c.restore(c,this.info.rowIndex);}}});}if(!_4._hasResource["dojox.grid.Selection"]){_4._hasResource["dojox.grid.Selection"]=true;_4.provide("dojox.grid.Selection");_4.declare("dojox.grid.Selection",null,{constructor:function(_6a3){this.grid=_6a3;this.selected=[];this.setMode(_6a3.selectionMode);},mode:"extended",selected:null,updating:0,selectedIndex:-1,setMode:function(mode){if(this.selected.length){this.deselectAll();}if(mode!="extended"&&mode!="multiple"&&mode!="single"&&mode!="none"){this.mode="extended";}else{this.mode=mode;}},onCanSelect:function(_6a4){return this.grid.onCanSelect(_6a4);},onCanDeselect:function(_6a5){return this.grid.onCanDeselect(_6a5);},onSelected:function(_6a6){},onDeselected:function(_6a7){},onChanging:function(){},onChanged:function(){},isSelected:function(_6a8){if(this.mode=="none"){return false;}return this.selected[_6a8];},getFirstSelected:function(){if(!this.selected.length||this.mode=="none"){return -1;}for(var i=0,l=this.selected.length;i<l;i++){if(this.selected[i]){return i;}}return -1;},getNextSelected:function(_6a9){if(this.mode=="none"){return -1;}for(var i=_6a9+1,l=this.selected.length;i<l;i++){if(this.selected[i]){return i;}}return -1;},getSelected:function(){var _6aa=[];for(var i=0,l=this.selected.length;i<l;i++){if(this.selected[i]){_6aa.push(i);}}return _6aa;},getSelectedCount:function(){var c=0;for(var i=0;i<this.selected.length;i++){if(this.selected[i]){c++;}}return c;},_beginUpdate:function(){if(this.updating===0){this.onChanging();}this.updating++;},_endUpdate:function(){this.updating--;if(this.updating===0){this.onChanged();}},select:function(_6ab){if(this.mode=="none"){return;}if(this.mode!="multiple"){this.deselectAll(_6ab);this.addToSelection(_6ab);}else{this.toggleSelect(_6ab);}},addToSelection:function(_6ac){if(this.mode=="none"){return;}if(_4.isArray(_6ac)){_4.forEach(_6ac,this.addToSelection,this);return;}_6ac=Number(_6ac);if(this.selected[_6ac]){this.selectedIndex=_6ac;}else{if(this.onCanSelect(_6ac)!==false){this.selectedIndex=_6ac;var _6ad=this.grid.getRowNode(_6ac);if(_6ad){_4.attr(_6ad,"aria-selected","true");}this._beginUpdate();this.selected[_6ac]=true;this.onSelected(_6ac);this._endUpdate();}}},deselect:function(_6ae){if(this.mode=="none"){return;}if(_4.isArray(_6ae)){_4.forEach(_6ae,this.deselect,this);return;}_6ae=Number(_6ae);if(this.selectedIndex==_6ae){this.selectedIndex=-1;}if(this.selected[_6ae]){if(this.onCanDeselect(_6ae)===false){return;}var _6af=this.grid.getRowNode(_6ae);if(_6af){_4.attr(_6af,"aria-selected","false");}this._beginUpdate();delete this.selected[_6ae];this.onDeselected(_6ae);this._endUpdate();}},setSelected:function(_6b0,_6b1){this[(_6b1?"addToSelection":"deselect")](_6b0);},toggleSelect:function(_6b2){if(_4.isArray(_6b2)){_4.forEach(_6b2,this.toggleSelect,this);return;}this.setSelected(_6b2,!this.selected[_6b2]);},_range:function(_6b3,inTo,func){var s=(_6b3>=0?_6b3:inTo),e=inTo;if(s>e){e=s;s=inTo;}for(var i=s;i<=e;i++){func(i);}},selectRange:function(_6b4,inTo){this._range(_6b4,inTo,_4.hitch(this,"addToSelection"));},deselectRange:function(_6b5,inTo){this._range(_6b5,inTo,_4.hitch(this,"deselect"));},insert:function(_6b6){this.selected.splice(_6b6,0,false);if(this.selectedIndex>=_6b6){this.selectedIndex++;}},remove:function(_6b7){this.selected.splice(_6b7,1);if(this.selectedIndex>=_6b7){this.selectedIndex--;}},deselectAll:function(_6b8){for(var i in this.selected){if((i!=_6b8)&&(this.selected[i]===true)){this.deselect(i);}}},clickSelect:function(_6b9,_6ba,_6bb){if(this.mode=="none"){return;}this._beginUpdate();if(this.mode!="extended"){this.select(_6b9);}else{var _6bc=this.selectedIndex;if(!_6ba){this.deselectAll(_6b9);}if(_6bb){this.selectRange(_6bc,_6b9);}else{if(_6ba){this.toggleSelect(_6b9);}else{this.addToSelection(_6b9);}}}this._endUpdate();},clickSelectEvent:function(e){this.clickSelect(e.rowIndex,_4.isCopyKey(e),e.shiftKey);},clear:function(){this._beginUpdate();this.deselectAll();this._endUpdate();}});}if(!_4._hasResource["dojox.grid._Events"]){_4._hasResource["dojox.grid._Events"]=true;_4.provide("dojox.grid._Events");_4.declare("dojox.grid._Events",null,{cellOverClass:"dojoxGridCellOver",onKeyEvent:function(e){this.dispatchKeyEvent(e);},onContentEvent:function(e){this.dispatchContentEvent(e);},onHeaderEvent:function(e){this.dispatchHeaderEvent(e);},onStyleRow:function(_6bd){var i=_6bd;i.customClasses+=(i.odd?" dojoxGridRowOdd":"")+(i.selected?" dojoxGridRowSelected":"")+(i.over?" dojoxGridRowOver":"");this.focus.styleRow(_6bd);this.edit.styleRow(_6bd);},onKeyDown:function(e){if(e.altKey||e.metaKey){return;}var dk=_4.keys;var _6be;switch(e.keyCode){case dk.ESCAPE:this.edit.cancel();break;case dk.ENTER:if(!this.edit.isEditing()){_6be=this.focus.getHeaderIndex();if(_6be>=0){this.setSortIndex(_6be);break;}else{this.selection.clickSelect(this.focus.rowIndex,_4.isCopyKey(e),e.shiftKey);}_4.stopEvent(e);}if(!e.shiftKey){var _6bf=this.edit.isEditing();this.edit.apply();if(!_6bf){this.edit.setEditCell(this.focus.cell,this.focus.rowIndex);}}if(!this.edit.isEditing()){var _6c0=this.focus.focusView||this.views.views[0];_6c0.content.decorateEvent(e);this.onRowClick(e);_4.stopEvent(e);}break;case dk.SPACE:if(!this.edit.isEditing()){_6be=this.focus.getHeaderIndex();if(_6be>=0){this.setSortIndex(_6be);break;}else{this.selection.clickSelect(this.focus.rowIndex,_4.isCopyKey(e),e.shiftKey);}_4.stopEvent(e);}break;case dk.TAB:this.focus[e.shiftKey?"previousKey":"nextKey"](e);break;case dk.LEFT_ARROW:case dk.RIGHT_ARROW:if(!this.edit.isEditing()){var _6c1=e.keyCode;_4.stopEvent(e);_6be=this.focus.getHeaderIndex();if(_6be>=0&&(e.shiftKey&&e.ctrlKey)){this.focus.colSizeAdjust(e,_6be,(_6c1==dk.LEFT_ARROW?-1:1)*5);}else{var _6c2=(_6c1==dk.LEFT_ARROW)?1:-1;if(_4._isBodyLtr()){_6c2*=-1;}this.focus.move(0,_6c2);}}break;case dk.UP_ARROW:if(!this.edit.isEditing()&&this.focus.rowIndex!==0){_4.stopEvent(e);this.focus.move(-1,0);}break;case dk.DOWN_ARROW:if(!this.edit.isEditing()&&this.focus.rowIndex+1!=this.rowCount){_4.stopEvent(e);this.focus.move(1,0);}break;case dk.PAGE_UP:if(!this.edit.isEditing()&&this.focus.rowIndex!==0){_4.stopEvent(e);if(this.focus.rowIndex!=this.scroller.firstVisibleRow+1){this.focus.move(this.scroller.firstVisibleRow-this.focus.rowIndex,0);}else{this.setScrollTop(this.scroller.findScrollTop(this.focus.rowIndex-1));this.focus.move(this.scroller.firstVisibleRow-this.scroller.lastVisibleRow+1,0);}}break;case dk.PAGE_DOWN:if(!this.edit.isEditing()&&this.focus.rowIndex+1!=this.rowCount){_4.stopEvent(e);if(this.focus.rowIndex!=this.scroller.lastVisibleRow-1){this.focus.move(this.scroller.lastVisibleRow-this.focus.rowIndex-1,0);}else{this.setScrollTop(this.scroller.findScrollTop(this.focus.rowIndex+1));this.focus.move(this.scroller.lastVisibleRow-this.scroller.firstVisibleRow-1,0);}}break;default:break;}},onMouseOver:function(e){e.rowIndex==-1?this.onHeaderCellMouseOver(e):this.onCellMouseOver(e);},onMouseOut:function(e){e.rowIndex==-1?this.onHeaderCellMouseOut(e):this.onCellMouseOut(e);},onMouseDown:function(e){e.rowIndex==-1?this.onHeaderCellMouseDown(e):this.onCellMouseDown(e);},onMouseOverRow:function(e){if(!this.rows.isOver(e.rowIndex)){this.rows.setOverRow(e.rowIndex);e.rowIndex==-1?this.onHeaderMouseOver(e):this.onRowMouseOver(e);}},onMouseOutRow:function(e){if(this.rows.isOver(-1)){this.onHeaderMouseOut(e);}else{if(!this.rows.isOver(-2)){this.rows.setOverRow(-2);this.onRowMouseOut(e);}}},onMouseDownRow:function(e){if(e.rowIndex!=-1){this.onRowMouseDown(e);}},onCellMouseOver:function(e){if(e.cellNode){_4.addClass(e.cellNode,this.cellOverClass);}},onCellMouseOut:function(e){if(e.cellNode){_4.removeClass(e.cellNode,this.cellOverClass);}},onCellMouseDown:function(e){},onCellClick:function(e){this._click[0]=this._click[1];this._click[1]=e;if(!this.edit.isEditCell(e.rowIndex,e.cellIndex)){this.focus.setFocusCell(e.cell,e.rowIndex);}this.onRowClick(e);},onCellDblClick:function(e){if(this._click.length>1&&_4.isIE){this.edit.setEditCell(this._click[1].cell,this._click[1].rowIndex);}else{if(this._click.length>1&&this._click[0].rowIndex!=this._click[1].rowIndex){this.edit.setEditCell(this._click[0].cell,this._click[0].rowIndex);}else{this.edit.setEditCell(e.cell,e.rowIndex);}}this.onRowDblClick(e);},onCellContextMenu:function(e){this.onRowContextMenu(e);},onCellFocus:function(_6c3,_6c4){this.edit.cellFocus(_6c3,_6c4);},onRowClick:function(e){this.edit.rowClick(e);this.selection.clickSelectEvent(e);},onRowDblClick:function(e){},onRowMouseOver:function(e){},onRowMouseOut:function(e){},onRowMouseDown:function(e){},onRowContextMenu:function(e){_4.stopEvent(e);},onHeaderMouseOver:function(e){},onHeaderMouseOut:function(e){},onHeaderCellMouseOver:function(e){if(e.cellNode){_4.addClass(e.cellNode,this.cellOverClass);}},onHeaderCellMouseOut:function(e){if(e.cellNode){_4.removeClass(e.cellNode,this.cellOverClass);}},onHeaderCellMouseDown:function(e){},onHeaderClick:function(e){},onHeaderCellClick:function(e){this.setSortIndex(e.cell.index);this.onHeaderClick(e);},onHeaderDblClick:function(e){},onHeaderCellDblClick:function(e){this.onHeaderDblClick(e);},onHeaderCellContextMenu:function(e){this.onHeaderContextMenu(e);},onHeaderContextMenu:function(e){if(!this.headerMenu){_4.stopEvent(e);}},onStartEdit:function(_6c5,_6c6){},onApplyCellEdit:function(_6c7,_6c8,_6c9){},onCancelEdit:function(_6ca){},onApplyEdit:function(_6cb){},onCanSelect:function(_6cc){return true;},onCanDeselect:function(_6cd){return true;},onSelected:function(_6ce){this.updateRowStyles(_6ce);},onDeselected:function(_6cf){this.updateRowStyles(_6cf);},onSelectionChanged:function(){}});}if(!_4._hasResource["dojox.grid._Grid"]){_4._hasResource["dojox.grid._Grid"]=true;_4.provide("dojox.grid._Grid");(function(){if(!_4.isCopyKey){_4.isCopyKey=_4.dnd.getCopyKeyState;}_4.declare("dojox.grid._Grid",[_5._Widget,_5._Templated,_6.grid._Events],{templateString:"<div hidefocus=\"hidefocus\" role=\"grid\" dojoAttachEvent=\"onmouseout:_mouseOut\">\r\n\t<div class=\"dojoxGridMasterHeader\" dojoAttachPoint=\"viewsHeaderNode\" role=\"presentation\"></div>\r\n\t<div class=\"dojoxGridMasterView\" dojoAttachPoint=\"viewsNode\" role=\"presentation\"></div>\r\n\t<div class=\"dojoxGridMasterMessages\" style=\"display: none;\" dojoAttachPoint=\"messagesNode\"></div>\r\n\t<span dojoAttachPoint=\"lastFocusNode\" tabindex=\"0\"></span>\r\n</div>\r\n",classTag:"dojoxGrid",rowCount:5,keepRows:75,rowsPerPage:25,autoWidth:false,initialWidth:"",autoHeight:"",rowHeight:0,autoRender:true,defaultHeight:"15em",height:"",structure:null,elasticView:-1,singleClickEdit:false,selectionMode:"extended",rowSelector:"",columnReordering:false,headerMenu:null,placeholderLabel:"GridColumns",selectable:false,_click:null,loadingMessage:"<span class='dojoxGridLoading'>${loadingState}</span>",errorMessage:"<span class='dojoxGridError'>${errorState}</span>",noDataMessage:"",escapeHTMLInData:true,formatterScope:null,editable:false,sortInfo:0,themeable:true,_placeholders:null,_layoutClass:_6.grid._Layout,buildRendering:function(){this.inherited(arguments);if(!this.domNode.getAttribute("tabIndex")){this.domNode.tabIndex="0";}this.createScroller();this.createLayout();this.createViews();this.createManagers();this.createSelection();this.connect(this.selection,"onSelected","onSelected");this.connect(this.selection,"onDeselected","onDeselected");this.connect(this.selection,"onChanged","onSelectionChanged");_6.html.metrics.initOnFontResize();this.connect(_6.html.metrics,"onFontResize","textSizeChanged");_6.grid.util.funnelEvents(this.domNode,this,"doKeyEvent",_6.grid.util.keyEvents);if(this.selectionMode!="none"){_4.attr(this.domNode,"aria-multiselectable",this.selectionMode=="single"?"false":"true");}_4.addClass(this.domNode,this.classTag);if(!this.isLeftToRight()){_4.addClass(this.domNode,this.classTag+"Rtl");}},postMixInProperties:function(){this.inherited(arguments);var _6d0=_4.i18n.getLocalization("dijit","loading",this.lang);this.loadingMessage=_4.string.substitute(this.loadingMessage,_6d0);this.errorMessage=_4.string.substitute(this.errorMessage,_6d0);if(this.srcNodeRef&&this.srcNodeRef.style.height){this.height=this.srcNodeRef.style.height;}this._setAutoHeightAttr(this.autoHeight,true);this.lastScrollTop=this.scrollTop=0;},postCreate:function(){this._placeholders=[];this._setHeaderMenuAttr(this.headerMenu);this._setStructureAttr(this.structure);this._click=[];this.inherited(arguments);if(this.domNode&&this.autoWidth&&this.initialWidth){this.domNode.style.width=this.initialWidth;}if(this.domNode&&!this.editable){_4.attr(this.domNode,"aria-readonly","true");}},destroy:function(){this.domNode.onReveal=null;this.domNode.onSizeChange=null;delete this._click;this.edit.destroy();delete this.edit;this.views.destroyViews();if(this.scroller){this.scroller.destroy();delete this.scroller;}if(this.focus){this.focus.destroy();delete this.focus;}if(this.headerMenu&&this._placeholders.length){_4.forEach(this._placeholders,function(p){p.unReplace(true);});this.headerMenu.unBindDomNode(this.viewsHeaderNode);}this.inherited(arguments);},_setAutoHeightAttr:function(ah,_6d1){if(typeof ah=="string"){if(!ah||ah=="false"){ah=false;}else{if(ah=="true"){ah=true;}else{ah=window.parseInt(ah,10);}}}if(typeof ah=="number"){if(isNaN(ah)){ah=false;}if(ah<0){ah=true;}else{if(ah===0){ah=false;}}}this.autoHeight=ah;if(typeof ah=="boolean"){this._autoHeight=ah;}else{if(typeof ah=="number"){this._autoHeight=(ah>=this.get("rowCount"));}else{this._autoHeight=false;}}if(this._started&&!_6d1){this.render();}},_getRowCountAttr:function(){return this.updating&&this.invalidated&&this.invalidated.rowCount!=undefined?this.invalidated.rowCount:this.rowCount;},textSizeChanged:function(){this.render();},sizeChange:function(){this.update();},createManagers:function(){this.rows=new _6.grid._RowManager(this);this.focus=new _6.grid._FocusManager(this);this.edit=new _6.grid._EditManager(this);},createSelection:function(){this.selection=new _6.grid.Selection(this);},createScroller:function(){this.scroller=new _6.grid._Scroller();this.scroller.grid=this;this.scroller.renderRow=_4.hitch(this,"renderRow");this.scroller.removeRow=_4.hitch(this,"rowRemoved");},createLayout:function(){this.layout=new this._layoutClass(this);this.connect(this.layout,"moveColumn","onMoveColumn");},onMoveColumn:function(){this.render();},onResizeColumn:function(_6d2){},createViews:function(){this.views=new _6.grid._ViewManager(this);this.views.createView=_4.hitch(this,"createView");},createView:function(_6d3,idx){var c=_4.getObject(_6d3);var view=new c({grid:this,index:idx});this.viewsNode.appendChild(view.domNode);this.viewsHeaderNode.appendChild(view.headerNode);this.views.addView(view);_4.attr(this.domNode,"align",_4._isBodyLtr()?"left":"right");return view;},buildViews:function(){for(var i=0,vs;(vs=this.layout.structure[i]);i++){this.createView(vs.type||_6._scopeName+".grid._View",i).setStructure(vs);}this.scroller.setContentNodes(this.views.getContentNodes());},_setStructureAttr:function(_6d4){var s=_6d4;if(s&&_4.isString(s)){_4.deprecated("dojox.grid._Grid.set('structure', 'objVar')","use dojox.grid._Grid.set('structure', objVar) instead","2.0");s=_4.getObject(s);}this.structure=s;if(!s){if(this.layout.structure){s=this.layout.structure;}else{return;}}this.views.destroyViews();this.focus.focusView=null;if(s!==this.layout.structure){this.layout.setStructure(s);}this._structureChanged();},setStructure:function(_6d5){_4.deprecated("dojox.grid._Grid.setStructure(obj)","use dojox.grid._Grid.set('structure', obj) instead.","2.0");this._setStructureAttr(_6d5);},getColumnTogglingItems:function(){return _4.map(this.layout.cells,function(cell){if(!cell.menuItems){cell.menuItems=[];}var self=this;var item=new _5.CheckedMenuItem({label:cell.name,checked:!cell.hidden,_gridCell:cell,onChange:function(_6d6){if(self.layout.setColumnVisibility(this._gridCell.index,_6d6)){var _6d7=this._gridCell.menuItems;if(_6d7.length>1){_4.forEach(_6d7,function(item){if(item!==this){item.setAttribute("checked",_6d6);}},this);}_6d6=_4.filter(self.layout.cells,function(c){if(c.menuItems.length>1){_4.forEach(c.menuItems,"item.set('disabled', false);");}else{c.menuItems[0].set("disabled",false);}return !c.hidden;});if(_6d6.length==1){_4.forEach(_6d6[0].menuItems,"item.set('disabled', true);");}}},destroy:function(){var _6d8=_4.indexOf(this._gridCell.menuItems,this);this._gridCell.menuItems.splice(_6d8,1);delete this._gridCell;_5.CheckedMenuItem.prototype.destroy.apply(this,arguments);}});cell.menuItems.push(item);return item;},this);},_setHeaderMenuAttr:function(menu){if(this._placeholders&&this._placeholders.length){_4.forEach(this._placeholders,function(p){p.unReplace(true);});this._placeholders=[];}if(this.headerMenu){this.headerMenu.unBindDomNode(this.viewsHeaderNode);}this.headerMenu=menu;if(!menu){return;}this.headerMenu.bindDomNode(this.viewsHeaderNode);if(this.headerMenu.getPlaceholders){this._placeholders=this.headerMenu.getPlaceholders(this.placeholderLabel);}},setHeaderMenu:function(menu){_4.deprecated("dojox.grid._Grid.setHeaderMenu(obj)","use dojox.grid._Grid.set('headerMenu', obj) instead.","2.0");this._setHeaderMenuAttr(menu);},setupHeaderMenu:function(){if(this._placeholders&&this._placeholders.length){_4.forEach(this._placeholders,function(p){if(p._replaced){p.unReplace(true);}p.replace(this.getColumnTogglingItems());},this);}},_fetch:function(_6d9){this.setScrollTop(0);},getItem:function(_6da){return null;},showMessage:function(_6db){if(_6db){this.messagesNode.innerHTML=_6db;this.messagesNode.style.display="";}else{this.messagesNode.innerHTML="";this.messagesNode.style.display="none";}},_structureChanged:function(){this.buildViews();if(this.autoRender&&this._started){this.render();}},hasLayout:function(){return this.layout.cells.length;},resize:function(_6dc,_6dd){this._pendingChangeSize=_6dc;this._pendingResultSize=_6dd;this.sizeChange();},_getPadBorder:function(){this._padBorder=this._padBorder||_4._getPadBorderExtents(this.domNode);return this._padBorder;},_getHeaderHeight:function(){var vns=this.viewsHeaderNode.style,t=vns.display=="none"?0:this.views.measureHeader();vns.height=t+"px";this.views.normalizeHeaderNodeHeight();return t;},_resize:function(_6de,_6df){_6de=_6de||this._pendingChangeSize;_6df=_6df||this._pendingResultSize;delete this._pendingChangeSize;delete this._pendingResultSize;if(!this.domNode){return;}var pn=this.domNode.parentNode;if(!pn||pn.nodeType!=1||!this.hasLayout()||pn.style.visibility=="hidden"||pn.style.display=="none"){return;}var _6e0=this._getPadBorder();var hh=undefined;var h;if(this._autoHeight){this.domNode.style.height="auto";}else{if(typeof this.autoHeight=="number"){h=hh=this._getHeaderHeight();h+=(this.scroller.averageRowHeight*this.autoHeight);this.domNode.style.height=h+"px";}else{if(this.domNode.clientHeight<=_6e0.h){if(pn==document.body){this.domNode.style.height=this.defaultHeight;}else{if(this.height){this.domNode.style.height=this.height;}else{this.fitTo="parent";}}}}}if(_6df){_6de=_6df;}if(_6de){_4.marginBox(this.domNode,_6de);this.height=this.domNode.style.height;delete this.fitTo;}else{if(this.fitTo=="parent"){h=this._parentContentBoxHeight=this._parentContentBoxHeight||_4._getContentBox(pn).h;this.domNode.style.height=Math.max(0,h)+"px";}}var _6e1=_4.some(this.views.views,function(v){return v.flexCells;});if(!this._autoHeight&&(h||_4._getContentBox(this.domNode).h)===0){this.viewsHeaderNode.style.display="none";}else{this.viewsHeaderNode.style.display="block";if(!_6e1&&hh===undefined){hh=this._getHeaderHeight();}}if(_6e1){hh=undefined;}this.adaptWidth();this.adaptHeight(hh);this.postresize();},adaptWidth:function(){var _6e2=(!this.initialWidth&&this.autoWidth);var w=_6e2?0:this.domNode.clientWidth||(this.domNode.offsetWidth-this._getPadBorder().w),vw=this.views.arrange(1,w);this.views.onEach("adaptWidth");if(_6e2){this.domNode.style.width=vw+"px";}},adaptHeight:function(_6e3){var t=_6e3===undefined?this._getHeaderHeight():_6e3;var h=(this._autoHeight?-1:Math.max(this.domNode.clientHeight-t,0)||0);this.views.onEach("setSize",[0,h]);this.views.onEach("adaptHeight");if(!this._autoHeight){var _6e4=0,_6e5=0;var _6e6=_4.filter(this.views.views,function(v){var has=v.hasHScrollbar();if(has){_6e4++;}else{_6e5++;}return (!has);});if(_6e4>0&&_6e5>0){_4.forEach(_6e6,function(v){v.adaptHeight(true);});}}if(this.autoHeight===true||h!=-1||(typeof this.autoHeight=="number"&&this.autoHeight>=this.get("rowCount"))){this.scroller.windowHeight=h;}else{this.scroller.windowHeight=Math.max(this.domNode.clientHeight-t,0);}},startup:function(){if(this._started){return;}this.inherited(arguments);if(this.autoRender){this.render();}},render:function(){if(!this.domNode){return;}if(!this._started){return;}if(!this.hasLayout()){this.scroller.init(0,this.keepRows,this.rowsPerPage);return;}this.update=this.defaultUpdate;this._render();},_render:function(){this.scroller.init(this.get("rowCount"),this.keepRows,this.rowsPerPage);this.prerender();this.setScrollTop(0);this.postrender();},prerender:function(){this.keepRows=this._autoHeight?0:this.keepRows;this.scroller.setKeepInfo(this.keepRows);this.views.render();this._resize();},postrender:function(){this.postresize();this.focus.initFocusView();_4.setSelectable(this.domNode,this.selectable);},postresize:function(){if(this._autoHeight){var size=Math.max(this.views.measureContent())+"px";this.viewsNode.style.height=size;}},renderRow:function(_6e7,_6e8){this.views.renderRow(_6e7,_6e8,this._skipRowRenormalize);},rowRemoved:function(_6e9){this.views.rowRemoved(_6e9);},invalidated:null,updating:false,beginUpdate:function(){this.invalidated=[];this.updating=true;},endUpdate:function(){this.updating=false;var i=this.invalidated,r;if(i.all){this.update();}else{if(i.rowCount!=undefined){this.updateRowCount(i.rowCount);}else{for(r in i){this.updateRow(Number(r));}}}this.invalidated=[];},defaultUpdate:function(){if(!this.domNode){return;}if(this.updating){this.invalidated.all=true;return;}this.lastScrollTop=this.scrollTop;this.prerender();this.scroller.invalidateNodes();this.setScrollTop(this.lastScrollTop);this.postrender();},update:function(){this.render();},updateRow:function(_6ea){_6ea=Number(_6ea);if(this.updating){this.invalidated[_6ea]=true;}else{this.views.updateRow(_6ea);this.scroller.rowHeightChanged(_6ea);}},updateRows:function(_6eb,_6ec){_6eb=Number(_6eb);_6ec=Number(_6ec);var i;if(this.updating){for(i=0;i<_6ec;i++){this.invalidated[i+_6eb]=true;}}else{for(i=0;i<_6ec;i++){this.views.updateRow(i+_6eb,this._skipRowRenormalize);}this.scroller.rowHeightChanged(_6eb);}},updateRowCount:function(_6ed){if(this.updating){this.invalidated.rowCount=_6ed;}else{this.rowCount=_6ed;this._setAutoHeightAttr(this.autoHeight,true);if(this.layout.cells.length){this.scroller.updateRowCount(_6ed);}this._resize();if(this.layout.cells.length){this.setScrollTop(this.scrollTop);}}},updateRowStyles:function(_6ee){this.views.updateRowStyles(_6ee);},getRowNode:function(_6ef){if(this.focus.focusView&&!(this.focus.focusView instanceof _6.grid._RowSelector)){return this.focus.focusView.rowNodes[_6ef];}else{for(var i=0,_6f0;(_6f0=this.views.views[i]);i++){if(!(_6f0 instanceof _6.grid._RowSelector)){return _6f0.rowNodes[_6ef];}}}return null;},rowHeightChanged:function(_6f1){this.views.renormalizeRow(_6f1);this.scroller.rowHeightChanged(_6f1);},fastScroll:true,delayScroll:false,scrollRedrawThreshold:(_4.isIE?100:50),scrollTo:function(_6f2){if(!this.fastScroll){this.setScrollTop(_6f2);return;}var _6f3=Math.abs(this.lastScrollTop-_6f2);this.lastScrollTop=_6f2;if(_6f3>this.scrollRedrawThreshold||this.delayScroll){this.delayScroll=true;this.scrollTop=_6f2;this.views.setScrollTop(_6f2);if(this._pendingScroll){window.clearTimeout(this._pendingScroll);}var _6f4=this;this._pendingScroll=window.setTimeout(function(){delete _6f4._pendingScroll;_6f4.finishScrollJob();},200);}else{this.setScrollTop(_6f2);}},finishScrollJob:function(){this.delayScroll=false;this.setScrollTop(this.scrollTop);},setScrollTop:function(_6f5){this.scroller.scroll(this.views.setScrollTop(_6f5));},scrollToRow:function(_6f6){this.setScrollTop(this.scroller.findScrollTop(_6f6)+1);},styleRowNode:function(_6f7,_6f8){if(_6f8){this.rows.styleRowNode(_6f7,_6f8);}},_mouseOut:function(e){this.rows.setOverRow(-2);},getCell:function(_6f9){return this.layout.cells[_6f9];},setCellWidth:function(_6fa,_6fb){this.getCell(_6fa).unitWidth=_6fb;},getCellName:function(_6fc){return "Cell "+_6fc.index;},canSort:function(_6fd){},sort:function(){},getSortAsc:function(_6fe){_6fe=_6fe==undefined?this.sortInfo:_6fe;return Boolean(_6fe>0);},getSortIndex:function(_6ff){_6ff=_6ff==undefined?this.sortInfo:_6ff;return Math.abs(_6ff)-1;},setSortIndex:function(_700,_701){var si=_700+1;if(_701!=undefined){si*=(_701?1:-1);}else{if(this.getSortIndex()==_700){si=-this.sortInfo;}}this.setSortInfo(si);},setSortInfo:function(_702){if(this.canSort(_702)){this.sortInfo=_702;this.sort();this.update();}},doKeyEvent:function(e){e.dispatch="do"+e.type;this.onKeyEvent(e);},_dispatch:function(m,e){if(m in this){return this[m](e);}return false;},dispatchKeyEvent:function(e){this._dispatch(e.dispatch,e);},dispatchContentEvent:function(e){this.edit.dispatchEvent(e)||e.sourceView.dispatchContentEvent(e)||this._dispatch(e.dispatch,e);},dispatchHeaderEvent:function(e){e.sourceView.dispatchHeaderEvent(e)||this._dispatch("doheader"+e.type,e);},dokeydown:function(e){this.onKeyDown(e);},doclick:function(e){if(e.cellNode){this.onCellClick(e);}else{this.onRowClick(e);}},dodblclick:function(e){if(e.cellNode){this.onCellDblClick(e);}else{this.onRowDblClick(e);}},docontextmenu:function(e){if(e.cellNode){this.onCellContextMenu(e);}else{this.onRowContextMenu(e);}},doheaderclick:function(e){if(e.cellNode){this.onHeaderCellClick(e);}else{this.onHeaderClick(e);}},doheaderdblclick:function(e){if(e.cellNode){this.onHeaderCellDblClick(e);}else{this.onHeaderDblClick(e);}},doheadercontextmenu:function(e){if(e.cellNode){this.onHeaderCellContextMenu(e);}else{this.onHeaderContextMenu(e);}},doStartEdit:function(_703,_704){this.onStartEdit(_703,_704);},doApplyCellEdit:function(_705,_706,_707){this.onApplyCellEdit(_705,_706,_707);},doCancelEdit:function(_708){this.onCancelEdit(_708);},doApplyEdit:function(_709){this.onApplyEdit(_709);},addRow:function(){this.updateRowCount(this.get("rowCount")+1);},removeSelectedRows:function(){if(this.allItemsSelected){this.updateRowCount(0);}else{this.updateRowCount(Math.max(0,this.get("rowCount")-this.selection.getSelected().length));}this.selection.clear();}});_6.grid._Grid.markupFactory=function(_70a,node,ctor,_70b){var d=_4;var _70c=function(n){var w=d.attr(n,"width")||"auto";if((w!="auto")&&(w.slice(-2)!="em")&&(w.slice(-1)!="%")){w=parseInt(w,10)+"px";}return w;};if(!_70a.structure&&node.nodeName.toLowerCase()=="table"){_70a.structure=d.query("> colgroup",node).map(function(cg){var sv=d.attr(cg,"span");var v={noscroll:(d.attr(cg,"noscroll")=="true")?true:false,__span:(!!sv?parseInt(sv,10):1),cells:[]};if(d.hasAttr(cg,"width")){v.width=_70c(cg);}return v;});if(!_70a.structure.length){_70a.structure.push({__span:Infinity,cells:[]});}d.query("thead > tr",node).forEach(function(tr,_70d){var _70e=0;var _70f=0;var _710;var _711=null;d.query("> th",tr).map(function(th){if(!_711){_710=0;_711=_70a.structure[0];}else{if(_70e>=(_710+_711.__span)){_70f++;_710+=_711.__span;var _712=_711;_711=_70a.structure[_70f];}}var cell={name:d.trim(d.attr(th,"name")||th.innerHTML),colSpan:parseInt(d.attr(th,"colspan")||1,10),type:d.trim(d.attr(th,"cellType")||""),id:d.trim(d.attr(th,"id")||"")};_70e+=cell.colSpan;var _713=d.attr(th,"rowspan");if(_713){cell.rowSpan=_713;}if(d.hasAttr(th,"width")){cell.width=_70c(th);}if(d.hasAttr(th,"relWidth")){cell.relWidth=window.parseInt(_4.attr(th,"relWidth"),10);}if(d.hasAttr(th,"hidden")){cell.hidden=(d.attr(th,"hidden")=="true"||d.attr(th,"hidden")===true);}if(_70b){_70b(th,cell);}cell.type=cell.type?_4.getObject(cell.type):_6.grid.cells.Cell;if(cell.type&&cell.type.markupFactory){cell.type.markupFactory(th,cell);}if(!_711.cells[_70d]){_711.cells[_70d]=[];}_711.cells[_70d].push(cell);});});}return new ctor(_70a,node);};})();}if(!_4._hasResource["dojox.grid.DataSelection"]){_4._hasResource["dojox.grid.DataSelection"]=true;_4.provide("dojox.grid.DataSelection");_4.declare("dojox.grid.DataSelection",_6.grid.Selection,{getFirstSelected:function(){var idx=_6.grid.Selection.prototype.getFirstSelected.call(this);if(idx==-1){return null;}return this.grid.getItem(idx);},getNextSelected:function(_714){var _715=this.grid.getItemIndex(_714);var idx=_6.grid.Selection.prototype.getNextSelected.call(this,_715);if(idx==-1){return null;}return this.grid.getItem(idx);},getSelected:function(){var _716=[];for(var i=0,l=this.selected.length;i<l;i++){if(this.selected[i]){_716.push(this.grid.getItem(i));}}return _716;},addToSelection:function(_717){if(this.mode=="none"){return;}var idx=null;if(typeof _717=="number"||typeof _717=="string"){idx=_717;}else{idx=this.grid.getItemIndex(_717);}_6.grid.Selection.prototype.addToSelection.call(this,idx);},deselect:function(_718){if(this.mode=="none"){return;}var idx=null;if(typeof _718=="number"||typeof _718=="string"){idx=_718;}else{idx=this.grid.getItemIndex(_718);}_6.grid.Selection.prototype.deselect.call(this,idx);},deselectAll:function(_719){var idx=null;if(_719||typeof _719=="number"){if(typeof _719=="number"||typeof _719=="string"){idx=_719;}else{idx=this.grid.getItemIndex(_719);}_6.grid.Selection.prototype.deselectAll.call(this,idx);}else{this.inherited(arguments);}}});}if(!_4._hasResource["dojox.grid.DataGrid"]){_4._hasResource["dojox.grid.DataGrid"]=true;_4.provide("dojox.grid.DataGrid");_4.declare("dojox.grid.DataGrid",_6.grid._Grid,{store:null,query:null,queryOptions:null,fetchText:"...",sortFields:null,updateDelay:1,items:null,_store_connects:null,_by_idty:null,_by_idx:null,_cache:null,_pages:null,_pending_requests:null,_bop:-1,_eop:-1,_requests:0,rowCount:0,_isLoaded:false,_isLoading:false,postCreate:function(){this._pages=[];this._store_connects=[];this._by_idty={};this._by_idx=[];this._cache=[];this._pending_requests={};this._setStore(this.store);this.inherited(arguments);},createSelection:function(){this.selection=new _6.grid.DataSelection(this);},get:function(_71a,_71b){if(_71b&&this.field=="_item"&&!this.fields){return _71b;}else{if(_71b&&this.fields){var ret=[];var s=this.grid.store;_4.forEach(this.fields,function(f){ret=ret.concat(s.getValues(_71b,f));});return ret;}else{if(!_71b&&typeof _71a==="string"){return this.inherited(arguments);}}}return (!_71b?this.defaultValue:(!this.field?this.value:(this.field=="_item"?_71b:this.grid.store.getValue(_71b,this.field))));},_checkUpdateStatus:function(){if(this.updateDelay>0){var _71c=false;if(this._endUpdateDelay){clearTimeout(this._endUpdateDelay);delete this._endUpdateDelay;_71c=true;}if(!this.updating){this.beginUpdate();_71c=true;}if(_71c){var _71d=this;this._endUpdateDelay=setTimeout(function(){delete _71d._endUpdateDelay;_71d.endUpdate();},this.updateDelay);}}},_onSet:function(item,_71e,_71f,_720){this._checkUpdateStatus();var idx=this.getItemIndex(item);if(idx>-1){this.updateRow(idx);}},_createItem:function(item,_721){var idty=this._hasIdentity?this.store.getIdentity(item):_4.toJson(this.query)+":idx:"+_721+":sort:"+_4.toJson(this.getSortProps());var o=this._by_idty[idty]={idty:idty,item:item};return o;},_addItem:function(item,_722,_723){this._by_idx[_722]=this._createItem(item,_722);if(!_723){this.updateRow(_722);}},_onNew:function(item,_724){this._checkUpdateStatus();var _725=this.get("rowCount");this._addingItem=true;this.updateRowCount(_725+1);this._addingItem=false;this._addItem(item,_725);this.showMessage();},_onDelete:function(item){this._checkUpdateStatus();var idx=this._getItemIndex(item,true);if(idx>=0){this._pages=[];this._bop=-1;this._eop=-1;var o=this._by_idx[idx];this._by_idx.splice(idx,1);delete this._by_idty[o.idty];this.updateRowCount(this.get("rowCount")-1);if(this.get("rowCount")===0){this.showMessage(this.noDataMessage);}}},_onRevert:function(){this._refresh();},setStore:function(_726,_727,_728){this._setQuery(_727,_728);this._setStore(_726);this._refresh(true);},setQuery:function(_729,_72a){this._setQuery(_729,_72a);this._refresh(true);},setItems:function(_72b){this.items=_72b;this._setStore(this.store);this._refresh(true);},_setQuery:function(_72c,_72d){this.query=_72c;this.queryOptions=_72d||this.queryOptions;},_setStore:function(_72e){if(this.store&&this._store_connects){_4.forEach(this._store_connects,this.disconnect,this);}this.store=_72e;if(this.store){var f=this.store.getFeatures();var h=[];this._canEdit=!!f["dojo.data.api.Write"]&&!!f["dojo.data.api.Identity"];this._hasIdentity=!!f["dojo.data.api.Identity"];if(!!f["dojo.data.api.Notification"]&&!this.items){h.push(this.connect(this.store,"onSet","_onSet"));h.push(this.connect(this.store,"onNew","_onNew"));h.push(this.connect(this.store,"onDelete","_onDelete"));}if(this._canEdit){h.push(this.connect(this.store,"revert","_onRevert"));}this._store_connects=h;}},_onFetchBegin:function(size,req){if(!this.scroller){return;}if(this.rowCount!=size){if(req.isRender){this.scroller.init(size,this.keepRows,this.rowsPerPage);this.rowCount=size;this._setAutoHeightAttr(this.autoHeight,true);this._skipRowRenormalize=true;this.prerender();this._skipRowRenormalize=false;}else{this.updateRowCount(size);}}if(!size){this.views.render();this._resize();this.showMessage(this.noDataMessage);this.focus.initFocusView();}else{this.showMessage();}},_onFetchComplete:function(_72f,req){if(!this.scroller){return;}if(_72f&&_72f.length>0){_4.forEach(_72f,function(item,idx){this._addItem(item,req.start+idx,true);},this);this.updateRows(req.start,_72f.length);if(req.isRender){this.setScrollTop(0);this.postrender();}else{if(this._lastScrollTop){this.setScrollTop(this._lastScrollTop);}}}delete this._lastScrollTop;if(!this._isLoaded){this._isLoading=false;this._isLoaded=true;}this._pending_requests[req.start]=false;},_onFetchError:function(err,req){console.log(err);delete this._lastScrollTop;if(!this._isLoaded){this._isLoading=false;this._isLoaded=true;this.showMessage(this.errorMessage);}this._pending_requests[req.start]=false;this.onFetchError(err,req);},onFetchError:function(err,req){},_fetch:function(_730,_731){_730=_730||0;if(this.store&&!this._pending_requests[_730]){if(!this._isLoaded&&!this._isLoading){this._isLoading=true;this.showMessage(this.loadingMessage);}this._pending_requests[_730]=true;try{if(this.items){var _732=this.items;var _733=this.store;this.rowsPerPage=_732.length;var req={start:_730,count:this.rowsPerPage,isRender:_731};this._onFetchBegin(_732.length,req);var _734=0;_4.forEach(_732,function(i){if(!_733.isItemLoaded(i)){_734++;}});if(_734===0){this._onFetchComplete(_732,req);}else{var _735=function(item){_734--;if(_734===0){this._onFetchComplete(_732,req);}};_4.forEach(_732,function(i){if(!_733.isItemLoaded(i)){_733.loadItem({item:i,onItem:_735,scope:this});}},this);}}else{this.store.fetch({start:_730,count:this.rowsPerPage,query:this.query,sort:this.getSortProps(),queryOptions:this.queryOptions,isRender:_731,onBegin:_4.hitch(this,"_onFetchBegin"),onComplete:_4.hitch(this,"_onFetchComplete"),onError:_4.hitch(this,"_onFetchError")});}}catch(e){this._onFetchError(e,{start:_730,count:this.rowsPerPage});}}},_clearData:function(){this.updateRowCount(0);this._by_idty={};this._by_idx=[];this._pages=[];this._bop=this._eop=-1;this._isLoaded=false;this._isLoading=false;},getItem:function(idx){var data=this._by_idx[idx];if(!data||(data&&!data.item)){this._preparePage(idx);return null;}return data.item;},getItemIndex:function(item){return this._getItemIndex(item,false);},_getItemIndex:function(item,_736){if(!_736&&!this.store.isItem(item)){return -1;}var idty=this._hasIdentity?this.store.getIdentity(item):null;for(var i=0,l=this._by_idx.length;i<l;i++){var d=this._by_idx[i];if(d&&((idty&&d.idty==idty)||(d.item===item))){return i;}}return -1;},filter:function(_737,_738){this.query=_737;if(_738){this._clearData();}this._fetch();},_getItemAttr:function(idx,attr){var item=this.getItem(idx);return (!item?this.fetchText:this.store.getValue(item,attr));},_render:function(){if(this.domNode.parentNode){this.scroller.init(this.get("rowCount"),this.keepRows,this.rowsPerPage);this.prerender();this._fetch(0,true);}},_requestsPending:function(_739){return this._pending_requests[_739];},_rowToPage:function(_73a){return (this.rowsPerPage?Math.floor(_73a/this.rowsPerPage):_73a);},_pageToRow:function(_73b){return (this.rowsPerPage?this.rowsPerPage*_73b:_73b);},_preparePage:function(_73c){if((_73c<this._bop||_73c>=this._eop)&&!this._addingItem){var _73d=this._rowToPage(_73c);this._needPage(_73d);this._bop=_73d*this.rowsPerPage;this._eop=this._bop+(this.rowsPerPage||this.get("rowCount"));}},_needPage:function(_73e){if(!this._pages[_73e]){this._pages[_73e]=true;this._requestPage(_73e);}},_requestPage:function(_73f){var row=this._pageToRow(_73f);var _740=Math.min(this.rowsPerPage,this.get("rowCount")-row);if(_740>0){this._requests++;if(!this._requestsPending(row)){setTimeout(_4.hitch(this,"_fetch",row,false),1);}}},getCellName:function(_741){return _741.field;},_refresh:function(_742){this._clearData();this._fetch(0,_742);},sort:function(){this.edit.apply();this._lastScrollTop=this.scrollTop;this._refresh();},canSort:function(){return (!this._isLoading);},getSortProps:function(){var c=this.getCell(this.getSortIndex());if(!c){if(this.sortFields){return this.sortFields;}return null;}else{var desc=c["sortDesc"];var si=!(this.sortInfo>0);if(typeof desc=="undefined"){desc=si;}else{desc=si?!desc:desc;}return [{attribute:c.field,descending:desc}];}},styleRowState:function(_743){if(this.store&&this.store.getState){var _744=this.store.getState(_743.index),c="";for(var i=0,ss=["inflight","error","inserting"],s;s=ss[i];i++){if(_744[s]){c=" dojoxGridRow-"+s;break;}}_743.customClasses+=c;}},onStyleRow:function(_745){this.styleRowState(_745);this.inherited(arguments);},canEdit:function(_746,_747){return this._canEdit;},_copyAttr:function(idx,attr){var row={};var _748={};var src=this.getItem(idx);return this.store.getValue(src,attr);},doStartEdit:function(_749,_74a){if(!this._cache[_74a]){this._cache[_74a]=this._copyAttr(_74a,_749.field);}this.onStartEdit(_749,_74a);},doApplyCellEdit:function(_74b,_74c,_74d){this.store.fetchItemByIdentity({identity:this._by_idx[_74c].idty,onItem:_4.hitch(this,function(item){var _74e=this.store.getValue(item,_74d);if(typeof _74e=="number"){_74b=isNaN(_74b)?_74b:parseFloat(_74b);}else{if(typeof _74e=="boolean"){_74b=_74b=="true"?true:_74b=="false"?false:_74b;}else{if(_74e instanceof Date){var _74f=new Date(_74b);_74b=isNaN(_74f.getTime())?_74b:_74f;}}}this.store.setValue(item,_74d,_74b);this.onApplyCellEdit(_74b,_74c,_74d);})});},doCancelEdit:function(_750){var _751=this._cache[_750];if(_751){this.updateRow(_750);delete this._cache[_750];}this.onCancelEdit.apply(this,arguments);},doApplyEdit:function(_752,_753){var _754=this._cache[_752];this.onApplyEdit(_752);},removeSelectedRows:function(){if(this._canEdit){this.edit.apply();var fx=_4.hitch(this,function(_755){if(_755.length){_4.forEach(_755,this.store.deleteItem,this.store);this.selection.clear();}});if(this.allItemsSelected){this.store.fetch({query:this.query,queryOptions:this.queryOptions,onComplete:fx});}else{fx(this.selection.getSelected());}}}});_6.grid.DataGrid.cell_markupFactory=function(_756,node,_757){var _758=_4.trim(_4.attr(node,"field")||"");if(_758){_757.field=_758;}_757.field=_757.field||_757.name;var _759=_4.trim(_4.attr(node,"fields")||"");if(_759){_757.fields=_759.split(",");}if(_756){_756(node,_757);}};_6.grid.DataGrid.markupFactory=function(_75a,node,ctor,_75b){return _6.grid._Grid.markupFactory(_75a,node,ctor,_4.partial(_6.grid.DataGrid.cell_markupFactory,_75b));};}if(!_4._hasResource["esri.dijit.editing.TemplatePicker"]){_4._hasResource["esri.dijit.editing.TemplatePicker"]=true;_4.provide("esri.dijit.editing.TemplatePicker");(function(){var css=[_4.moduleUrl("esri.dijit.editing","css/TemplatePicker.css"),_4.moduleUrl("dojox","grid/resources/Grid.css")];var head=document.getElementsByTagName("head").item(0),link;for(var i=0,il=css.length;i<il;i++){link=document.createElement("link");link.type="text/css";link.rel="stylesheet";link.href=css[i].toString();head.appendChild(link);}}());_4.declare("esri.dijit.editing.TemplatePicker",[_5._Widget,_5._Templated],{widgetsInTemplate:true,templateString:"<div class=\"templatePicker\">\r\n\r\n  <table dojoType=\"dojox.grid.DataGrid\" noDataMessage=\"${emptyMessage}\" selectionMode=\"none\" autoHeight=\"${_rows}\" autoWidth=\"${_autoWidth}\"\r\n         query=\"{ query: '*' }\" dojoAttachPoint=\"grid\" class=\"grid\">\r\n  </table>\r\n  \r\n</div>\r\n",basePath:_4.moduleUrl("esri.dijit.editing"),featureLayers:null,items:null,grouping:true,showTooltip:false,maxLabelLength:0,rows:4,columns:3,surfaceWidth:30,surfaceHeight:30,emptyMessage:"",_uniqueId:{id:0},_assumedCellWidth:90,_initialAutoWidth:300,_initialAutoHeight:200,_ieTimer:150,constructor:function(_75c,_75d){_75c=_75c||{};if(!_75c.items&&!_75c.featureLayers){console.error("TemplatePicker: please provide 'featureLayers' or 'items' parameter in the constructor");}this._dojo14x=(_4.version.minor>=4);this._itemWidgets={};this.emptyMessage=_75c.emptyMessage||_4.getObject("bundle.widgets.templatePicker.creationDisabled",false,esri)||"";},postMixInProperties:function(){this.inherited(arguments);this._preprocess();},startup:function(){this.inherited(arguments);if(this.rows==="auto"&&this.columns==="auto"){var box=_4.contentBox(this.domNode);if(!box.w){this.domNode.style.width=this._initialAutoWidth+"px";}if(!box.h){this.domNode.style.height=this._initialAutoHeight+"px";}box=_4.contentBox(this.domNode);this._columns=Math.floor(box.w/this._assumedCellWidth)||1;}this._applyGridPatches();this._setGridLayout();_4.connect(this.grid,"onRowClick",this,this._rowClicked);this._setGridData();this._toggleTooltip();if(_4.isIE<9){this._repaintItems=_4.hitch(this,this._repaintItems);setTimeout(this._repaintItems,this._ieTimer);}},destroy:function(){this.showTooltip=false;this._toggleTooltip();this.featureLayers=this.items=this.grid=this._flItems=this._itItems=this._groupRowIndices=this._selectedCell=this._selectedInfo=this._selectedItem=null;this.inherited(arguments);},getSelected:function(){return this._selectedCell?this._selectedItem:null;},clearSelection:function(){var _75e=this._selectedCell,info=this._selectedInfo;if(_75e){this._rowClicked({cellNode:_75e,rowIndex:info.selRow,cellIndex:info.selCol});}},update:function(_75f){var _760=(this.rows==="auto"&&this.columns==="auto"&&_75f)?true:false;var grid=this.grid;if(_760){var _761=this.domNode,box=_4.contentBox(_761),id=_761.id;this._columns=Math.floor((box.w-grid.views.views[0].getScrollbarWidth())/_4.coords(_4.query("#"+id+".templatePicker div.item")[0].parentNode).w);this._columns=this._columns||1;}var _762=this._rows;this._preprocess();var _763=this._rows;this._setGridLayout();this._setGridData();if(_763!==_762){grid.set("autoHeight",this._rows,false);}if(_760){grid._resize({w:box.w,h:box.h});grid.viewsHeaderNode.style.display="none";}else{grid.update();}this._toggleTooltip();var self=this,_764=this.getSelected();if(_764){grid.store.fetch({onComplete:function(its){var _765=self._locate(_764,self._selectedInfo,its);var _766=_765&&grid.views.views[0].getCellNode(_765[0],_765[1]);if(_766){self._rowClicked({cellNode:_766,rowIndex:_765[0],cellIndex:_765[1]},true);}}});}if(_4.isIE<9){setTimeout(this._repaintItems,this._ieTimer);}var _767=this.featureLayers,_768=this.items;if((!_767||!_767.length)&&(!_768||!_768.length)&&grid&&this.emptyMessage){grid.showMessage(this.emptyMessage);}},onSelectionChange:function(){},_preprocess:function(){if(this.items){this.grouping=false;}this._autoWidth=false;if(this.rows==="auto"||this.columns==="auto"){this._autoWidth=true;}var _769;if(this.featureLayers){_769=this._flItems=this._getItemsFromLayers(this.featureLayers);}else{_769=this._itItems=this._getItemsFromItems(this.items);}if(this.rows==="auto"&&this.columns==="auto"){if(!this._started){this._rows=false;this._columns=null;this._autoWidth=false;}return;}var len=0;this._rows=this.rows;this._columns=this.columns;if(this.rows==="auto"){if(this.featureLayers){if(this.grouping){len=_769.length;_4.forEach(_769,function(_76a){len+=Math.ceil(_76a.length/this.columns);},this);}else{_4.forEach(_769,function(_76b){len+=_76b.length;},this);len=Math.ceil(len/this.columns);}}else{len=Math.ceil(_769.length/this.columns);}this._rows=len;}else{if(this.columns==="auto"){if(this.featureLayers){if(this.grouping){len=3;}else{_4.forEach(_769,function(_76c){len+=_76c.length;},this);len=Math.ceil(len/this.rows);}}else{len=Math.ceil(_769.length/this.rows);}this._columns=len;}}},_applyGridPatches:function(){var grid=this.grid;var _76d=grid.adaptWidth;grid.adaptWidth=function(){var _76e=this.views.views;for(var i=0,view;view=_76e[i];i++){_4.style(view.headerNode,"display","block");}_76d.apply(this,arguments);for(var i=0,view;view=_76e[i];i++){_4.style(view.headerNode,"display","none");}};if(this._dojo14x){if(this.rows!=="auto"&&this.columns!=="auto"){var _76f=_4.connect(grid,"_onFetchComplete",this,function(){_4.disconnect(_76f);this.grid.set("autoHeight",this._rows);});}_4.connect(grid,"_onDelete",this,this._destroyItems);_4.connect(grid,"_clearData",this,this._destroyItems);_4.connect(grid,"destroy",this,this._destroyItems);var _770=grid.focus;if(_770&&_770.findAndFocusGridCell){_770.findAndFocusGridCell=function(){return false;};}}},_setGridLayout:function(){var _771=function(_772){return function(_773,_774){return this._cellGet(_772,_773,_774);};};var _775=_4.hitch(this,this._cellFormatter);var _776=[],cols=this._columns;for(var i=0;i<cols;i++){_776.push({field:"cell"+i,get:_4.hitch(this,_771(i)),formatter:_775});}var _777={cells:[_776]};if(this.grouping){var _778={field:"groupName",colSpan:cols,get:_4.hitch(this,this._cellGetGroup),formatter:_4.hitch(this,this._cellGroupFormatter)};_777.cells.push([_778]);}var grid=this.grid;grid.set("structure",_777);},_setGridData:function(){var _779=[];if(this.grouping){this._groupRowIndices=[];var _77a,_77b,cols=this._columns;_4.forEach(this._flItems,function(_77c,idx){_779.push({});var _77d=(idx===0)?0:(_77a+_77b+1);this._groupRowIndices.push(_77d);_77a=_77d;_77b=Math.ceil(_77c.length/cols);_779=_779.concat(this._getStoreItems(_77c));},this);}else{if(this.featureLayers){_4.forEach(this._flItems,function(_77e){_779=_779.concat(_77e);});_779=this._getStoreItems(_779);}else{_779=this._getStoreItems(this._itItems);}}var _77f=new _4.data.ItemFileReadStore({data:{items:_779}});this.grid.setStore(_77f);},_toggleTooltip:function(){if(this.showTooltip){if(this.tooltip){return;}this.tooltip=_4.create("div",{"class":"tooltip"},this.domNode);this.tooltip.style.display="none";this.tooltip.style.position="fixed";var grid=this.grid;this._mouseOverConnect=_4.connect(grid,"onCellMouseOver",this,this._cellMouseOver);this._mouseOutConnect=_4.connect(grid,"onCellMouseOut",this,this._cellMouseOut);}else{if(this.tooltip){_4.disconnect(this._mouseOverConnect);_4.disconnect(this._mouseOutConnect);_4.destroy(this.tooltip);this.tooltip=null;}}},_rowClicked:function(evt,_780){var _781=evt.cellNode,row=evt.rowIndex,col=evt.cellIndex;var cell=this._getCellInfo(_781,row,col);if(!cell){return;}if(this._selectedCell){_4.removeClass(this._selectedCell,"selectedItem");}if(_781!==this._selectedCell){_4.addClass(_781,"selectedItem");this._selectedCell=_781;var _782=this.grid.store;this._selectedItem={featureLayer:_782.getValue(cell,"layer"),type:_782.getValue(cell,"type"),template:_782.getValue(cell,"template"),symbolInfo:_782.getValue(cell,"symbolInfo"),item:this._getItem(cell)};this._selectedInfo={selRow:row,selCol:col,index1:_782.getValue(cell,"index1"),index2:_782.getValue(cell,"index2"),index:_782.getValue(cell,"index")};}else{this._selectedCell=this._selectedInfo=this._selectedItem=null;}if(!_780){this.onSelectionChange();}},_locate:function(_783,info,_784){var _785=this.grid.store,cols=new Array(this._columns);var _786,_787=info.index1,_788=info.index2,_789=info.index,item=_783.item;_4.some(_784,function(_78a,_78b){return _4.some(cols,function(_78c,_78d){var cell=_785.getValue(_78a,"cell"+_78d);if(cell&&(item?(_789===_785.getValue(cell,"index")):(_787===_785.getValue(cell,"index1")&&_788===_785.getValue(cell,"index2")))){_786=[_78b,_78d];return true;}else{return false;}});});return _786;},_getCellInfo:function(_78e,row,col){if(!_78e){return;}var grid=this.grid;var item=grid.getItem(row);var cell=grid.store.getValue(item,"cell"+col);return cell;},_getItem:function(cell){var _78f=this.items;if(_78f){return _78f[this.grid.store.getValue(cell,"index")];}},_cellMouseOver:function(evt){var _790=this.tooltip;var _791=evt.cellNode,row=evt.rowIndex,col=evt.cellIndex;var cell=this._getCellInfo(_791,row,col);if(_790&&cell){var _792=this.grid.store;var _793=_792.getValue(cell,"template");var type=_792.getValue(cell,"type");var _794=_792.getValue(cell,"symbolInfo");var _795=_792.getValue(cell,"layer");var item=this._getItem(cell);var _796=(item&&(item.label+(item.description?(": "+item.description):"")))||(_793&&(_793.name+(_793.description?(": "+_793.description):"")))||(type&&type.name)||(_794&&(_794.label+(_794.description?(": "+_794.description):"")))||((_795&&_795.name+": ")+"Default");_790.style.display="none";_790.innerHTML=_796;var _797=_4.coords(_791.firstChild);_4.style(_790,{left:(_797.x)+"px",top:(_797.y+_797.h+5)+"px"});_790.style.display="";}},_cellMouseOut:function(){var _798=this.tooltip;if(_798){_798.style.display="none";}},_destroyItems:function(){var _799=this._itemWidgets;for(var w in _799){if(!_799[w]){continue;}_799[w].destroy();delete _799[w];}},_repaintItems:function(){var _79a=this._itemWidgets;for(var w in _79a){var _79b=_79a[w];if(_79b){_79b._repaint(_79b._surface);}}},_getStoreItems:function(_79c){var uid=this._uniqueId;_79c=_4.map(_79c,function(item){return _4.mixin({"surfaceId":"tpick-surface-"+(uid.id++)},item);});var len=_79c.length,_79d=0,obj={},k=0,prop,_79e=[],flag=true,cols=this._columns;while(_79d<len){flag=true;prop="cell"+k;obj[prop]=_79c[_79d];_79d++;k++;if(k%cols===0){flag=false;_79e.push(obj);obj={};k=0;}}if(flag){_79e.push(obj);}return _79e;},_getItemsFromLayers:function(_79f){var _7a0=[];_4.forEach(_79f,function(_7a1,_7a2){_7a0.push(this._getItemsFromLayer(_7a1,_7a2));},this);return _7a0;},_getItemsFromLayer:function(_7a3,_7a4){var _7a5=[];var _7a6=[];_7a6=_7a6.concat(_7a3.templates);_4.forEach(_7a3.types,function(_7a7){var _7a8=_7a7.templates;_4.forEach(_7a8,function(_7a9){_7a9._type_=_7a7;});_7a6=_7a6.concat(_7a8);});_7a6=_4.filter(_7a6,esri._isDefined);var _7aa=_7a3.renderer;if(_7aa){if(_7a6.length>0){_4.forEach(_7a6,function(_7ab){var _7ac=_7ab.prototype;if(_7ac){var _7ad=_7aa.getSymbol(_7ac);if(_7ad){_7a5.push({label:this._trimLabel(_7ab.name),symbol:_7ad,layer:_7a3,type:_7ab._type_,template:_7ab,index1:_7a4,index2:_7a5.length});}}delete _7ab._type_;},this);}else{var _7ae=_7aa.declaredClass.replace("esri.renderer.",""),_7af=[];if(_7ae==="TemporalRenderer"){_7aa=_7aa.observationRenderer;if(_7aa){_7ae=_7aa.declaredClass.replace("esri.renderer.","");}}switch(_7ae){case "SimpleRenderer":_7af=[{symbol:_7aa.symbol,label:_7aa.label,description:_7aa.description}];break;case "UniqueValueRenderer":case "ClassBreaksRenderer":_7af=_7aa.infos;break;}_7a5=_4.map(_7af,function(info,idx){return {label:this._trimLabel(info.label),description:info.description,symbolInfo:_4.mixin({constructor:function(){}},info),symbol:info.symbol,layer:_7a3,index1:_7a4,index2:idx};},this);}}return _7a5;},_getItemsFromItems:function(_7b0){return _4.map(_7b0,function(item,idx){var item=_4.mixin({index:idx},item);item.label=this._trimLabel(item.label);return item;},this);},_trimLabel:function(_7b1){var max=this.maxLabelLength;if(max&&_7b1){if(_7b1.length>max){_7b1=_7b1.substr(0,max)+"...";}}return _7b1||"";},_cellGet:function(_7b2,_7b3,_7b4){if(!_7b4){return "";}return this.grid.store.getValue(_7b4,"cell"+_7b2);},_cellFormatter:function(_7b5){if(_7b5){var _7b6=this._itemWidgets,_7b7=this.grid.store;var sid=_7b7.getValue(_7b5,"surfaceId");var w=_7b6[sid];if(!w){w=(_7b6[sid]=new esri.dijit.editing.TemplatePickerItem({id:sid,label:_7b7.getValue(_7b5,"label"),symbol:_7b7.getValue(_7b5,"symbol"),surfaceWidth:this.surfaceWidth,surfaceHeight:this.surfaceHeight,template:_7b7.getValue(_7b5,"template")}));}return w||"";}else{return "";}},_cellGetGroup:function(_7b8,_7b9){if(!this._groupRowIndices){return "";}var _7ba=_4.indexOf(this._groupRowIndices,_7b8);if(!_7b9||_7ba===-1){return "";}return (this.featureLayers[_7ba]&&this.featureLayers[_7ba].name)||"";},_cellGroupFormatter:function(_7bb){if(_7bb){return "<div class='groupLabel'>"+_7bb+"</div>";}else{return "";}}});_4.declare("esri.dijit.editing.TemplatePickerItem",[_5._Widget,_5._Templated],{templateString:"<div class='item' style='text-align: center;'>"+"<div class='itemSymbol' dojoAttachPoint='_surfaceNode'></div>"+"<div class='itemLabel'>${label}</div>"+"</div>",startup:function(){if(this._started){return;}this.inherited(arguments);this._surface=this._draw(this._surfaceNode,this.symbol,this.surfaceWidth,this.surfaceHeight,this.template);},_draw:function(node,_7bc,_7bd,_7be,_7bf){var _7c0=_6.gfx.createSurface(node,_7bd,_7be);if(_4.isIE<9){var _7c1=_7c0.getEventSource();_4.style(_7c1,"position","relative");_4.style(_7c1.parentNode,"position","relative");}var _7c2=this._getDrawingToolShape(_7bc,_7bf)||esri.symbol.getShapeDescriptors(_7bc);var _7c3;try{_7c3=_7c0.createShape(_7c2.defaultShape).setFill(_7c2.fill).setStroke(_7c2.stroke);}catch(e){_7c0.clear();_7c0.destroy();return;}var dim=_7c0.getDimensions();var _7c4={dx:dim.width/2,dy:dim.height/2};var bbox=_7c3.getBoundingBox(),_7c5=bbox.width,_7c6=bbox.height;if(_7c5>_7bd||_7c6>_7be){var _7c7=_7c5>_7c6?_7c5:_7c6;var _7c8=_7bd<_7be?_7bd:_7be;var _7c9=(_7c8-5)/_7c7;_4.mixin(_7c4,{xx:_7c9,yy:_7c9});}_7c3.applyTransform(_7c4);return _7c0;},_getDrawingToolShape:function(_7ca,_7cb){var _7cc,_7cd=_7cb?_7cb.drawingTool||null:null;switch(_7cd){case "esriFeatureEditToolArrow":_7cc={type:"path",path:"M 10,1 L 3,8 L 3,5 L -15,5 L -15,-2 L 3,-2 L 3,-5 L 10,1 E"};break;case "esriFeatureEditToolLeftArrow":_7cc={type:"path",path:"M -15,1 L -8,8 L -8,5 L 10,5 L 10,-2 L -8,-2 L -8,-5 L -15,1 E"};break;case "esriFeatureEditToolRightArrow":_7cc={type:"path",path:"M 10,1 L 3,8 L 3,5 L -15,5 L -15,-2 L 3,-2 L 3,-5 L 10,1 E"};break;case "esriFeatureEditToolUpArrow":_7cc={type:"path",path:"M 1,-10 L 8,-3 L 5,-3 L 5,15 L -2,15 L -2,-3 L -5,-3 L 1,-10 E"};break;case "esriFeatureEditToolDownArrow":_7cc={type:"path",path:"M 1,15 L 8,8 L 5,8 L 5,-10 L -2,-10 L -2,8 L -5,8 L 1,15 E"};break;case "esriFeatureEditToolTriangle":_7cc={type:"path",path:"M -10,14 L 2,-10 L 14,14 L -10,14 E"};break;case "esriFeatureEditToolRectangle":_7cc={type:"path",path:"M -10,-10 L 10,-10 L 10,10 L -10,10 L -10,-10 E"};break;case "esriFeatureEditToolCircle":_7cc={type:"circle",cx:0,cy:0,r:10};break;case "esriFeatureEditToolEllipse":_7cc={type:"ellipse",cx:0,cy:0,rx:10,ry:5};break;case "esriFeatureEditToolFreehand":if(_7ca.type==="simplelinesymbol"||_7ca.type==="cartographiclinesymbol"){_7cc={type:"path",path:"m -11, -7c-1.5,-3.75 7.25,-9.25 12.5,-7c5.25,2.25 6.75,9.75 3.75,12.75c-3,3 -3.25,2.5 -9.75,5.25c-6.5,2.75 -7.25,14.25 2,15.25c9.25,1 11.75,-4 13.25,-6.75c1.5,-2.75 3.5,-11.75 12,-6.5"};}else{_7cc={type:"path",path:"M 10,-13 c3.1,0.16667 4.42564,2.09743 2.76923,3.69231c-2.61025,2.87179 -5.61025,5.6718 -6.14358,6.20513c-0.66667,0.93333 -0.46667,1.2 -0.53333,1.93333c-0.00001,0.86666 0.6,1.66667 1.13334,2c1.03077,0.38462 2.8,0.93333 3.38974,1.70769c0.47693,0.42564 0.87693,0.75897 1.41026,1.75897c0.13333,1.06667 -0.46667,2.86667 -1.8,3.8c-0.73333,0.73333 -3.86667,2.66666 -4.86667,3.13333c-0.93333,0.8 -7.4,3.2 -7.6,3.06667c-1.06667,0.46667 -4.73333,1.13334 -5.2,1.26667c-1.6,0.33334 -4.6,0.4 -6.25128,0.05128c-1.41539,-0.18462 -2.34872,-2.31796 -1.41539,-4.45129c0.93333,-1.73333 1.86667,-3.13333 2.64615,-3.85641c1.28718,-1.47692 2.57437,-2.68204 3.88718,-3.54359c0.88718,-1.13845 1.8,-1.33333 2.26666,-2.45641c0.33334,-0.74359 0.37949,-1.7641 0.06667,-2.87692c-0.66666,-1.46666 -1.66666,-1.86666 -2.98975,-2.2c-1.27692,-0.26666 -2.12307,-0.64102 -3.27692,-1.46666c-0.66667,-1.00001 -1.01538,-3.01539 0.73333,-4.06667c1.73333,-1.2 3.6,-1.93333 4.93333,-2.2c1.33333,-0.46667 4.84104,-1.09743 5.84103,-1.23076c1.60001,-0.46667 6.02564,-0.50257 7.29231,-0.56924z"};}break;default:return null;}return {defaultShape:_7cc,fill:_7ca.getFill(),stroke:_7ca.getStroke()};},_repaint:function(_7ce){if(!_7ce){this._surface=this._draw(this._surfaceNode,this.symbol,this.surfaceWidth,this.surfaceHeight,this.template);return;}if(_7ce.getStroke&&_7ce.setStroke){_7ce.setStroke(_7ce.getStroke());}if(_7ce.getFill&&_7ce.setFill){_7ce.setFill(_7ce.getFill());}if(_7ce.children&&_4.isArray(_7ce.children)){_4.forEach(_7ce.children,this._repaint,this);}},destroy:function(){if(this._surface){this._surface.destroy();delete this._surface;}this.inherited(arguments);}});}if(!_4._hasResource["esri.dijit.editing.TemplatePicker-all"]){_4._hasResource["esri.dijit.editing.TemplatePicker-all"]=true;_4.provide("esri.dijit.editing.TemplatePicker-all");}}};});
