YUI.add("moodle-core-widget-focusafterclose",function(i,e){var s='input:not([type="hidden"]), a[href], button, textarea, select, [tabindex], [contenteditable="true"]';function t(){i.after(this._bindUIFocusAfterHide,this,"bindUI"),this.get("rendered")&&this._bindUIFocusAfterHide()}t.ATTRS={focusOnPreviousTargetAfterHide:{value:!1},focusAfterHide:{value:null,type:i.Node}},t.prototype={_uiHandlesFocusAfterHide:[],_showFocusAfterHide:null,_previousTargetFocusAfterHide:null,initializer:function(){this.get("focusOnPreviousTargetAfterHide")&&this.show&&(this._showFocusAfterHide=this.show,this.show=function(e){this._showFocusAfterHide.apply(this,arguments),this._previousTargetFocusAfterHide=null,e&&e.currentTarget&&(this._previousTargetFocusAfterHide=e.currentTarget)})},destructor:function(){new i.EventHandle(this.uiHandleFocusAfterHide).detach()},_bindUIFocusAfterHide:function(){new i.EventHandle(this.uiHandleFocusAfterHide).detach(),this.uiHandleFocusAfterHide=[this.after("visibleChange",this._afterHostVisibleChangeFocusAfterHide)]},_afterHostVisibleChangeFocusAfterHide:function(){this.get("visible")||this._attemptFocus(this._previousTargetFocusAfterHide)||this._attemptFocus(this.get("focusAfterHide"))},_attemptFocus:function(e){var t=i.one(e);return!!(t=t&&t.ancestor(s,!0))&&(t.focus(),!0)}},i.namespace("M.core").WidgetFocusAfterHide=t},"@VERSION@",{requires:["base-build","widget"]});