// 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/PopupMenu.html":'\x3cdiv\x3e\r\n  \x3cdiv class\x3d"popup-menu-transparency-body" data-dojo-attach-point\x3d"transparencyDiv" data-dojo-attach-event\x3d"onclick:_onTransparencyDivClick" \x3e\r\n    \x3cdiv class\x3d"label"\x3e\r\n      \x3cdiv class\x3d"label-left jimu-float-leading"\x3e${nls.itemOpaque}\x3c/div\x3e\r\n      \x3cdiv class\x3d"label-right jimu-float-trailing"\x3e${nls.itemTransparent}\x3c/div\x3e\r\n    \x3c/div\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"transparencyBody"\x3e \r\n      \x3col data-dojo-attach-point\x3d"transparencyRule" class\x3d"transparency-rule"\x3e \x3c/ol\x3e\r\n    \x3c/div\x3e\r\n  \x3c/div\x3e\r\n  \x3cdiv class\x3d"popup-menu-visible-scale-range-body" data-dojo-attach-point\x3d"setVisibilityRangeNode" data-dojo-attach-event\x3d"onclick:_onSetVisibilityRangeNode"\x3e \r\n  \x3c/div\x3e\r\n\x3cdiv\x3e\r\n'}});
define("dojo/_base/declare dojo/_base/array dojo/_base/html dojo/_base/lang dojo/query dojo/on dojo/keys dijit/focus dojo/Deferred jimu/dijit/DropMenu jimu/utils dijit/_TemplatedMixin dijit/form/HorizontalSlider dijit/form/HorizontalRuleLabels dojo/text!./PopupMenu.html dojo/dom-style esri/dijit/VisibleScaleRangeSlider ./NlsStrings ./PopupMenuInfo".split(" "),function(v,t,f,g,n,r,h,p,w,x,y,z,A,B,C,q,D,E,F){return v([x,z],{templateString:C,popupMenuInfo:null,loading:null,_deniedItems:null,_deniedItemsFromConfig:null,
_layerInfo:null,constructor:function(){this.nls=E.value},postCreate:function(){this.inherited(arguments);this._initDeniedItems();this.loading=f.create("div",{"class":"popup-menu-loading"},this.popupMenuNode)},_initDeniedItems:function(){var a=[],c={ZoomTo:"zoomto",Transparency:"transparency",SetVisibilityRange:"setVisibilityRange",EnableOrDisablePopup:"controlPopup",ControlLabels:"controlLabels",MoveupOrMovedown:"moveup movedown",OpenAttributeTable:"table",DescriptionOrShowItemDetailsOrDownload:"url"};
this._deniedItems=[];this._deniedItemsFromConfig=[];for(var d in this._config.contextMenu)this._config.contextMenu.hasOwnProperty(d)&&"function"!==typeof this._config.contextMenu[d]&&!1===this._config.contextMenu[d]&&(a=a.concat(c[d].split(" ")));t.forEach(a,g.hitch(this,function(e){this._deniedItemsFromConfig.push({key:e,denyType:"hidden"})}))},_getDropMenuPosition:function(){return{top:"40px",right:"0px",zIndex:1}},_getTransNodePosition:function(){return{top:"28px",right:"2px"}},_onBtnClick:function(){},
_refresh:function(){this._denyItems();this._changeItemsUI()},_denyItems:function(){var a=n("[class~\x3d'menu-item-identification']",this.dropMenuNode);a.forEach(function(e){f.removeClass(e,"menu-item-dissable");f.removeClass(e,"menu-item-hidden")},this);f.removeClass(this.dropMenuNode,"no-border");t.forEach(this._deniedItems,function(e){var m=n("div[itemId\x3d'"+e.key+"']",this.dropMenuNode)[0];m&&("disable"===e.denyType?(f.addClass(m,"menu-item-dissable"),f.setAttr(m,"aria-disabled","true"),"url"===
e.key&&n(".menu-item-description",m).forEach(function(l){f.setAttr(l,"href","#");f.removeAttr(l,"target")})):(f.removeAttr(m,"aria-disabled"),f.addClass(m,"menu-item-hidden")))},this);for(var c=-1,d=0;d<a.length;d++)f.hasClass(a[d],"menu-item-line")&&(-1===c||f.hasClass(a[c],"menu-item-line"))&&f.addClass(a[d],"menu-item-hidden"),f.hasClass(a[d],"menu-item-hidden")||(c=d);a=t.filter(a,function(e){return!f.hasClass(e,"menu-item-hidden")});0===a.length?f.addClass(this.dropMenuNode,"no-border"):(f.removeClass(this.dropMenuNode,
"no-border"),f.hasClass(a[a.length-1],"menu-item-line")&&f.addClass(a[a.length-1],"menu-item-hidden"))},_changeItemsUI:function(){var a=n("[itemid\x3dcontrolPopup]",this.dropMenuNode)[0];a&&(this._layerInfo.isPopupNestedEnabled()?f.setAttr(a,"innerHTML",this.nls.removePopup):f.setAttr(a,"innerHTML",this.nls.enablePopup));(a=n("[itemid\x3dcontrolLabels]",this.dropMenuNode)[0])&&this._layerInfo.canShowLabel()&&(this._layerInfo.isShowLabels()?f.setAttr(a,"innerHTML",this.nls.hideLables):f.setAttr(a,
"innerHTML",this.nls.showLabels));(a=n("[itemid\x3durl] a",this.dropMenuNode)[0])&&f.setAttr(a,"target","_blank")},_switchLoadingState:function(a){a?f.setStyle(this.loading,"display","block"):f.setStyle(this.loading,"display","none")},selectItem:function(a,c){for(var d=!1,e=0;e<this._deniedItems.length;e++)if(this._deniedItems[e].key===a.key){d=!0;break}d||this.emit("onMenuClick",a);c.stopPropagation(c)},openDropMenu:function(){var a=g.hitch(this,this.inherited,arguments),c=new w;this._switchLoadingState(!0);
this.dropMenuNode?c.resolve(this.popupMenuInfo):F.create(this._layerInfo,this.layerListWidget).then(g.hitch(this,function(d){this.items=d.getDisplayItems();this.popupMenuInfo=d;this._createDropMenuNode();c.resolve(this.popupMenuInfo)}));c.then(g.hitch(this,function(){this.popupMenuInfo.getDeniedItems().then(g.hitch(this,function(d){this._deniedItems=this._deniedItemsFromConfig.concat(d);this._refresh();a(arguments);this._switchLoadingState(!1)}),g.hitch(this,function(){this._switchLoadingState(!1)}))}),
g.hitch(this,function(){this._switchLoadingState(!1)}))},closeDropMenu:function(){this.inherited(arguments);this.hideTransNode();this.hideSetVisibilityRangeNode()},_onTransparencyDivClick:function(a){a.stopPropagation()},showTransNode:function(a,c){this.hideSetVisibilityRangeNode();this.transHorizSlider||this._createTransparencyWidget(c);this.transHorizSlider.set("value",1-a);q.set(this.transparencyDiv,"top",this._getTransNodePosition().top);isRTL?q.set(this.transparencyDiv,"left",this._getTransNodePosition().right):
q.set(this.transparencyDiv,"right",this._getTransNodePosition().right);q.set(this.transparencyDiv,"display","block");this.transHorizSlider.focus()},hideTransNode:function(){q.set(this.transparencyDiv,"display","none")},_createTransparencyWidget:function(a){this.transHorizSlider=new A({minimum:0,maximum:1,intermediateChanges:!0},this.transparencyBody);this.own(this.transHorizSlider.on("change",g.hitch(this,function(c){this.emit("onMenuClick",{key:"transparencyChanged"},{newTransValue:c})})));this.own(r(this.transHorizSlider.domNode,
"keydown",g.hitch(this,function(c){c.keyCode===h.ESCAPE?(c.stopPropagation(),c.preventDefault(),this.hideTransNode(),(c=this.getMenuItemNodeByItemKey(a.key))&&p.focus(c)):c.keyCode===h.TAB&&(c.stopPropagation(),c.preventDefault(),this._enableNavMode(c))})));new B({container:"bottomDecoration"},this.transparencyRule)},_onSetVisibilityRangeNode:function(a){a.stopPropagation()},showSetVisibilityRangeNode:function(a,c){this.hideTransNode();if(!this.visibleScaleRangeSlider){var d=a.getScaleRange();this.visibleScaleRangeSlider=
(new D({map:a.map,minScale:d.minScale,maxScale:d.maxScale})).placeAt(this.setVisibilityRangeNode);this.visibleScaleRangeSlider.startup();this._supportsVisibilityRange508Accessibility(c)}this.own(this.visibleScaleRangeSlider.on("scale-range-change",g.hitch(this,function(e){a.setScaleRange(e.minScale,e.maxScale)})));q.set(this.setVisibilityRangeNode,"top",this._getTransNodePosition().top);isRTL?q.set(this.setVisibilityRangeNode,"left",this._getTransNodePosition().right):q.set(this.setVisibilityRangeNode,
"right",this._getTransNodePosition().right);q.set(this.setVisibilityRangeNode,"display","block");this.visibleScaleRangeSlider._slider.focus();this.visibleScaleRangeSlider._slider.focus()},hideSetVisibilityRangeNode:function(){q.set(this.setVisibilityRangeNode,"display","none")},hide:function(){q.set(this.domNode,"display","none")},show:function(){q.set(this.domNode,"display","block")},_enableNavMode:function(a){a.keyCode!==h.TAB||y.isInNavMode()||f.addClass(document.body,"jimu-nav-mode")},_supportsVisibilityRange508Accessibility:function(a){var c=
n(".dijitSliderImageHandle",this.setVisibilityRangeNode)[0],d=n(".dijitDownArrowButton",this.setVisibilityRangeNode),e=d[1],m=d[0],l=d[1];this.own(r(c,"keydown",g.hitch(this,function(b){b.keyCode===h.TAB&&b.shiftKey&&(b.stopPropagation(),b.preventDefault())})));this.own(r(e,"keydown",g.hitch(this,function(b){b.keyCode!==h.TAB||b.shiftKey?b.keyCode===h.ENTER&&(b.stopPropagation(),b.preventDefault(),setTimeout(g.hitch(this,function(){this._bindEsriScaleMenuPopupKey(l)}),200)):(b.stopPropagation(),b.preventDefault())})));
this.own(r(m,"keydown",g.hitch(this,function(b){b.keyCode===h.ENTER&&(b.stopPropagation(),b.preventDefault(),setTimeout(g.hitch(this,function(){this._bindEsriScaleMenuPopupKey(m)}),200))})));this.own(r(m,"click",g.hitch(this,function(b){b.stopPropagation();b.preventDefault();setTimeout(g.hitch(this,function(){this._bindEsriScaleMenuPopupKey(m)}),200)})));this.own(r(l,"click",g.hitch(this,function(b){b.stopPropagation();b.preventDefault();setTimeout(g.hitch(this,function(){this._bindEsriScaleMenuPopupKey(l)}),
200)})));this.own(r(this.setVisibilityRangeNode,"keydown",g.hitch(this,function(b){b.keyCode===h.ESCAPE?(b.stopPropagation(),b.preventDefault(),this.hideSetVisibilityRangeNode(),(b=this.getMenuItemNodeByItemKey(a.key))&&p.focus(b)):b.keyCode===h.TAB?(b.stopPropagation(),this._enableNavMode(b)):b.keyCode===h.ENTER&&b.stopPropagation()})))},_bindEsriScaleMenuPopupKey:function(a){var c=this._getEsriScaleMenuPopup();if(c){var d=n(".dijitInputInner",c)[0];f.setAttr(d,"tabindex","0");var e=n(".esriHeader",
c);var m=n(".esriCurrent",c)[0];e[0]&&m&&f.setAttr(d,"aria-label",e[0].innerText+" "+m.innerText);p.focus(d)}if(c&&!c._hasBeenBoundKey){var l=n(".esriContent",c)[1];f.setAttr(l,"tabindex","0");e[1]&&f.setAttr(l,"aria-label",e[1].innerText+" ");e=n("li.esriItem",c);t.forEach(e,function(b){f.setAttr(b,"tabindex","0");this.own(r(b,"keydown",g.hitch(this,function(k){var u=this._getMenuItemInfo(c,b);k.keyCode===h.TAB?(k.stopPropagation(),k.preventDefault(),l&&p.focus(l)):k.keyCode===h.DOWN_ARROW?(k.stopPropagation(),
k.preventDefault(),u.nextMenuItem&&p.focus(u.nextMenuItem)):k.keyCode===h.UP_ARROW?(k.stopPropagation(),k.preventDefault(),u.previousMenuItem&&p.focus(u.previousMenuItem)):k.keyCode===h.ESCAPE?(k.stopPropagation(),k.preventDefault(),l&&p.focus(l)):k.keyCode===h.ENTER&&(k.stopPropagation(),k.preventDefault(),k=document.createEvent("MouseEvents"),k.initEvent("click",!0,!0),b.dispatchEvent(k),a&&p.focus(a))})))},this);this.own(r(d,"keydown",g.hitch(this,function(b){b.keyCode===h.TAB?(b.stopPropagation(),
b.preventDefault(),this._enableNavMode(b),p.focus(l)):b.keyCode===h.ESCAPE?a&&p.focus(a):b.keyCode===h.ENTER&&a&&p.focus(a)})));l&&this.own(r(l,"keydown",g.hitch(this,function(b){var k=this._getMenuItemInfo(c);b.keyCode===h.TAB?(b.stopPropagation(),b.preventDefault(),this._enableNavMode(b),p.focus(d)):b.keyCode===h.ENTER?(b.stopPropagation(),b.preventDefault(),k.firstMenuItem&&p.focus(k.firstMenuItem)):b.keyCode===h.ESCAPE&&a&&p.focus(a)})));c._hasBeenBoundKey=!0}},_getMenuItemInfo:function(a,c){var d=
{firstMenuItem:null,lastMenuItem:null,previousMenuItem:null,nextMenuItem:null},e=n("li.esriItem",a);e=t.filter(e,g.hitch(this,function(m){return f.hasClass(m,"esriHidden")?!1:!0}));c&&t.some(e,function(m,l){return m===c?(d.previousMenuItem=e[l-1],d.nextMenuItem=e[l+1],!0):!1},this);d.firstMenuItem=e[0];d.lastMenuItem=e[e.length-1];return d},_getEsriScaleMenuPopup:function(){var a=null;n(".esriScaleMenuPopup",document.body).some(function(c){return"block"===f.getStyle(c,"display")?(a=c,!0):!1});return a}})});