// 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/LayerList/setting/LayerSelector.html":'\x3cdiv\x3e\r\n  \x3ctable class\x3d"layer-list-table"\x3e\r\n    \x3ctbody class\x3d"layers-list-body" data-dojo-attach-point\x3d"layerListTable"\x3e\x3c/tbody\x3e\r\n    \x3ctbody class\x3d"layers-list-body" data-dojo-attach-point\x3d"tableListTable"\x3e\x3c/tbody\x3e       \r\n  \x3c/table\x3e\r\n\x3c/div\x3e\r\n'}});
define("dijit/_WidgetBase dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/dom-construct dojo/on dojo/query jimu/utils jimu/dijit/CheckBox dijit/_TemplatedMixin dojo/text!./LayerSelector.html dojo/dom-class dojo/dom-style".split(" "),function(q,r,l,p,e,n,t,u,v,w,x,f,m){return r([q,w],{templateString:x,baseClass:"layer-selector",_currentSelectedLayerRowNode:null,_displayStateStorage:null,postMixInProperties:function(){this.inherited(arguments);this._displayStateStorage={}},postCreate:function(){p.forEach(this.operLayerInfos.getLayerInfoArrayOfWebmap(),
function(a){this.drawListNode(a,0,this.layerListTable)},this);p.forEach(this.operLayerInfos.getTableInfoArray(),function(a){this.drawListNode(a,0,this.tableListTable)},this)},drawListNode:function(a,b,c){if(0===a.newSubLayers.length){var d=this.addLayerNode(a,b,c);f.add(t(".showLegend-div",d.currentNode)[0],"hidden")}else d=this.addLayerNode(a,b,c),p.forEach(a.newSubLayers,l.hitch(this,function(h,g){this.drawListNode(g,h+1,d.subNode)},b))},addLayerNode:function(a,b,c){var d=e.create("tr",{"class":"jimu-widget-row layer-row ",
layerTrNodeId:a.id},c),h;var g=e.create("td",{"class":"col col1"},d);for(h=0;h<b;h++)e.create("div",{"class":"begin-blank-div jimu-float-leading",innerHTML:""},g);h=e.create("div",{"class":"showLegend-div jimu-float-leading"},g);var y=e.create("div",{"class":"div-select jimu-float-leading"},g);var k=!0;this.config.layerOptions&&void 0!==this.config.layerOptions[a.id]&&(k=this.config.layerOptions[a.id].display);k=new v({checked:k,"class":"visible-checkbox-"+a.id});e.place(k.domNode,y);m.set(g,"width",
12*b+35+"px");g=e.create("td",{"class":"col col2"},d);b=e.create("div",{"class":"noLegend-div jimu-float-leading"},g);a.isTable&&f.add(b,"table");a.isTable&&m.set(b,"display","block");b="layer-title-div-"+a.id;b=e.create("div",{innerHTML:u.sanitizeHTML(a.title),"class":b+" div-content jimu-float-leading "},g);g=e.create("td",{"class":"col col3"},d);e.create("div",{"class":"layers-list-popupMenu-div"},g);c=e.create("tr",{"class":"",layerContentTrNodeId:a.id},c);c=e.create("td",{"class":"",colspan:"3"},
c);c=e.create("table",{"class":"layer-sub-node"},c);this.initDisplayStateStorage(a,k,b);this.own(n(h,"click",l.hitch(this,this._onRowTrClick,a,h,d,c)));this.own(n(d,"mouseover",l.hitch(this,this._onLayerNodeMouseover,d,void 0)));this.own(n(d,"mouseout",l.hitch(this,this._onLayerNodeMouseout,d,void 0)));this.own(n(k.domNode,"click",l.hitch(this,this._onCkSelectNodeClick,a,k)));return{currentNode:d,subNode:c}},_fold:function(a,b,c){"none"===m.get(c,"display")?(m.set(c,"display","table"),f.add(b,"unfold"),
a=!1):(m.set(c,"display","none"),f.remove(b,"unfold"),a=!0);return a},_onCkSelectNodeClick:function(a,b,c){a.traversal(l.hitch(this,function(d){this._grayedLayerLabel(d)}));c.stopPropagation()},_onLayerNodeMouseover:function(a,b){f.add(a,"layer-row-mouseover");b&&f.add(b.btnNode,"jimu-icon-btn-selected")},_onLayerNodeMouseout:function(a,b){f.remove(a,"layer-row-mouseover");b&&f.remove(b.btnNode,"jimu-icon-btn-selected")},_onRowTrClick:function(a,b,c,d){this._changeSelectedLayerRow(c);this._fold(a,
b,d)},_changeSelectedLayerRow:function(a){this._currentSelectedLayerRowNode&&this._currentSelectedLayerRowNode===a||(this._currentSelectedLayerRowNode&&f.remove(this._currentSelectedLayerRowNode,"jimu-widget-row-selected"),f.add(a,"jimu-widget-row-selected"),this._currentSelectedLayerRowNode=a)},initDisplayStateStorage:function(a,b,c){this._displayStateStorage[a.id]={displayCK:b,labelDiv:c};this._grayedLayerLabel(a)},_grayedLayerLabel:function(a){var b=!0,c=a;if(a=this._displayStateStorage[a.id].labelDiv){for(;c;){b=
b&&this._displayStateStorage[c.id].displayCK.checked;if(!b)break;c=c.parentLayerInfo}b?f.remove(a,"grayed-title"):f.add(a,"grayed-title")}},getLayerOptions:function(){var a={},b;for(b in this._displayStateStorage)this._displayStateStorage.hasOwnProperty(b)&&"function"!==typeof this._displayStateStorage[b]&&(a[b]={display:this._displayStateStorage[b].displayCK.checked});return a}})});