// 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/AddData/search/templates/LayerListPane.html":'\x3cdiv\x3e\r\n  \x3cdiv class\x3d"add-data-layerlist--mask"\x3e\x3c/div\x3e\r\n  \x3cdiv class\x3d"add-data-layerlist--container" data-dojo-attach-point\x3d"_container"\x3e\r\n    \x3ch2 data-dojo-attach-point\x3d"_title"\x3e\x3c/h2\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"_layerlist"\x3e\r\n  \x3c/div\x3e\r\n  \x3cdiv class\x3d"add-data-layerlist--footer jimu-widget-add-data-footer" data-dojo-attach-point\x3d"_footer"\x3e\r\n    \x3ca href\x3d"#" class\x3d"back-button" data-dojo-attach-point\x3d"_backButton"\x3e\r\n      ${i18n.layerList.back}\x3ci class\x3d"esri-icon-collapse"\x3e\x3c/i\x3e\r\n    \x3c/a\x3e\r\n  \x3c/div\x3e\r\n\x3c/div\x3e\r\n'}});
define("dojo/_base/declare dojo/_base/array dojo/on dojo/dom-class dojo/dom-construct dijit/_WidgetBase dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dojo/text!./templates/LayerListPane.html dojo/i18n!../nls/strings ./util".split(" "),function(m,l,n,h,e,p,q,r,t,k,u){return m([p,q,r],{i18n:k,templateString:t,wabWidget:null,baseClass:"add-data-widget-layers",postCreate:function(){this.inherited(arguments)},startup:function(){this._started||(this._buildList(),this._initListeners(),this.inherited(arguments))},
_addLayer:function(a,c){var b=this,g=this._getLayerTitle(c),f=e.create("div",{"class":"add-data-layerlist--listitem"},a);e.create("A",{"class":"remove-button",href:"#",innerHTML:"\x3cspan class\x3d'esri-icon-trash'\x3e\x3c/span\x3e",title:k.layerList.removeLayer,onclick:function(d){d.preventDefault();try{b.wabWidget&&b.wabWidget.map&&(b.wabWidget.map.removeLayer(c),e.destroy(f))}catch(v){console.warn("Error removing layer."),console.warn(v)}}},f);a=e.create("label",{"class":"layer-name"},f);u.setNodeText(a,
g)},_buildList:function(){var a=this,c=!1,b=[],g=this.wabWidget.map,f=e.create("div",{"class":"add-data-layerlist--list"});l.forEach(g.layerIds,function(d){b.push(d)});l.forEach(g.graphicsLayerIds,function(d){b.push(d)});b.reverse();l.forEach(b,function(d){(d=g.getLayer(d))&&d.xtnAddData&&(c=!0,a._addLayer(f,d))});return c?f:e.create("div",{"class":"no-data-message",innerHTML:k.layerList.noLayersAdded})},_getLayerTitle:function(a){var c="...";if("string"===typeof a.label&&0<a.label.length)c=a.label;
else if("string"===typeof a.title&&0<a.title.length)c=a.title;else if("string"===typeof a.name&&0<a.name.length)c=a.name;else if(a.url){var b=a.url.indexOf("/FeatureServer");-1===b&&(b=a.url.indexOf("/MapServer"));-1===b&&(b=a.url.indexOf("/ImageServer"));-1===b&&(b=a.url.indexOf("/service"));-1<b&&(a=a.url.substring(0,b),c=a=a.substring(a.lastIndexOf("/")+1,a.length))}return c},_initListeners:function(){var a=this;this.own(n(this._backButton,"click",function(c){c.preventDefault();a.hide()}))},show:function(){var a=
this._buildList();this._title.innerHTML=k.layerList.caption;this._layerlist.innerHTML="";a&&a.tagName&&this._layerlist.appendChild(a);this.wabWidget&&this.wabWidget.domNode&&h.add(this.wabWidget.domNode,"layerlist-show");h.add(this.domNode,"show")},hide:function(){this.wabWidget&&this.wabWidget.domNode&&h.remove(this.wabWidget.domNode,"layerlist-show");h.remove(this.domNode,"show")}})});