// 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
define("dojo/_base/declare dojo/_base/array dojo/_base/lang dojo/promise/all esri/lang jimu/utils ./LayerInfo".split(" "),function(g,e,f,h,k,l,m){return g(m,{constructor:function(){this.layerObject={declaredClass:"esri.layers.FeatureCollection",type:"FeatureCollection",empty:!0}},_getExtent:function(){var b=null,a=[];e.forEach(this.getSubLayers(),function(c){a.push(c._getExtent())},this);return h(a).then(f.hitch(this,function(c){e.forEach(c,function(d){l.isValidExtent(d)&&(b=b?b.union(d):d)},this);
return b}))},_resetLayerObjectVisiblity:function(b){var a=b?b[this.id]:null;if(a){var c={},d;for(d in b)b.hasOwnProperty(d)&&"function"!==typeof b[d]&&(c[d]=b[d].visible);this._setSubLayerVisibleByCheckedInfo(c);this._setTopLayerVisible(a.visible)}},_setSubLayerVisibleByCheckedInfo:function(b){e.forEach(this.newSubLayers,function(a){k.isDefined(b[a.id])&&a.layerObject.setVisibility(b[a.id])},this)},_initVisible:function(){var b=!1,a;for(a=0;a<this.newSubLayers.length;a++)b=b||this.newSubLayers[a].layerObject.visible;
b&&(this._visible=!0)},_setTopLayerVisible:function(b){this._visible=b?!0:!1;e.forEach(this.newSubLayers,function(a){a.setLayerVisiblefromTopLayer()},this);this._onVisibilityChanged()},obtainNewSubLayers:function(){var b=[];e.forEach(this.originOperLayer.featureCollection.layers,function(a){this._getLayerIndexesInMapByLayerId(a.layerObject.id)&&(f.setObject("_wabProperties.originOperLayer.showLegend",this.originOperLayer.featureCollection.showLegend,a.layerObject),a=this._layerInfoFactory.create({layerObject:a.layerObject,
title:a.layerObject.label||a.layerObject.title||a.layerObject.name||a.layerObject.id||" ",id:a.id||"-",subId:a.id||"-",collection:{layerInfo:this},selfType:"collection",showLegend:!0,parentLayerInfo:this}),b.push(a),a.init())},this);b.reverse();return b},_obtainLayerIndexesInMap:function(){var b=[],a,c;for(c=this.newSubLayers.length-1;0<=c;c--)(a=this._getLayerIndexesInMapByLayerId(this.newSubLayers[c].layerObject.id))&&b.push(a);return b},moveLeftOfIndex:function(b){var a;for(a=0;a<this.newSubLayers.length;a++)this.map.reorderLayer(this.newSubLayers[a].layerObject,
b)},moveRightOfIndex:function(b){var a;for(a=this.newSubLayers.length-1;0<=a;a--)this.map.reorderLayer(this.newSubLayers[a].layerObject,b)},_getShowLegendOfWebmap:function(){return void 0!==this.originOperLayer.featureCollection.showLegend?this.originOperLayer.featureCollection.showLegend:!0},getOpacity:function(){var b,a=0;for(b=0;b<this.newSubLayers.length;b++)if(this.newSubLayers[b].layerObject.opacity)a=this.newSubLayers[b].layerObject.opacity>a?this.newSubLayers[b].layerObject.opacity:a;else return 1;
return a},setOpacity:function(b){e.forEach(this.newSubLayers,function(a){a.layerObject.setOpacity&&a.layerObject.setOpacity(b)})},getScaleRange:function(){var b=this.getSubLayers();return b[0]?b[0].getScaleRange():{minScale:0,maxScale:0}}})});