// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
require({cache:{"url:esri/dijit/templates/MultidimensionalFilter.html":'\x3cdiv data-dojo-attach-point\x3d"_multidimensionalFilterContainer" class\x3d"esriMultidimensionalFilterContainer"\x3e\r\n    \x3ctable class\x3d"esriMultidimensionalFilterTable"\x3e\r\n        \x3ctbody\x3e\r\n        \x3ccol class\x3d"esriMultidimensionalFilterCol1"/\x3e\r\n        \x3ccol class\x3d"esriMultidimensionalFilterCol2"/\x3e\r\n        \x3ccol class\x3d"esriMultidimensionalFilterCol3"/\x3e\r\n        \x3ctr\x3e\r\n            \x3ctd colspan\x3d"3"\x3e\r\n                \x3clabel class\x3d"esriMultidimensionalFilterHeadingLabel" data-dojo-attach-point\x3d"VariableFilterLabel"\x3e${_i18n.widgets.multidimensionalFilter.variableFilter}\r\n                \x3c/label\x3e\r\n            \x3c/td\x3e\r\n        \x3c/tr\x3e\r\n        \x3ctr\x3e\r\n            \x3ctd colspan\x3d"3" data-dojo-attach-point\x3d"VariableListRow"\x3e\r\n                \x3cdiv data-dojo-attach-point\x3d"variableList" data-dojo-type\x3d"dijit/form/FilteringSelect" class\x3d"esriMultidimensionalFilterVariableList dijitSelect"\x3e\r\n                \x3c/div\x3e\r\n            \x3c/td\x3e\r\n        \x3c/tr\x3e\r\n        \x3ctr\x3e\r\n            \x3ctd colspan\x3d"3" class\x3d"esriMultidimensionalFilterDimensionHeadingLabelTd"\x3e\r\n                \x3clabel class\x3d"esriMultidimensionalFilterDimensionHeadingLabel" data-dojo-attach-point\x3d"VariableFilterLabel"\x3e${_i18n.widgets.multidimensionalFilter.filterByDimensionalValues}\r\n                \x3c/label\x3e\r\n            \x3c/td\x3e\r\n        \x3c/tr\x3e\r\n        \x3c/tbody\x3e\r\n    \x3c/table\x3e\r\n        \x3cdiv class\x3d"esriMultidimensionalFilterDimensionFilterGrid" data-dojo-attach-point\x3d"dimensionFilterGrid"\x3e\r\n        \x3c/div\x3e\r\n      \x3cdiv data-dojo-type\x3d"dijit/form/Button" data-dojo-attach-event\x3d"onClick: _onClickApplyMultidimensionalFilter" data-dojo-attach-point\x3d"applyButton"\x3e${_i18n.widgets.multidimensionalFilter.applyLabelTitle}\r\n      \x3c/div\x3e\r\n\x3c/div\x3e\r\n',
"url:esri/dijit/templates/NumericDimensionItem.html":'\x3ctable class\x3d"esriMultidimensionalFilterItemTable"\x3e\r\n  \x3ctbody\x3e\r\n  \x3ccol class\x3d"esriMultidimensionalFilterCol1"/\x3e\r\n  \x3ccol class\x3d"esriMultidimensionalFilterCol2"/\x3e\r\n  \x3ccol class\x3d"esriMultidimensionalFilterCol3"/\x3e\r\n  \x3ctr\x3e\r\n    \x3ctd colspan\x3d"2"\x3e\r\n      \x3cinput data-dojo-attach-point\x3d"dimensionCheckbox" name\x3d"dimensionCheckbox" data-dojo-type\x3d"dijit/form/CheckBox" data-dojo-attach-event\x3d"onChange:_onDimensionCheckboxChange" checked/\x3e \x3clabel for\x3d"${dimension}" class\x3d"esriMultidimensionalFilterDimensionText" data-dojo-attach-point\x3d"dimensionAlias"\x3e${dimensionAlias}\x3c/label\x3e \r\n      \x3cspan data-dojo-attach-point\x3d"dimensionUnit"\x3e\x3c/span\x3e\r\n      \x3cdiv class\x3d"esriMultidimensionalFilterInfoDiv" id\x3d"${dimension}${id}Info"\x3e\r\n        \x3cdiv data-dojo-type\x3d"dijit/Tooltip" data-dojo-props\x3d"connectId:\'${dimension}${id}Info\',position:[\'after\']"\x3e\r\n          \x3cdiv class\x3d"esriMultidimensionalFilterInfoTooltip"\x3e\r\n            \x3cb\x3e${dimensionAlias}\x3c/b\x3e \r\n            \x3cspan data-dojo-attach-point\x3d"tooltipUnit"\x3e\x3c/span\x3e\r\n            \x3cbr/\x3e   \x3cspan class\x3d"esriMultidimensionalFilterTooltipLeftText"\x3e${_i18n.widgets.multidimensionalFilter.tooltipNumberFromValueText}\x3c/span\x3e \x3cspan data-dojo-attach-point\x3d"tooltipFromValue"\x3e\x3c/span\x3e\r\n            \x3cbr/\x3e   \x3cspan class\x3d"esriMultidimensionalFilterTooltipLeftText"\x3e${_i18n.widgets.multidimensionalFilter.tooltipNumberToValueText}\x3c/span\x3e \x3cspan data-dojo-attach-point\x3d"tooltipToValue"\x3e\x3c/span\x3e\r\n            \x3cbr/\x3e   \x3cspan class\x3d"esriMultidimensionalFilterTooltipLeftText"\x3e${_i18n.widgets.multidimensionalFilter.tooltipCountText}\x3c/span\x3e \x3cspan data-dojo-attach-point\x3d"tooltipValueCount"\x3e\x3c/span\x3e\r\n            \x3cspan data-dojo-attach-point\x3d"disabledDimText" class\x3d"esriMultidimensionalFilterTooltipDisabledDimensionText"\x3e\x3c/span\x3e\r\n          \x3c/div\x3e\r\n        \x3c/div\x3e\r\n      \x3c/div\x3e\r\n    \x3c/td\x3e\r\n    \x3ctd\x3e\x3cspan data-dojo-attach-point\x3d"rangeSpan"\x3e\x3cinput data-dojo-attach-point\x3d"rangeCheckbox" data-dojo-type\x3d"dijit/form/CheckBox" data-dojo-attach-event\x3d"onChange:_onRangeCheckboxChange"/\x3e \x3clabel for\x3d"${dimension}RangeCheckbox" class\x3d"rangeText"\x3e${_i18n.widgets.multidimensionalFilter.rangeText}\x3c/label\x3e\r\n        \x3cdiv class\x3d"esriMultidimensionalFilterRangeInfoDiv" id\x3d"${dimension}${id}hasRangesInfo" data-dojo-attach-point\x3d"hasRangesInfo"\x3e\r\n          \x3cdiv data-dojo-type\x3d"dijit/Tooltip" data-dojo-props\x3d"connectId:\'${dimension}${id}hasRangesInfo\',position:[\'after\']"\x3e\r\n            \x3cdiv class\x3d"esriMultidimensionalFilterInfoTooltip"\x3e\r\n              ${_i18n.widgets.multidimensionalFilter.hasRangesInfoText1}\x3cbr/\x3e\r\n              ${_i18n.widgets.multidimensionalFilter.hasRangesInfoText2}\r\n            \x3c/div\x3e\r\n          \x3c/div\x3e\r\n        \x3c/div\x3e\r\n      \x3c/span\x3e\r\n    \x3c/td\x3e\r\n  \x3c/tr\x3e\r\n  \x3ctr data-dojo-attach-point\x3d"minRow"\x3e\r\n    \x3ctd\x3e\x3cspan data-dojo-attach-point\x3d"minValueText"\x3e${_i18n.widgets.multidimensionalFilter.sliceNumberText}\x3c/span\x3e\x3c/td\x3e\r\n    \x3ctd colspan\x3d"2"\x3e\r\n      \x3cspan data-dojo-attach-point\x3d"minNumberSelector"\x3e\x3c/span\x3e\r\n    \x3c/td\x3e\r\n  \x3c/tr\x3e\r\n  \x3ctr data-dojo-attach-point\x3d"maxRow" class\x3d"esriDomHide"\x3e\r\n    \x3ctd\x3e${toText}\x3c/td\x3e\r\n    \x3ctd colspan\x3d"2"\x3e\r\n      \x3cspan data-dojo-attach-point\x3d"maxNumberSelector"\x3e\x3c/span\x3e\r\n    \x3c/td\x3e\r\n  \x3c/tr\x3e\r\n\x3c/tbody\x3e\r\n\x3c/table\x3e',
"url:esri/dijit/templates/TimeDimensionItem.html":'\x3ctable class\x3d"esriMultidimensionalFilterItemTable"\x3e\r\n  \x3ctbody\x3e\r\n  \x3ccol class\x3d"esriMultidimensionalFilterCol1"/\x3e\r\n  \x3ccol class\x3d"esriMultidimensionalFilterCol2"/\x3e\r\n  \x3ccol class\x3d"esriMultidimensionalFilterCol3"/\x3e\r\n  \x3ctr\x3e\r\n    \x3ctd colspan\x3d"2"\x3e\r\n      \x3cinput data-dojo-attach-point\x3d"dimensionCheckbox" name\x3d"dimensionCheckbox" data-dojo-type\x3d"dijit/form/CheckBox" data-dojo-attach-event\x3d"onChange:_onDimensionCheckboxChange" checked/\x3e \x3clabel for\x3d"${dimension}" class\x3d"esriMultidimensionalFilterDimensionText" data-dojo-attach-point\x3d"dimensionAlias"\x3e${dimensionAlias}\x3c/label\x3e \r\n      \x3cspan data-dojo-attach-point\x3d"dimensionUnit"\x3e\x3c/span\x3e\r\n      \x3cdiv class\x3d"esriMultidimensionalFilterInfoDiv" id\x3d"${dimension}${id}Info"\x3e\r\n        \x3cdiv data-dojo-type\x3d"dijit/Tooltip" data-dojo-props\x3d"connectId:\'${dimension}${id}Info\',position:[\'after\']"\x3e\r\n          \x3cdiv class\x3d"esriMultidimensionalFilterInfoTooltip"\x3e\r\n            \x3cb\x3e${dimensionAlias}\x3c/b\x3e\r\n            \x3cspan data-dojo-attach-point\x3d"tooltipUnit"\x3e\x3c/span\x3e\r\n            \x3cbr/\x3e   \x3cspan class\x3d"esriMultidimensionalFilterTooltipLeftText"\x3e${_i18n.widgets.multidimensionalFilter.tooltipDateFromValueText}\x3c/span\x3e \x3cspan data-dojo-attach-point\x3d"tooltipFromValue"\x3e\x3c/span\x3e\r\n            \x3cbr/\x3e   \x3cspan class\x3d"esriMultidimensionalFilterTooltipLeftText"\x3e${_i18n.widgets.multidimensionalFilter.tooltipDateToValueText}\x3c/span\x3e \x3cspan data-dojo-attach-point\x3d"tooltipToValue"\x3e\x3c/span\x3e\r\n            \x3cbr/\x3e   \x3cspan class\x3d"esriMultidimensionalFilterTooltipLeftText"\x3e${_i18n.widgets.multidimensionalFilter.tooltipCountText}\x3c/span\x3e \x3cspan data-dojo-attach-point\x3d"tooltipValueCount"\x3e\x3c/span\x3e\r\n            \x3cspan data-dojo-attach-point\x3d"disabledDimText" class\x3d"esriMultidimensionalFilterTooltipDisabledDimensionText"\x3e\x3c/span\x3e\r\n          \x3c/div\x3e\r\n        \x3c/div\x3e\r\n      \x3c/div\x3e\r\n    \x3c/td\x3e\r\n    \x3ctd\x3e\x3cspan data-dojo-attach-point\x3d"rangeSpan"\x3e\x3cinput data-dojo-attach-point\x3d"rangeCheckbox" data-dojo-type\x3d"dijit/form/CheckBox" data-dojo-attach-event\x3d"onChange:_onRangeCheckboxChange"/\x3e \x3clabel for\x3d"${dimension}RangeCheckbox" class\x3d"rangeText"\x3e${_i18n.widgets.multidimensionalFilter.rangeText}\x3c/label\x3e\r\n        \x3cdiv class\x3d"esriMultidimensionalFilterRangeInfoDiv" id\x3d"${dimension}${id}hasRangesInfo" data-dojo-attach-point\x3d"hasRangesInfo"\x3e\r\n          \x3cdiv data-dojo-type\x3d"dijit/Tooltip" data-dojo-props\x3d"connectId:\'${dimension}${id}hasRangesInfo\',position:[\'after\']"\x3e\r\n            \x3cdiv class\x3d"esriMultidimensionalFilterInfoTooltip"\x3e\r\n              ${_i18n.widgets.multidimensionalFilter.hasRangesInfoText1}\x3cbr/\x3e\r\n              ${_i18n.widgets.multidimensionalFilter.hasRangesInfoText2}\r\n            \x3c/div\x3e\r\n          \x3c/div\x3e\r\n        \x3c/div\x3e\r\n      \x3c/span\x3e\r\n    \x3c/td\x3e\r\n  \x3c/tr\x3e\r\n  \x3ctr data-dojo-attach-point\x3d"minRow"\x3e\r\n    \x3ctd\x3e\x3cspan data-dojo-attach-point\x3d"minDateText"\x3e${_i18n.widgets.multidimensionalFilter.sliceTimeText}\x3c/span\x3e\x3c/td\x3e\r\n    \x3ctd colspan\x3d"2"\x3e\r\n      \x3cspan data-dojo-attach-point\x3d"minDateSelector"\x3e\x3c/span\x3e\r\n    \x3c/td\x3e\r\n  \x3c/tr\x3e\r\n  \x3ctr data-dojo-attach-point\x3d"maxRow" class\x3d"esriDomHide"\x3e\r\n    \x3ctd\x3e${toText}\x3c/td\x3e\r\n    \x3ctd  colspan\x3d"2"\x3e\r\n      \x3cspan data-dojo-attach-point\x3d"maxDateSelector"\x3e\x3c/span\x3e\r\n    \x3c/td\x3e\r\n  \x3c/tr\x3e\r\n\x3c/tbody\x3e\r\n\x3c/table\x3e',
"url:esri/dijit/templates/PagedDateTimeWidget.html":'\x3cdiv\x3e\r\n  \x3cbutton data-dojo-type\x3d"dijit/form/Button" data-dojo-props\x3d"iconClass:\'tsButton tsStartButton\', showLabel: false" data-dojo-attach-point\x3d"StartBtn" data-dojo-attach-event\x3d"onClick:_onStartBtnClick" type\x3d"button"\x3e${_i18n.widgets.multidimensionalFilter.startDateButtonTooltip}\x3c/button\x3e\r\n  \x3cbutton data-dojo-type\x3d"dijit/form/Button" data-dojo-props\x3d"iconClass:\'tsButton tsPrevButton\', showLabel: false" data-dojo-attach-point\x3d"PreviousBtn" data-dojo-attach-event\x3d"onClick:_onPreviousBtnClick" type\x3d"button"\x3e${_i18n.widgets.multidimensionalFilter.previousButtonTooltip}\x3c/button\x3e\r\n  \x3cdiv class\x3d"esriMultidimensionalFilterSelectorDiv"\x3e\x3cspan data-dojo-attach-point\x3d"DateSelector"\x3e\x3c/span\x3e\x3cspan data-dojo-attach-point\x3d"TimeSelector"\x3e\x3c/span\x3e\x3c/div\x3e\r\n  \x3cbutton data-dojo-type\x3d"dijit/form/Button" data-dojo-props\x3d"iconClass:\'tsButton tsNextButton\', showLabel: false" data-dojo-attach-point\x3d"NextBtn" data-dojo-attach-event\x3d"onClick:_onNextBtnClick" type\x3d"button"\x3e${_i18n.widgets.multidimensionalFilter.nextButtonTooltip}\x3c/button\x3e\r\n  \x3cbutton data-dojo-type\x3d"dijit/form/Button" data-dojo-props\x3d"iconClass:\'tsButton tsEndButton\', showLabel: false" data-dojo-attach-point\x3d"EndBtn" data-dojo-attach-event\x3d"onClick:_onEndBtnClick" type\x3d"button"\x3e${_i18n.widgets.multidimensionalFilter.endDateButtonTooltip}\x3c/button\x3e\r\n\x3c/div\x3e',
"url:esri/dijit/templates/PagedNumberWidget.html":'\x3cdiv\x3e\r\n  \x3cbutton data-dojo-type\x3d"dijit/form/Button" data-dojo-props\x3d"iconClass:\'tsButton tsStartButton\', showLabel: false" data-dojo-attach-point\x3d"StartBtn" data-dojo-attach-event\x3d"onClick:_onStartBtnClick" type\x3d"button"\x3e${_i18n.widgets.multidimensionalFilter.startNumberButtonTooltip}\x3c/button\x3e\r\n  \x3cbutton data-dojo-type\x3d"dijit/form/Button" data-dojo-props\x3d"iconClass:\'tsButton tsPrevButton\', showLabel: false" data-dojo-attach-point\x3d"PreviousBtn" data-dojo-attach-event\x3d"onClick:_onPreviousBtnClick" type\x3d"button"\x3e${_i18n.widgets.multidimensionalFilter.previousButtonTooltip}\x3c/button\x3e\r\n  \x3cdiv class\x3d"esriMultidimensionalFilterSelectorDiv"\x3e\x3cspan data-dojo-attach-point\x3d"NumberSelector"\x3e\x3c/span\x3e\x3c/div\x3e\r\n  \x3cbutton data-dojo-type\x3d"dijit/form/Button" data-dojo-props\x3d"iconClass:\'tsButton tsNextButton\', showLabel: false" data-dojo-attach-point\x3d"NextBtn" data-dojo-attach-event\x3d"onClick:_onNextBtnClick" type\x3d"button"\x3e${_i18n.widgets.multidimensionalFilter.nextButtonTooltip}\x3c/button\x3e\r\n  \x3cbutton data-dojo-type\x3d"dijit/form/Button" data-dojo-props\x3d"iconClass:\'tsButton tsEndButton\', showLabel: false" data-dojo-attach-point\x3d"EndBtn" data-dojo-attach-event\x3d"onClick:_onEndBtnClick" type\x3d"button"\x3e${_i18n.widgets.multidimensionalFilter.endNumberButtonTooltip}\x3c/button\x3e\r\n\x3c/div\x3e'}});
define("esri/dijit/MultidimensionalFilter","dojo/_base/declare dojo/_base/lang dojo/_base/connect dojo/i18n!../nls/jsapi dojo/text!./templates/MultidimensionalFilter.html dojo/text!./templates/NumericDimensionItem.html dojo/text!./templates/TimeDimensionItem.html dojo/text!./templates/PagedDateTimeWidget.html dojo/text!./templates/PagedNumberWidget.html dojo/store/Memory dojo/has ../kernel dijit/_WidgetBase dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dijit/form/DateTextBox dijit/registry dojo/date/locale dojo/dom-style dojo/dom-class ../layers/DimensionalDefinition ../layers/MosaicRule dojo/html dijit/form/FilteringSelect dijit/form/ComboBox dojox/widget/YearlyCalendar dojox/widget/MonthlyCalendar dojox/widget/Calendar3Pane dojo/_base/array ./_EventedWidget dijit/Tooltip dijit/form/CheckBox dijit/form/Button".split(" "),
function(p,q,t,u,v,H,I,w,J,r,K,L,A,B,C,M,N,n,O,l,P,D,m,Q,R,E,F,x,k){var G=p("PagedDimensionWidgetMixin",[A,B,C],{pageCount:100,displayValue:"",dimension:"",_currentIndex:"",values:"",constructor:function(a){p.safeMixin(this,a);this._i18n=u},_checkButtons:function(){var a=this.values,b=this._currentIndex;1===a.length?this._setButtonProperties(!0,!0,!0,!0):0===b?this._setButtonProperties(!0,!0,!1,!1):b===a.length-1?this._setButtonProperties(!1,!1,!0,!0):this._setButtonProperties(!1,!1,!1,!1)},_setButtonProperties:function(a,
b,d,c){this.StartBtn.set("disabled",a);this.PreviousBtn.set("disabled",b);this.NextBtn.set("disabled",d);this.EndBtn.set("disabled",c)},_onStartBtnClick:function(){this._currentIndex=0;this._updateValues()},_onPreviousBtnClick:function(){this._currentIndex--;this._updateValues()},_onNextBtnClick:function(){this._currentIndex++;this._updateValues()},_onEndBtnClick:function(){this._currentIndex=this.values.length-1;this._updateValues()}}),y=p("PagedDateTimeWidget",[G],{dateValue:"",intervalInfo:{},
_fullDateFormat:"yyyy-MM-dd",templateString:w,_setValuesAttr:function(a){var b=[];this._set("values",a);this._currentIndex=this.displayValue?k.indexOf(this.values,this.displayValue):0;this.displayValue&&this._set("dateValue",this.displayValue);this._checkButtons();this.dateSelect?(k.forEach(this.values,function(a){b.push({id:a,label:a})},this),a=new r({data:b}),this.dateSelect.set({store:a,value:this.displayValue||this.values[0]}),this.dateSelect.startup()):this._populateValues()},_setDateValueAttr:function(a){a&&
(this._currentIndex=k.indexOf(this.values,a),-1!==this._currentIndex?(this._set("dateValue",a),this._set("displayValue",a)):(this._set("dateValue",this._snapToClosest(a)),this._set("displayValue",this._snapToClosest(a)),this._currentIndex=k.indexOf(this.values,this.dateValue)),this._updateValues())},_getTimeArray:function(){var a=[],b=this.values,d=this._currentIndex,c,h,f;h=b[d]-Math.abs(b[d]%864E5);f=h+864E5;for(d=0;d<b.length;d++)if(b[d]>=h&&b[d]<f)c=n.format(this._getUTCTime(new Date(b[d])),{timePattern:"hh:mm a",
selector:"time"}),a.push({id:b[d],label:c});else if(0!==a.length)break;return a},_updateTimeDropDown:function(){var a=[],a=this._getTimeArray();this.timeSelect.reset();a=new r({data:a});this.timeSelect.set({store:a,value:this.values[this._currentIndex]})},_populateValues:function(){var a=[],b=this.values,d,c;c=n.format(this._getUTCTime(new Date(b[this._currentIndex])),{datePattern:this._fullDateFormat,selector:"date"});a=this._getTimeArray();d=n.format(this._getUTCTime(new Date(b[0])),{datePattern:this._fullDateFormat,
selector:"date"});b=n.format(this._getUTCTime(new Date(b[b.length-1])),{datePattern:this._fullDateFormat,selector:"date"});this.dateSelect=new M({value:c,constraints:{min:d,max:b},popupClass:x,style:"width:95px;","class":"dijitSelect esriMultidimensionalFilterVariableList"},this.DateSelector);this.dateSelect.startup();this.dateSelect.on("change",q.hitch(this,this._dateBoxChange));a=new r({data:a});this.timeSelect=new Q({store:a,value:this.displayValue,labelAttr:"label",labelType:"text",searchAttr:"label",
style:"width:85px;","class":"dijitSelect esriMultidimensionalFilterVariableList",maxHeight:-1},this.TimeSelector);this.timeSelect.startup();this.timeSelect.on("change",q.hitch(this,this._timeValueChange));this._checkCalendarControlView()},_checkCalendarControlView:function(){var a=[],b=[],d=[],c=this.values,h=this.intervalInfo,f,e,g,m;if(h.intervalUnit)"years"==h.intervalUnit.toLowerCase()?(this.dateSelect.set("popupClass",E),l.add(this.timeSelect.domNode,"esriTimeSelectDisplayNone")):"months"==h.intervalUnit.toLowerCase()?
(this.dateSelect.set("popupClass",F),l.add(this.timeSelect.domNode,"esriTimeSelectDisplayNone")):"days"==h.intervalUnit.toLowerCase()?(this.dateSelect.set("popupClass",x),l.add(this.timeSelect.domNode,"esriTimeSelectDisplayNone")):this.dateSelect.set("popupClass",x);else{m=12>c.length?c.length:12;for(g=0;g<m;g++)h=n.format(this._getUTCTime(new Date(c[g])),{datePattern:"yyyy",selector:"date"}),f=n.format(this._getUTCTime(new Date(c[g])),{datePattern:"yyyyMM",selector:"date"}),e=n.format(this._getUTCTime(new Date(c[g])),
{timePattern:"HH:mm",selector:"time"}),-1===k.indexOf(b,h)&&b.push(h),-1===k.indexOf(d,f)&&d.push(f),-1===k.indexOf(a,e)&&a.push(e);b.length===m?(this.dateSelect.set("popupClass",E),l.add(this.timeSelect.domNode,"esriTimeSelectDisplayNone")):d.length===m?(this.dateSelect.set("popupClass",F),l.add(this.timeSelect.domNode,"esriTimeSelectDisplayNone")):(this.dateSelect.set("popupClass",x),1===a.length&&l.add(this.timeSelect.domNode,"esriTimeSelectDisplayNone"))}},_timeValueChange:function(a){a&&(this._currentIndex=
k.indexOf(this.values,a),this._set("dateValue",a),this._set("displayValue",a),this._checkButtons())},_updateValues:function(){var a;a=n.format(this._getUTCTime(new Date(this.values[this._currentIndex])),{datePattern:this._fullDateFormat,selector:"date"});this.dateSelect.set("_onChangeActive",!1);this.dateSelect.set("value",a,!1);this.dateSelect.set("_onChangeActive",!0);this._updateTimeDropDown();this._checkButtons()},_getUTCTime:function(a){a&&a.setTime(a.getTime()+6E4*a.getTimezoneOffset());return a},
_snapToClosest:function(a){var b=0,d=0,c=this.values,h,f,e,g;a=new Date(a);a=a.getTime()-6E4*a.getTimezoneOffset();h=Math.abs(a-c[0]);f=Math.abs(a-c[0]);e=c[0];for(g=1;g<c.length;g++)e=c[g]-a,0>e?Math.abs(e)<f&&(f=Math.abs(e),b=g):e<h&&(h=e,d=g);86399999>h||h<f?(e=c[d],this._currentIndex=d):(e=c[b],this._currentIndex=b);return e},_dateBoxChange:function(a){var b=[];a&&(b=(new Date(a)).getTime(),a=this._snapToClosest(parseInt(b,10)),this.dateSelect.set("_onChangeActive",!1),this.dateSelect.set("value",
n.format(this._getUTCTime(new Date(a)),{datePattern:this._fullDateFormat,selector:"date"})),this.dateSelect.set("_onChangeActive",!0),n.format(this._getUTCTime(new Date(a)),{datePattern:this._fullDateFormat,selector:"date"})!=n.format(new Date(b),{datePattern:this._fullDateFormat,selector:"date"})&&(this.dateSelect.focus(),this.dateSelect.set("message",this._i18n.widgets.multidimensionalFilter.dateSnapText)),b=this._getTimeArray(),this.timeSelect.reset(),a=new r({data:b}),this.timeSelect.set({store:a,
value:b[0].id}),this._checkButtons())}}),z=p("PagedNumberWidget",[G],{numValue:"",templateString:J,_setValuesAttr:function(a){var b=[];this._set("values",a);this.displayValue||0===this.displayValue?(this._currentIndex=k.indexOf(this.values,this.displayValue),this._set("numValue",this.displayValue)):this._currentIndex=0;this._checkButtons();this.numSelect?(k.forEach(this.values,function(a){b.push({id:a,label:a})},this),a=new r({data:b}),this._currentIndex=this.displayValue?k.indexOf(this.values,this.displayValue):
0,this.numSelect.set({store:a,value:this.displayValue||this.values[0]}),this.numSelect.startup()):this._populateValues()},_setNumValueAttr:function(a){if(a||0===a)this._currentIndex=k.indexOf(this.values,a),-1!==this._currentIndex?(this._set("numValue",a),this._set("displayValue",a)):(this._set("numValue",this._snapToClosest(a)),this._set("displayValue",this._snapToClosest(a)),this._currentIndex=k.indexOf(this.values,this.numValue)),this._updateValues()},_populateValues:function(){var a=[],b;k.forEach(this.values,
function(b){a.push({id:b,label:b})},this);b=new r({data:a});this.numSelect=new R({store:b,value:this.displayValue,labelAttr:"label",labelType:"text",searchAttr:"label",pageSize:this.pageCount,scrollOnFocus:!0,style:"width:95px;","class":"dijitSelect esriMultidimensionalFilterVariableList",maxHeight:-1},this.NumberSelector);this.numSelect.startup();this.numSelect.on("change",q.hitch(this,this._numValueChange))},_snapToClosest:function(a){var b=this.values,d,c,h,f;d=Math.abs(a-b[0]);h=b[0];for(f=1;f<
b.length;f++)c=Math.abs(a-b[f]),c<d&&(d=c,h=b[f],this._currentIndex=f);return h},_numValueChange:function(a){var b;a&&(b=this._snapToClosest(a),this.numSelect.set("_onChangeActive",!1),this.numSelect.set("value",b),this.numSelect.set("_onChangeActive",!0),a!=b&&(this.numSelect.focus(),this.numSelect.set("message",this._i18n.widgets.multidimensionalFilter.numSnapText)),this._currentIndex=k.indexOf(this.values,b),this._set("numValue",b),this._set("displayValue",b),this._checkButtons())},_updateValues:function(){this.numSelect.set("value",
this.values[this._currentIndex]);this._checkButtons()}});w=p("DimensionItemMixin",[A,B,C],{dimension:"",fromText:"",toText:"",valueCount:"",values:[],dimensionAlias:"",unit:"",disabled:!1,intervalInfo:{},_unitString:"",_unitReplaceString:"",_disabledDimensionText:"",_valueFieldString:"",_selectWidgetNameString:"",_onDimensionCheckboxChange:function(a){this.hasRanges?a?(l.replace(this.maxRow,"esriRowShow","esriDomHide"),l.replace(this.minRow,"esriRowShow","esriDomHide"),l.replace(this.rangeSpan,"esriInlineShow",
"esriDomHide")):(l.replace(this.maxRow,"esriDomHide","esriRowShow"),l.replace(this.minRow,"esriDomHide","esriRowShow"),l.replace(this.rangeSpan,"esriDomHide","esriInlineShow")):a?(this.rangeCheckbox.get("checked")?l.replace(this.maxRow,"esriRowShow","esriDomHide"):l.replace(this.maxRow,"esriDomHide","esriRowShow"),l.replace(this.minRow,"esriRowShow","esriDomHide"),l.replace(this.rangeSpan,"esriInlineShow","esriDomHide")):(l.replace(this.maxRow,"esriDomHide","esriRowShow"),l.replace(this.minRow,"esriDomHide",
"esriRowShow"),l.replace(this.rangeSpan,"esriDomHide","esriInlineShow"))},_setDisabledAttr:function(a){this._set("disabled",a);a?(this.dimensionCheckbox.set("checked",!1),this.dimensionCheckbox.set("disabled",!0),l.replace(this.dimensionAlias,"esriDisabled","esriEnabled"),l.replace(this.dimensionUnit,"esriDisabled","esriEnabled"),m.set(this.disabledDimText,"\x3cbr/\x3e"+this._disabledDimensionText)):(this.dimensionCheckbox.set("checked",!0),this.dimensionCheckbox.set("disabled",!1),l.replace(this.dimensionAlias,
"esriEnabled","esriDisabled"),l.replace(this.dimensionUnit,"esriEnabled","esriDisabled"),m.set(this.disabledDimText,""))},_createNewValues:function(){var a=[],b=[],d={};k.forEach(this.values,function(c){-1===k.indexOf(a,c[0])&&a.push(c[0]);-1===k.indexOf(a,c[1])&&a.push(c[1]);-1===k.indexOf(b,c[0])&&(b.push(c[0]),d[c[0]]=[]);d[c[0]].push(c[1])},this);a.sort(function(a,b){return a-b});this._distinctRangeValues=a;this._rangeStartArray=b;this._rangeEndArrayMap=d},_setUnitAttr:function(a){a&&(-1<a.indexOf(this._unitString)&&
(this.unit=a.replace(this._unitString,this._unitReplaceString)),m.set(this.dimensionUnit,"("+this.unit+")"),m.set(this.tooltipUnit,"\x3cbr/\x3e   \x3cspan class\x3d'esriMultidimensionalFilterTooltipLeftText'\x3eUnit:\x3c/span\x3e "+this.unit))},_refreshMaxBox:function(a){this.rangeCheckbox.get("checked")||this.maxBox.set({displayValue:this._rangeEndArrayMap[a][0],values:this._rangeEndArrayMap[a]})},getDimensionCheckboxValue:function(){return this.dimensionCheckbox.get("checked")},setDimensionCheckboxValue:function(a){this.dimensionCheckbox.set("checked",
a)},getRangeCheckboxValue:function(){return this.rangeCheckbox.get("value")},setRangeCheckboxValue:function(a){this.rangeCheckbox.set("value",a)},getMinValue:function(){return this.minBox.get(this._valueFieldString)},setMinValue:function(a){this.minBox.set(this._valueFieldString,a)},getMaxValue:function(){return this.maxBox.get(this._valueFieldString)},setMaxValue:function(a){this.maxBox.set(this._valueFieldString,a)},isMinBoxSupportedValue:function(a){return this.minBox[this._selectWidgetNameString].isValid(a)?
!0:!1},isMaxBoxSupportedValue:function(a){return this.maxBox[this._selectWidgetNameString].isValid(a)?!0:!1}});var S=p("DateItem",[w],{fromDateValue:"",toDateValue:"",_unitString:"ISO8601",_unitReplaceString:"UTC",_valueFieldString:"dateValue",_selectWidgetNameString:"timeSelect",templateString:I,constructor:function(a){p.safeMixin(this,a);this._i18n=u;this.fromText=this._i18n.widgets.multidimensionalFilter.fromTimeText;this.toText=this._i18n.widgets.multidimensionalFilter.toTimeText;this._disabledDimensionText=
this._i18n.widgets.multidimensionalFilter.disabledTimeDimensionText},_onRangeCheckboxChange:function(a){if(this.hasRanges){var b=this.minBox.dateSelect.value;a?(l.replace(this.hasRangesInfo,"esriRangeInfoHide","esriRangeInfoVisible"),this.minBox.set({displayValue:b,values:this._distinctRangeValues}),this.maxBox.set({displayValue:this._distinctRangeValues[this._distinctRangeValues.length-1],values:this._distinctRangeValues})):(l.replace(this.hasRangesInfo,"esriRangeInfoVisible","esriRangeInfoHide"),
-1<k.indexOf(this._rangeStartArray,b)&&(this.minBox.set({displayValue:b,values:this._rangeStartArray}),this.maxBox.set({displayValue:this._rangeEndArrayMap[b][0],values:this._rangeEndArrayMap[b]})))}else a?(l.replace(this.maxRow,"esriRowShow","esriDomHide"),m.set(this.minDateText,this._i18n.widgets.multidimensionalFilter.fromTimeText)):(l.replace(this.maxRow,"esriDomHide","esriRowShow"),m.set(this.minDateText,this._i18n.widgets.multidimensionalFilter.sliceTimeText));this.emit("range-rendered",{})},
_updateTooltip:function(){var a=this.values,b=this._distinctRangeValues;this.hasRanges?(this.fromValue=n.format(this._getUTCTime(new Date(b[0])),{datePattern:"MM/dd/yyyy",timePattern:"hh:mm:ss a"}),this.toValue=n.format(this._getUTCTime(new Date(b[b.length-1])),{datePattern:"MM/dd/yyyy",timePattern:"hh:mm:ss a"})):(this.fromValue=n.format(this._getUTCTime(new Date(a[0])),{datePattern:"MM/dd/yyyy",timePattern:"hh:mm:ss a"}),this.toValue=n.format(this._getUTCTime(new Date(a[a.length-1])),{datePattern:"MM/dd/yyyy",
timePattern:"hh:mm:ss a"}));this.valueCount=a.length;m.set(this.tooltipFromValue,this.fromValue.toString());m.set(this.tooltipToValue,this.toValue.toString());m.set(this.tooltipValueCount,this.valueCount.toString())},_setValuesAttr:function(a){this.values=a;this.hasRanges?(this._createNewValues(),a=this._distinctRangeValues,this._updateTooltip(),this._set("values",this._distinctRangeValues),this.minBox=new y({values:this._rangeStartArray,dimension:this.dimension,displayValue:this._rangeStartArray[0],
intervalInfo:this.intervalInfo},this.minDateSelector),this.minBox.startup(),this.minBox.dateSelect.on("change",q.hitch(this,this._refreshMaxBox)),this.maxBox=new y({values:this._rangeEndArrayMap[this._rangeStartArray[0]],dimension:this.dimension,displayValue:this._rangeEndArrayMap[this._rangeStartArray[0]][this._rangeEndArrayMap[this._rangeStartArray[0]].length-1],intervalInfo:this.intervalInfo},this.maxDateSelector),this.maxBox.startup(),m.set(this.minDateText,this._i18n.widgets.multidimensionalFilter.fromTimeText),
l.replace(this.maxRow,"esriRowShow","esriDomHide"),l.replace(this.hasRangesInfo,"esriRangeInfoVisible","esriRangeInfoHide")):(this._set("values",a),this._updateTooltip(),this.minBox=new y({values:a,dimension:this.dimension,displayValue:a[0],intervalInfo:this.intervalInfo},this.minDateSelector),this.minBox.startup(),this.maxBox=new y({values:a,dimension:this.dimension,displayValue:a[a.length-1],intervalInfo:this.intervalInfo},this.maxDateSelector),this.maxBox.startup())},_getUTCTime:function(a){a&&
a.setTime(a.getTime()+6E4*a.getTimezoneOffset());return a}}),T=p("NumericItem",[w],{_unitString:"esri",_unitReplaceString:"",_valueFieldString:"numValue",_selectWidgetNameString:"numSelect",templateString:H,constructor:function(a){p.safeMixin(this,a);this._i18n=u;this.fromText=this._i18n.widgets.multidimensionalFilter.fromNumericText;this.toText=this._i18n.widgets.multidimensionalFilter.toNumericText;this._disabledDimensionText=this._i18n.widgets.multidimensionalFilter.disabledNumericDimensionText},
_onRangeCheckboxChange:function(a){if(this.hasRanges){var b=this.minBox.numSelect.value;a?(l.replace(this.hasRangesInfo,"esriRangeInfoHide","esriRangeInfoVisible"),this.minBox.set({displayValue:b,values:this._distinctRangeValues}),this.maxBox.set({displayValue:this._distinctRangeValues[this._distinctRangeValues.length-1],values:this._distinctRangeValues})):(l.replace(this.hasRangesInfo,"esriRangeInfoVisible","esriRangeInfoHide"),-1<k.indexOf(this._rangeStartArray,b)&&(this.minBox.set({displayValue:b,
values:this._rangeStartArray}),this.maxBox.set({displayValue:this._rangeEndArrayMap[b][0],values:this._rangeEndArrayMap[b]})));this.emit("range-rendered",{})}else a?(l.replace(this.maxRow,"esriRowShow","esriDomHide"),m.set(this.minValueText,this._i18n.widgets.multidimensionalFilter.fromNumericText)):(l.replace(this.maxRow,"esriDomHide","esriRowShow"),m.set(this.minValueText,this._i18n.widgets.multidimensionalFilter.sliceNumberText))},_updateTooltip:function(){var a=this.values,b=this._distinctRangeValues;
this.hasRanges?(this.fromValue=b[0],this.toValue=b[b.length-1]):(this.fromValue=a[0],this.toValue=a[a.length-1]);this.valueCount=a.length;m.set(this.tooltipFromValue,this.fromValue.toString());m.set(this.tooltipToValue,this.toValue.toString());m.set(this.tooltipValueCount,this.valueCount.toString())},_setValuesAttr:function(a){this.values=a;this.hasRanges?(this._createNewValues(),a=this._distinctRangeValues,this._updateTooltip(),this._set("values",this._distinctRangeValues),this.minBox=new z({values:this._rangeStartArray,
dimension:this.dimension,displayValue:this._rangeStartArray[0],intervalInfo:this.intervalInfo},this.minNumberSelector),this.minBox.startup(),this.minBox.numSelect.on("change",q.hitch(this,this._refreshMaxBox)),this.maxBox=new z({values:this._rangeEndArrayMap[this._rangeStartArray[0]],dimension:this.dimension,displayValue:this._rangeEndArrayMap[this._rangeStartArray[0]][this._rangeEndArrayMap[this._rangeStartArray[0]].length-1],intervalInfo:this.intervalInfo},this.maxNumberSelector),this.maxBox.startup(),
m.set(this.minValueText,this._i18n.widgets.multidimensionalFilter.fromNumericText),l.replace(this.maxRow,"esriRowShow","esriDomHide"),l.replace(this.hasRangesInfo,"esriRangeInfoVisible","esriRangeInfoHide")):(this._set("values",a),this._updateTooltip(),this.minBox=new z({values:a,dimension:this.dimension,displayValue:a[0],intervalInfo:this.intervalInfo},this.minNumberSelector),this.minBox.startup(),this.maxBox=new z({values:a,dimension:this.dimension,displayValue:a[a.length-1],intervalInfo:this.intervalInfo},
this.maxNumberSelector),this.maxBox.startup())}});v=p([A,B,C],{declaredClass:"esri.dijit.MultidimensionalFilter",templateString:v,widgetsInTemplate:!0,layer:null,map:null,hideApplyButton:!1,_multidimensionalInfo:null,_variableStore:null,_variableData:[],_dimensionStore:null,_savedMultidimensionalDefinition:null,_dimensionWithRanges:[],_dimensionWidgets:{},reset:0,constructor:function(a){p.safeMixin(this,a);this._i18n=u},startup:function(){this.inherited(arguments);t.subscribe("onMultidimensionalFilterApply",
q.hitch(this,"_onClickApplyMultidimensionalFilter"));t.subscribe("onMultidimensionalFilterReset",q.hitch(this,"_onClickResetMultidimensionalFilter"))},postCreate:function(){t.connect(this.variableList,"onChange",q.hitch(this,"_onVariableListChange"));this.hideApplyButton&&O.set(this.applyButton.domNode,"display","none")},destroy:function(){this.inherited(arguments)},_setLayerAttr:function(a){if(a){this.inherited(arguments);this._dimensionStore=this._cachedDimensions=null;this._set("layer",a);var b=
q.hitch(this,"_setupDefaults");this.layer.loaded?this._setupDefaults():t.connect(this.layer,"onLoad",b)}},_setupDefaults:function(){this.layer.getMultidimensionalInfo().then(q.hitch(this,function(a){this._multidimensionalInfo=a;this._setupVariableFilterDefaults()}),function(a){console.log(a)});this.layer.getDefaultMultidimensionalDefinition().then(q.hitch(this,function(a){this.defaultMultidimensionalDefinition=a}),function(a){console.log(a)})},_computeDimensionUnion:function(a){var b=[],d=[],c=[],
h,f,e,g,l,m,n,p;if(a){for(h=0;h<a.length;h++)for(l=a[h].dimensions,f=0;f<l.length;f++){m=l[f];for(e=g=0;e<b.length;e++)if(m.name==b[e].name){n=b[e].values;p=m.values;if(m.hasRanges){for(g=0;g<n.length;g++)d.push(n[g][0]),c.push(n[g][1]);for(g=0;g<p.length;g++)-1!==k.indexOf(d,p[g][0])&&-1!==k.indexOf(c,p[g][1])||n.push(p[g])}else for(g=0;g<p.length;g++)-1===k.indexOf(n,p[g])&&n.push(p[g]);g=1}g||b.push(q.clone(m));m.hasRanges&&-1===k.indexOf(this._dimensionWithRanges,m.name)&&this._dimensionWithRanges.push(m.name)}0<
this._dimensionWithRanges.length&&(b=this._convertSliceToRange(this._dimensionWithRanges,b));return this._sortDimensionValues(b)}},_sortDimensionValues:function(a){k.forEach(a,function(a){a&&a.values&&(a.values=a.hasRanges?this._sortRangeDimensionValues(a.values):this._sortNoRangeDimensionValues(a.values))},this);return a},_sortRangeDimensionValues:function(a){var b=[],d=[],c={},h={},f=[],e;k.forEach(a,function(a){-1===k.indexOf(b,a[0])&&(b.push(a[0]),c[a[0]]=[]);c[a[0]].push(a)},this);b=b.sort(function(a,
b){return a-b});k.forEach(b,function(a){if(1===c[a].length)f.push(c[a][0]);else{d=[];h={};for(e=0;e<c[a].length;e++)d.push(c[a][e][1]),h[c[a][e][1]]=c[a][e];d=d.sort(function(a,b){return a-b});for(e=0;e<d.length;e++)f.push(h[d[e]])}});return f},_sortNoRangeDimensionValues:function(a){return a.sort(function(a,d){return a-d})},_convertSliceToRange:function(a,b){var d=[];k.forEach(b,function(b){-1!==k.indexOf(a,b.name)&&(b.hasRanges=!0,d=[],k.forEach(b.values,function(a){a instanceof Array?(d.push(a),
b.extent[0]>a[0]?b.extent[0]=a[0]:b.extent[1]<a[0]&&(b.extent[1]=a[0]),b.extent[0]>a[1]?b.extent[0]=a[1]:b.extent[1]<a[1]&&(b.extent[1]=a[1])):(d.push([a,a]),b.extent[0]>a?b.extent[0]=a:b.extent[1]<a&&(b.extent[1]=a))},this),b.values=d)},this);return b},_setupVariableFilterDefaults:function(){var a=this._multidimensionalInfo.variables,b=this.layer.mosaicRule,d;this.layer&&this._multidimensionalInfo&&a&&(this._variableData=[],this._variableData.push({name:this._i18n.widgets.multidimensionalFilter.defaultVariableText,
label:"\x3chtml\x3e\x3cbody\x3e\x3csection\x3e\x3ctable\x3e\x3ctr\x3e\x3ctd\x3e\x3cb\x3e"+this._i18n.widgets.multidimensionalFilter.defaultVariableText+"\x3c/b\x3e\x3c/td\x3e\x3c/tr\x3e\x3ctr\x3e\x3ctd\x3e\x3cp style\x3d'white-space:pre-wrap;width:50ex'\x3e\x3ci\x3eNo user-defined restriction on Variable.\x3c/i\x3e\x3c/p\x3e\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3c/section\x3e\x3c/body\x3e\x3c/html",dimensions:this._computeDimensionUnion(a)}),k.forEach(a,function(a){d=a.unit?a.name+" ("+a.unit+")":
a.name;this._variableData.push({name:a.name,dimensions:a.dimensions,description:a.description,label:"\x3chtml\x3e\x3cbody\x3e\x3csection\x3e\x3ctable\x3e\x3ctr\x3e\x3ctd\x3e\x3cb\x3e"+d+"\x3c/b\x3e\x3c/td\x3e\x3c/tr\x3e\x3ctr\x3e\x3ctd\x3e\x3cp style\x3d'white-space:pre-wrap;width:50ex'\x3e\x3ci\x3e"+a.description+"\x3c/i\x3e\x3c/p\x3e\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3c/section\x3e\x3c/body\x3e\x3c/html\x3e"})},this),this._variableStore=new r({data:this._variableData,idProperty:"name"}),this.variableList.reset(),
this.variableList.set({store:this._variableStore,labelAttr:"label",labelType:"html",value:this._variableData[0].name}),this._savedMultidimensionalDefinition=null,b&&b.multidimensionalDefinition&&0<b.multidimensionalDefinition.length&&(this._savedMultidimensionalDefinition=b.multidimensionalDefinition,this._setVariableValueDefault()))},_setVariableValueDefault:function(){var a=this._savedMultidimensionalDefinition[0];a.variableName&&(a=""==a.variableName?this._i18n.widgets.multidimensionalFilter.defaultVariableText:
a.variableName,this.variableList&&this.reset&&1===this.reset?a!=this.variableList.get("value")?this.variableList.set("value",a):this._onVariableListChange():this.variableList.set("value",a))},_setCachedDimensionProperties:function(){var a,b;for(a in this._cachedDimensions)this._cachedDimensions.hasOwnProperty(a)&&(b=a,this._dimensionWidgets[b]&&(b=this._dimensionWidgets[b],this._cachedDimensions[a].selected=b.getDimensionCheckboxValue(),this._cachedDimensions[a].isSlice=!b.getRangeCheckboxValue(),
this._cachedDimensions[a].values=[Number(b.getMinValue()),Number(b.getMaxValue())]))},_onVariableListChange:function(){var a=this.variableList.get("value"),b=this._variableStore.query({name:a})[0].dimensions,d=this._variableData[0],c=this._savedMultidimensionalDefinition;!this._cachedDimensions&&this._dimensionStore&&(this._cachedDimensions={},k.forEach(d.dimensions,function(a){this._cachedDimensions[a.field]={}},this));this._cachedDimensions&&this._setCachedDimensionProperties();this._dimensionStore=
null;this._dimensionStore=new r({data:b,idProperty:"name"});this._createDimensionWidgets();this._cachedDimensions?this._displayCachedProperties():c&&0<c.length&&(b=""==c[0].variableName?this._i18n.widgets.multidimensionalFilter.defaultVariableText:c[0].variableName,a==b&&this._setDimensionDefaults())},_createDimensionWidgets:function(){var a,b,d,c,h,f;this._destroyDimensionWidgets();k.forEach(this._dimensionStore.data,function(e){a=e.field;c={hasRegularIntervals:e.hasRegularIntervals,interval:e.interval,
intervalUnit:e.intervalUnit};f=e.hasRanges||!1;"StdTime"==a?(b=new S({dimension:e.name,hasRanges:f,dimensionAlias:this._returnFieldAlias(e.name),unit:e.unit,disabled:this.layer.useMapTime,intervalInfo:c,values:e.values}),b.placeAt(this.dimensionFilterGrid),this._dimensionWidgets[e.name]=b):"StdTime"!=a&&(h=this._isActiveDimension(e.name),d=new T({dimension:e.name,hasRanges:f,dimensionAlias:this._returnFieldAlias(e.name),unit:e.unit,disabled:h,intervalInfo:c,values:e.values}),d.placeAt(this.dimensionFilterGrid),
this._dimensionWidgets[e.name]=d)},this);this._dimensionWidgets.StdTime.setDimensionCheckboxValue(!1)},_getUTCTime:function(a){a&&a.setTime(a.getTime()+6E4*a.getTimezoneOffset());return a},_destroyDimensionWidgets:function(){var a=N.findWidgets(this.dimensionFilterGrid);k.forEach(a,function(a){a.destroyRecursive()});this._dimensionWidgets={}},_displayCachedProperties:function(){var a=this._cachedDimensions,b,d,c,h,f,e;k.forEach(this._dimensionStore.data,function(g){b=0;for(d in a)if(a.hasOwnProperty(d)&&
d==g.name&&a[d].values){b=1;c=d;h=a[d].isSlice;f=a[d].values;e=a[d].selected;break}b?(-1<c.toLowerCase().indexOf("time")&&!this.layer.useMapTime||-1===c.toLowerCase().indexOf("time")&&!this._isActiveDimension(c))&&this._updateDimensionValues(c,e,h,f[0],f[1]):(c=g.name,(-1===c.toLowerCase().indexOf("time")&&!this._isActiveDimension(c)||-1<c.toLowerCase().indexOf("time")&&!this.layer.useMapTime)&&this._updateDimensionValues(c,!1,!0,g.extent[0],g.extent[1]))},this)},_isActiveDimension:function(a){return this.layer.activeMapDimensions&&
0<this.layer.activeMapDimensions.length&&-1<k.indexOf(this.layer.activeMapDimensions,a)},_setDimensionDefaults:function(){var a=this._savedMultidimensionalDefinition,b=0,d,c,h,f;k.forEach(this._dimensionStore.data,function(e){d=0;k.forEach(a,function(a){a.dimensionName==e.name&&(d=1,c=a.dimensionName,h=a.isSlice,f=a.values[1]?a.values:a.values[0],f.length||(f=[f]),!this._dimensionWidgets[c].isMinBoxSupportedValue(f[0])||2===f.length&&!this._dimensionWidgets[c].isMaxBoxSupportedValue(f[1]))&&(b=1)},
this);if(d){if(-1<c.toLowerCase().indexOf("time")&&!this.layer.useMapTime||-1===c.toLowerCase().indexOf("time")&&!this._isActiveDimension(c))h&&-1==k.indexOf(this._dimensionWithRanges,c)?this._updateDimensionValues(c,!0,h,f[0],e.extent[1]):this._updateDimensionValues(c,!0,h,f[0],f[1])}else c=e.name,(-1===c.toLowerCase().indexOf("time")&&!this._isActiveDimension(c)||-1<c.toLowerCase().indexOf("time")&&!this.layer.useMapTime)&&this._updateDimensionValues(c,!1,!0,e.extent[0],e.extent[1])},this);b&&this._onClickApplyMultidimensionalFilter();
this.reset=0},_updateDimensionValues:function(a,b,d,c,h){var f=this._dimensionWidgets[a],e=null;f.getRangeCheckboxValue()===d&&(e||(e=f.on("range-rendered",function(){f.setMinValue(c);f.setMaxValue(h);e.remove();e=null})),f.setRangeCheckboxValue(!d));f.setMinValue(c);f.setMaxValue(h);f.setDimensionCheckboxValue(b)},_returnFieldAlias:function(a){var b;k.forEach(this.layer.fields,function(d){d.name.toLowerCase()==a.toLowerCase()&&(b=d.alias)},this);return b||a},_onClickApplyMultidimensionalFilter:function(){var a=
this._dimensionWidgets,b=this.layer.mosaicRule,d=b&&b.multidimensionalDefinition,c,h=[],f,e,g,l,m;for(c in a)a.hasOwnProperty(c)&&a[c].getDimensionCheckboxValue()&&h.push(c);f=[];e=this.variableList.get("value")==this._i18n.widgets.multidimensionalFilter.defaultVariableText?"":this.variableList.get("value");h.length||f.push({variableName:e});k.forEach(h,function(a){g=a;m=this._dimensionWidgets[g];l=m.getRangeCheckboxValue()?[[Number(m.getMinValue()),Number(m.getMaxValue())]]:-1<k.indexOf(this._dimensionWithRanges,
g)&&""==e||m.hasRanges&&""!=e?[[Number(m.getMinValue()),Number(m.getMaxValue())]]:[Number(m.getMinValue())];(-1===g.toLowerCase().indexOf("time")&&!this._isActiveDimension(g)||-1<g.toLowerCase().indexOf("time")&&!this.layer.useMapTime)&&f.push(new P({variableName:e,dimensionName:g,isSlice:!m.getRangeCheckboxValue(),values:l}))},this);d&&k.forEach(d,function(a){g=a.dimensionName;a.variableName=e;g&&-1===g.toLowerCase().indexOf("time")&&this._isActiveDimension(g)&&f.push(a)},this);b?(a=b,a.multidimensionalDefinition=
f):this.layer.defaultMosaicRule?(a=this.layer.defaultMosaicRule,a.multidimensionalDefinition=f):a=new D({multidimensionalDefinition:[]});this.layer.setMosaicRule(a)},_onClickResetMultidimensionalFilter:function(){var a=this.layer.mosaicRule,b=[],d;this.defaultMultidimensionalDefinition&&0===this.reset&&(this.reset=1,this._cachedDimensions=null,k.forEach(this.defaultMultidimensionalDefinition,function(a){d=a.dimensionName;(-1===d.toLowerCase().indexOf("time")&&!this._isActiveDimension(d)||-1<d.toLowerCase().indexOf("time")&&
!this.layer.useMapTime)&&b.push(a)},this),a&&a.multidimensionalDefinition&&k.forEach(a.multidimensionalDefinition,function(a){d=a.dimensionName;-1===d.toLowerCase().indexOf("time")&&this._isActiveDimension(d)&&b.push(a)},this),0===b.length&&(b=this.defaultMultidimensionalDefinition),a?a.multidimensionalDefinition=b:this.layer.defaultMosaicRule?(a=this.layer.defaultMosaicRule,a.multidimensionalDefinition=b):a=new D({multidimensionalDefinition:[]}),this.layer.setMosaicRule(a),this._savedMultidimensionalDefinition=
b)&&(this._dimensionStore=null,this._setVariableValueDefault())}});K("extend-esri")&&q.setObject("dijit.MultidimensionalFilter",v,L);return v});