// 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/array","jimu/LayerInfos/LayerInfos"],function(f,m){function g(a,c){return a.isLeaf()?c.layerState[a.id]?c.layerState[a.id].selected:a.getShowLegendOfWebmap():!0}var k={getLayerInfosParam:function(a){return n(a)}},n=function(a){var c=[],p=m.getInstanceSync().getLayerInfoArray();f.forEach(p,function(b){var h=[];g(b,a)&&(!b.layerObject||"esri.layers.ArcGISDynamicMapServiceLayer"!==b.layerObject.declaredClass&&"esri.layers.ArcGISTiledMapServiceLayer"!==b.layerObject.declaredClass||
f.forEach(b.layerObject.dynamicLayerInfos||b.layerObject.layerInfos,function(d){var l=null;b.traversal(function(e){if(e.subId===d.id)return e.isLeaf()&&!g(e,a)&&h.push(e.originOperLayer.mapService.subId),l=e,!0});l||h.push(d.id)}),b.isMapNotesLayerInfo()?f.forEach(b.getSubLayers(),function(d){g(d,a)&&c.push({layer:d.layerObject,title:"Map Notes - "+d.title})}):c.push({hideLayers:h,layer:b.layerObject,title:b.title}))});return c.reverse()};k.isSupportedLayerType=function(a){return a&&("esri.layers.ArcGISDynamicMapServiceLayer"===
a.declaredClass||"esri.layers.ArcGISImageServiceLayer"===a.declaredClass&&10.2<=a.version||"esri.layers.ArcGISImageServiceVectorLayer"===a.declaredClass||"esri.layers.ArcGISTiledMapServiceLayer"===a.declaredClass||"esri.layers.FeatureLayer"===a.declaredClass||"esri.layers.StreamLayer"===a.declaredClass||"esri.layers.KMLLayer"===a.declaredClass||"esri.layers.GeoRSSLayer"===a.declaredClass||"esri.layers.WMSLayer"===a.declaredClass||"esri.layers.WFSLayer"===a.declaredClass||"esri.layers.CSVLayer"===
a.declaredClass)?!0:!1};return k});