YUI.add("aui-button-search-cancel",function(e,t){var n=e.Lang,r=e.one(e.config.doc),i="btn-search-cancel",s="body",o="click",u="container",a="focus",f="gutter",l="iconClass",c="input",h="region",p="remove",d="trigger",v="zIndex",m=e.Base.create(i,e.Base,[],{TEMPLATE:'<div class="'+e.getClassName(i)+'" style="padding: 5px; position: absolute; z-index: {zIndex};">'+'<i class="{iconClass}"></i>'+"</div>",_buttons:null,_eventHandles:null,initializer:function(){var e=this;e._buttons=[],e.bindDelegateUI()},destroy:function(){var t=this;e.Array.invoke(t._buttons,p),(new e.EventHandle(t._eventHandles)).detach()},bindDelegateUI:function(){var t=this,n=t.get(u),r=t.get(d);t._eventHandles=[n.delegate([a,c],e.debounce(t._onUserInteraction,50,t),r)]},getButtonForElement:function(t){var n=this,r=t.getData(i);return r||(r=e.Node.create(e.Lang.sub(n.TEMPLATE,{iconClass:n.get(l),zIndex:n.get(v)})),t.setData(i,r),n._buttons.push(r.hide()),r.on(o,n._onButtonClick,n,t)),r},_onButtonClick:function(e,t){var n=this;n._syncButtonUI(t.val("").focus())},_onUserInteraction:function(e){var t=this;t._syncButtonUI(e.target)},_syncButtonUI:function(t){var n=this,r=n.getButtonForElement(t),i,s,o;if(!t.val()){r.hide();return}e.one(t).insert(r.show(),"after"),i=n.get(f),s=r.get(h),o=t.get(h),r.setXY([o.right-s.width+i[0],o.top+o.height/2-s.height/2+i[1]])}},{ATTRS:{container:{setter:e.one,value:r,writeOnce:!0},gutter:{value:[-5,0]},iconClass:{validator:n.isString,value:"icon-remove"},trigger:{validator:n.isString,writeOnce:!0},zIndex:{value:2,writeOnce:!0}}});e.ButtonSearchCancel=m},"2.0.0",{requires:["array-invoke","base","base-build","event-focus","node-screen","node-event-delegate","aui-node-base","aui-classnamemanager","aui-event-input"]});
