// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
define("esri/dijit/analysis/PluginAnalysisLayers","dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/promise/all dojo/has ../../kernel dojo/i18n!../../nls/jsapi".split(" "),function(e,c,f,l,g,h,k){var d=e(null,{filters:{all:{},categoryBoundaries:{tags:["boundaries","places"]},subCategoryBoundaries:{tags:["boundaries"]},subCategoryPlaces:{tags:["places"]},categoryHexBins:{tags:["hex"]},categoryTransportation:{tags:["transportation"]}},constructor:function(a){c.mixin(this,a);this.i18n=c.mixin({},
k.browseLayersDlg);this.filterStrings={all:{title:this.i18n.categoryAll},categoryBoundaries:{title:this.i18n.categoryBoundaries},subCategoryBoundaries:{title:"\x26nbsp;\x26nbsp;\x26nbsp;\x26nbsp;"+this.i18n.subCategoryBoundaries},subCategoryPlaces:{title:"\x26nbsp;\x26nbsp;\x26nbsp;\x26nbsp;"+this.i18n.subCategoryPlaces},categoryHexBins:{title:this.i18n.categoryHexBins},categoryTransportation:{title:this.i18n.categoryTransportation}}},fetchData:function(){this._portal=this.parent._portal;var a;return this._fetchGroups().then(c.hitch(this,
function(b){a=f.map(b||[],function(a){if(a)return'group:"'+a.id+'"'});return this._fetchGroupItems(a)}))},_fetchGroup:function(a,b){this._groups=this._groups||[];return this._groups[a]||this._portal.queryGroups(b,!0).then(c.hitch(this,function(b){0<b.total&&b.results&&(this._groups[a]=b.results);return this._groups[a]||[]}))},_fetchGroupItems:function(a,b){var c=this._isCustom?['-typekeywords:"Multilayer"']:['typekeywords:"Analysis Ready"'];this._portal.user.demographics||c.push('-typekeywords:"Requires Credits"');
return this.parent._fetchItems({groups:a,query:b,types:['type:"Map Service"','type:"Feature Service"'],typekeywords:c})},_fetchGroups:function(){return this._fetchEsriAnalysisLayers()},_fetchEsriAnalysisLayers:function(){var a;this._portal&&this._portal.analysisLayersGroupQuery&&(a=this._portal.analysisLayersGroupQuery,this._isCustomAnalysisQuery()&&(this.filterStrings=this.filters=null));return this._fetchGroup("esriAnalysisLayers",{q:a,num:100,start:0}).then(c.hitch(this,function(a){a&&0<a.length&&
(this.parent.sortAttribute=a[0].sortField,this.parent.sortDescending="asc"!==a[0].sortOrder);return a}))},_isCustomAnalysisQuery:function(){var a='title:"Living Atlas Analysis Layers" AND owner:esri',b=!1;this._portal&&this._portal.isPortal&&(a='title:"Living Atlas Analysis Layers" AND owner:esri_livingatlas');this._portal&&this._portal.analysisLayersGroupQuery&&this._portal.analysisLayersGroupQuery!==a&&(b=!0);return this._isCustom=b}});c.mixin(d,{add:function(a,b){if(!a.plugIn){var c=b||{};c.parent=
a;a.plugIn=new d(c)}},remove:function(a){a.plugIn&&(a.plugIn.destroy(),delete a.plugIn)}});g("extend-esri")&&c.setObject("dijit.analysis.PluginAnalysisLayers",d,h);return d});