YUI.add("widget-modality",function(l,t){var i,e,s,o,a="widget",h="boundingBox",n="visible",d="zIndex",r="Change",u=l.Lang.isBoolean,c=l.ClassNameManager.getClassName,f="maskHide",g=(s=l.config.doc,o=null,s.createElement&&(e=s.createElement("div"))&&e.style&&(e.style.position="fixed",(s=s.body)&&s.appendChild&&s.removeChild&&(s.appendChild(e),o="fixed"===e.style.position,s.removeChild(e))),o);function _(t){}i={modal:c(a,"modal"),mask:c(a,"mask")},_.ATTRS={maskNode:{getter:"_getMaskNode",readOnly:!0},modal:{value:!1,validator:u},focusOn:{valueFn:function(){return[{eventName:"clickoutside"},{eventName:"focusoutside"}]},validator:l.Lang.isArray}},_.CLASSES=i,_._MASK=null,_._GET_MASK=function(){var t=_._MASK,e=l.one("win");return t&&null!==t.getDOMNode()&&t.inDoc()||(t=l.Node.create("<div></div>").addClass(i.mask),_._MASK=t,g?t.setStyles({position:"fixed",width:"100%",height:"100%",top:"0",left:"0",display:"block"}):t.setStyles({position:"absolute",width:e.get("winWidth")+"px",height:e.get("winHeight")+"px",top:"0",left:"0",display:"block"})),t},_.STACK=[],_.prototype={initializer:function(){l.after(this._renderUIModal,this,"renderUI"),l.after(this._syncUIModal,this,"syncUI"),l.after(this._bindUIModal,this,"bindUI")},destructor:function(){this._uiSetHostVisibleModal(!1)},_uiHandlesModal:null,_renderUIModal:function(){var t=this.get(h);this._repositionMask(this),t.addClass(i.modal)},_bindUIModal:function(){this.after(n+r,this._afterHostVisibleChangeModal),this.after(d+r,this._afterHostZIndexChangeModal),this.after("focusOnChange",this._afterFocusOnChange),(!g||l.UA.ios&&l.UA.ios<5||l.UA.android&&l.UA.android<3)&&l.one("win").on("scroll",this._resyncMask,this)},_syncUIModal:function(){this._uiSetHostVisibleModal(this.get(n))},_focus:function(){var t=this.get(h),e=t.get("tabIndex");t.set("tabIndex",0<=e?e:0),this.focus()},_blur:function(){this.blur()},_getMaskNode:function(){return _._GET_MASK()},_uiSetHostVisibleModal:function(t){var e=_.STACK,i=this.get("maskNode"),s=this.get("modal");t?(l.Array.each(e,function(t){t._detachUIHandlesModal(),t._blur()}),e.unshift(this),this._repositionMask(this),this._uiSetHostZIndexModal(this.get(d)),s&&(i.show(),l.later(1,this,"_attachUIHandlesModal"),this._focus(),this._blockIFrameFocus())):(0<=(t=l.Array.indexOf(e,this))&&e.splice(t,1),this._detachUIHandlesModal(),this._blur(),e.length?(s=e[0],this._repositionMask(s),s._uiSetHostZIndexModal(s.get(d)),s.get("modal")&&(l.later(1,s,"_attachUIHandlesModal"),s._focus())):"block"===i.getStyle("display")&&i.hide(),this._unblockIFrameFocus())},_blockIFrameFocus:function(){var t=this.get(h);l.all("iframe").each(function(){t.contains(this)||(this.setAttribute("data-tabindex",this.get("tabIndex")),this.set("tabIndex",-1))})},_unblockIFrameFocus:function(){l.all("iframe").each(function(){this.hasAttribute("data-tabindex")&&(this.set("tabIndex",this.getAttribute("data-tabindex")),this.removeAttribute("data-tabindex"))})},_uiSetHostZIndexModal:function(t){this.get("modal")&&this.get("maskNode").setStyle(d,t||0)},_attachUIHandlesModal:function(){if(!this._uiHandlesModal&&_.STACK[0]===this){for(var t,e=this.get(h),i=this.get("maskNode"),s=this.get("focusOn"),o=l.bind(this._focus,this),a=[],n=0,d=s.length;n<d;n++)(t={}).node=s[n].node,t.ev=s[n].eventName,t.keyCode=s[n].keyCode,t.node||t.keyCode||!t.ev?t.node&&!t.keyCode&&t.ev?a.push(t.node.on(t.ev,o)):t.node&&t.keyCode&&t.ev&&a.push(t.node.on(t.ev,o,t.keyCode)):a.push(e.on(t.ev,o));g||a.push(l.one("win").on("scroll",l.bind(function(){i.setStyle("top",i.get("docScrollY"))},this))),this._uiHandlesModal=a}},_detachUIHandlesModal:function(){l.each(this._uiHandlesModal,function(t){t.detach()}),this._uiHandlesModal=null},_afterHostVisibleChangeModal:function(t){this._uiSetHostVisibleModal(t.newVal)},_afterHostZIndexChangeModal:function(t){this._uiSetHostZIndexModal(t.newVal)},isNested:function(){return 1<_.STACK.length},_repositionMask:function(t){var e=this.get("modal"),i=t.get("modal"),s=this.get("maskNode");e&&!i?(s.remove(),this.fire(f)):(!e&&i||e&&i)&&(s.remove(),this.fire(f),(e=t.get(h).get("parentNode")||l.one("body")).insert(s,e.get("firstChild")),this.fire("maskShow"))},_resyncMask:function(t){var t=t.currentTarget,e=t.get("docScrollX"),i=t.get("docScrollY"),s=t.get("innerWidth")||t.get("winWidth"),t=t.get("innerHeight")||t.get("winHeight");this.get("maskNode").setStyles({top:i+"px",left:e+"px",width:s+"px",height:t+"px"})},_afterFocusOnChange:function(){this._detachUIHandlesModal(),this.get(n)&&this._attachUIHandlesModal()}},l.WidgetModality=_},"patched-v3.18.4",{requires:["base-build","event-outside","widget"],skinnable:!0});