// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://@sbaseurl@/jsapi/jsapi/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.

//>>built
require({cache:{"url:widgets/GroupFilter/setting/presetValuePicker.html":'\x3cdiv\x3e\r\n\t\x3cdiv\x3e\x3ch3\x3e${nls.picker.description}\x3c/h3\x3e\x3c/div\x3e\r\n\t\x3cbr\x3e\r\n\t\x3ctable width\x3d"100%" cellpadding\x3d"2" cellspacing\x3d"2"\x3e\r\n\t\t\x3ctr\x3e\r\n\t\t\t\x3ctd class\x3d"picker-cell"\x3e\r\n\t\t\t\t${nls.picker.layer}\x3cbr\x3e\r\n\t\t\t\t\x3cdiv class\x3d"" data-dojo-attach-point\x3d"layerLevel"\x3e\x3c/div\x3e\r\n\t\t\t\x3c/td\x3e\r\n\t\t\x3c/tr\x3e\r\n\t\t\x3ctr\x3e\r\n\t\t\t\x3ctd class\x3d"picker-cell"\x3e\r\n\t\t\t\t${nls.picker.field}\x3cbr\x3e\r\n\t\t\t\t\x3cdiv class\x3d"" data-dojo-attach-point\x3d"fieldLevel"\x3e\x3c/div\x3e\r\n\t\t\t\x3c/td\x3e\r\n\t\t\x3c/tr\x3e\r\n\t\t\x3ctr\x3e\r\n\t\t\t\x3ctd class\x3d"picker-cell"\x3e\r\n\t\t\t\t${nls.picker.value}\x3cbr\x3e\r\n\t\t\t\t\x3cdiv class\x3d"value-level" data-dojo-attach-point\x3d"valueLevel"\x3e\x3c/div\x3e\r\n\t\t\t\x3c/td\x3e\r\n\t\t\x3c/tr\x3e\r\n\t\x3c/table\x3e\r\n\x3c/div\x3e'}});
define("dojo/_base/declare jimu/BaseWidgetSetting jimu/dijit/FilterParameters dijit/_WidgetsInTemplateMixin dojo/on dojo/dom-construct dojo/dom-attr dojo/query dojo/_base/lang dojo/_base/array dijit/form/Select esri/layers/FeatureLayer dojo/text!./presetValuePicker.html".split(" "),function(r,t,u,v,m,p,n,l,g,h,q,w,x){return r([t,v],{baseClass:"jimu-widget-map-filter-preset",templateString:x,layerList:null,map:null,nls:null,valueParam:null,postCreate:function(){this.inherited(arguments);this.startup()},
startup:function(){this.inherited(arguments);this.createLayerSelection()},createLayerSelection:function(){var c=[];h.forEach(this.layerList,g.hitch(this,function(b){if(0<b.children.length)h.forEach(b.children,g.hitch(this,function(d){var e={};e.value=d.id;e.label=d.label;e.selected=!1;c.push(e)}));else{var a={};a.value=b.id;a.label=b.label;a.selected=!1;c.push(a)}}));var f=(new q({options:c})).placeAt(this.layerLevel);f.startup();this.own(m(f,"change",g.hitch(this,function(b){this.createFieldSelection(b)})));
this.createFieldSelection(f.value)},createFieldSelection:function(c){var f=[];h.forEach(this.layerList,g.hitch(this,function(a){0<a.children.length?h.forEach(a.children,g.hitch(this,function(d){d.id===c&&h.forEach(d.children,g.hitch(this,function(e){if(-1==="esriFieldTypeBlob,esriFieldTypeOID".indexOf(e.fieldType)){var k={};k.value=e.name;k.label=e.label;k.selected=!1;f.push(k)}}))})):a.id===c&&h.forEach(a.layer.fields,g.hitch(this,function(d){if(-1==="esriFieldTypeBlob,esriFieldTypeOID".indexOf(d.type)){var e=
{};e.value=d.name;e.label=""===d.alias?d.name:d.alias;e.selected=!1;f.push(e)}}))}));p.empty(this.fieldLevel);var b=(new q({options:f})).placeAt(this.fieldLevel);b.startup();this.own(m(b,"change",g.hitch(this,function(a){this.createValueList(a,c)})));this.createValueList(b.value,c)},createValueList:function(c,f){p.empty(this.valueLevel);this.valueParam=new u;this.valueParam.placeAt(this.valueLevel);this.valueParam.startup();setTimeout(function(){var b=l(".jimu-single-filter-parameter");b=l("colgroup",
b[0]);0<b.length&&n.set(b[0].childNodes[1],"width","0px")},200);h.forEach(this.layerList,g.hitch(this,function(b){0<b.children.length?h.forEach(b.children,g.hitch(this,function(a){a.id===f&&h.forEach(a.children,g.hitch(this,function(d){if("Shape"!==d.name&&d.name===c){var e=new w(a.url);this.own(m(e,"load",g.hitch(this,function(){var k=this._makefilterObject({name:d.name,label:d.label,type:d.fieldType});this.valueParam.build(a.url,e,k);k=l(".jimu-single-filter-parameter");k=l("colgroup",k[0]);n.set(k[0].childNodes[1],
"width","0px")})))}}))})):b.id===f&&h.forEach(b.layer.fields,g.hitch(this,function(a){a.name===c&&(a=this._makefilterObject({name:a.name,label:a.alias,type:a.type}),this.valueParam.build(b.layer.url,b.layer,a),a=l(".jimu-single-filter-parameter"),a=l("colgroup",a[0]),0<a.length&&n.set(a[0].childNodes[1],"width","0px"))}))}))},_makefilterObject:function(c){var f={},b=[],a={fieldObj:{}};a.fieldObj.name=c.name;a.fieldObj.label="undefined"===typeof c.alias?c.name:c.alias;a.fieldObj.shortType=c.type.replace("esriFieldType",
"").toLowerCase();if("guid"!==a.fieldObj.shortType||"globalid"!==a.fieldObj.shortType)a.fieldObj.shortType="string";"date"!==a.fieldObj.shortType&&"string"!==a.fieldObj.shortType&&(a.fieldObj.shortType="number");a.fieldObj.type=c.type;a.operator=a.fieldObj.shortType+"OperatorIs";a.valueObj={};a.valueObj.isValid=!0;a.valueObj.type="unique";a.valueObj.value="";a.interactiveObj={};a.interactiveObj.prompt="";a.interactiveObj.hint="";a.caseSensitive=!1;b.push(a);f.logicalOperator="OR";f.expr="";f.parts=
b;return f}})});