// 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/geoenrichment/utils/PopupUtil","dojo/_base/lang dojo/aspect esri/dijit/geoenrichment/utils/onClickTouch dojo/dom-class dojo/dom-construct dojo/dom-geometry dojo/dom-style dojo/when dojo/sniff dijit/popup dijit/place ./DnDUtil ./MouseUtil dojo/domReady!".split(" "),function(B,F,v,C,d,p,w,x,G,l,q,D,y){var k={makePopup:function(a,E,m,c){function q(a){if(c.overlay&&a._popupWrapper){var b=d.create("div",{"class":c.overlay.overlayClass});if(c.overlay.overlayParent)d.place(b,c.overlay.overlayParent);
else{d.place(b,g,"before");var e=w.get(a._popupWrapper,"zIndex");w.set(b,"zIndex",e)}a.__popupOverlay=b}}function z(a){a.__popupOverlay&&(d.destroy(a.__popupOverlay),a.__popupOverlay=null)}function f(e){e&&c.stopEventPropagation&&e.stopPropagation();x(b||("function"==typeof a?a():a),function(a){b=a;b.domNode&&(b.__openPopupWidgetFunc=f,r||(r=!0,g=l.moveOffScreen(b),x(c.onPreShow&&c.onPreShow(),function(){var a=c.orient||["below"];if(g&&!1!==c.allowAutoOrientation){var e=-1!==a.indexOf("below"),f=
p.position(m),d=p.position(g);e&&f.y+f.h+d.h>document.body.clientHeight&&(e=!e);a=a.map(function(a){return"below"!=a||e?a:"above"})}var n;c.noOverflow&&(b.baseClass="esriGENoOverflow "+b.baseClass);l.open({parent:E,popup:b,around:m,orient:a,onClose:function(){r=!1;n&&n.remove();b.__popupWidgetOpenFlag=!1;z(b);c.onClose&&c.onClose()}});c.noOverflow&&(b.baseClass=b.baseClass.replace("esriGENoOverflow ",""));g&&c.wrapperClass&&C.add(g,c.wrapperClass);b.__popupInfo=B.mixin({},l.getTopPopup());b.__popupInfo.orient=
a;b.__popupInfo.around=m;z(b);q(b);c.onShow&&c.onShow();b.__popupWidgetOpenFlag=!0;h&&(b.own&&b.own(h),h=null);!1!==c.closeOnClickOutside&&setTimeout(function(){n=v(document.body,A,function(a){y.fixTouchEvent(a);y.isMouseOver(g)||c.isMouseOver&&c.isMouseOver()||b.isMouseOver&&b.isMouseOver()||b.__lockPopupWidgetFlag||(k.close(b),n.remove())})},0)})))})}if(a){c=c||{};var A=c.openMouseEvent?c.openMouseEvent:"click, mouseup",b="function"!==typeof a?a:null;if(b)var g=l.moveOffScreen(b);var r=!1;b&&(b.__openPopupWidgetFunc=
f);var h;if(!1!==c.openOnMouseEvent){var t=f;if(c.toggleOnClick)var u,t=function(a){u=u||a.type;b?u==a.type&&k.toggle(b):f()};h=!1===c.onClickComponent?null:void 0!==c.noDragClickTolerance?D.addNoDragClickHandler(c.onClickComponent||m,t,{tolerance:c.noDragClickTolerance}):v(c.onClickComponent||m,A,t)}c.openPopup&&f();return{remove:function(){h&&h.remove()}}}},setLocked:function(a,d){a.__lockPopupWidgetFlag=d},open:function(a){a&&!a.__lockPopupWidgetFlag&&!a.__popupWidgetOpenFlag&&a.__openPopupWidgetFunc&&
a.__openPopupWidgetFunc()},close:function(a){a&&!a.__lockPopupWidgetFlag&&l.close(a)},isOpen:function(a){return!(!a||!a.__popupWidgetOpenFlag)},toggle:function(a){k.isOpen(a)?k.close(a):k.open(a)},refresh:function(a){if(a){a=a.__popupInfo;var d=p.isBodyLtr();a&&q.around(a.wrapper,a.around,a.orient,d)}},getWrapper:function(a){return a&&a._popupWrapper}};return k});