(function(){var n={warning:"z-icon-exclamation-circle",info:"z-icon-info-circle",error:"z-icon-times-circle"},l={u:"up",d:"down",l:"left",r:"right"};zul.wgt.Notification=zk.$extends(zul.wgt.Popup,{_keepVisible:!0,$init:function(b,a){this.$supers(zul.wgt.Notification,"$init",arguments);this._msg=b;this._type=a.type;this._ref=a.ref;this._dur=a.dur;this._closable=a.closable},redraw:function(b){var a=this.uuid,c=this.$s("icon");b.push("<div",this.domAttrs_(),">");this._ref&&b.push('<div id="',a,'-p" class="',
this.$s("pointer"),'"></div>');b.push('<i id="',a,'-icon" class="',c," ",n[this._type],'"></i>');b.push('<div id="',a,'-cave" class="',this.$s("content"),'">',this._msg,"</div>");this._closable&&b.push('<div id="',a,'-cls" class="',this.$s("close"),'"><i id="',a,'-clsIcon" class="',c,' z-icon-times"></i></div>');b.push("</div>")},domClass_:function(b){var a=this._type,c=this.$supers(zul.wgt.Notification,"domClass_",arguments);a&&(c+=" "+this.$s(zUtl.encodeXML(a)));return c},doClick_:function(b){var a=
b.domTarget;a==this.$n("cls")||a==this.$n("clsIcon")?this.close():this.$supers("doClick_",arguments)},onFloatUp:function(b,a){if((!a||!a.triggerByFocus)&&this.isVisible()){b=b.origin;for(var c;b;b=b.parent){if(b==this){c||this.setTopmost();return}if(b==this.parent&&b.ignoreDescendantFloatUp_(this))return;c=c||b.isFloating_()}!this._closable&&0>=this._dur&&this.close({sendOnOpen:!0})}},open:function(b,a,c,d){this.$supers(zul.wgt.Notification,"open",arguments);this._fixarrow(b);zk(this).redoCSS(-1,
{fixFontIcon:!0})},position:function(b,a,c,d){if(!b||b.$n())this.$supers(zul.wgt.Notification,"position",arguments),this._fixarrow(b)},_posInfo:function(b,a,c,d){this._fixPadding(c);return this.$supers(zul.wgt.Notification,"_posInfo",arguments)},_fixPadding:function(b){var a=this.$n("p");if(a){var c=this.$n(),d=2+zk(a).borderWidth()/2||0;a=2+zk(a).borderHeight()/2||0;c.style.padding="0";switch(b){case "before_start":case "before_center":case "before_end":this._dir="d";c.style.paddingBottom=a+"px";
break;case "after_start":case "after_center":case "after_end":this._dir="u";c.style.paddingTop=a+"px";break;case "end_before":case "end_center":case "end_after":this._dir="l";c.style.paddingLeft=d+"px";break;case "start_before":case "start_center":case "start_after":this._dir="r";c.style.paddingRight=d+"px";break;case "top_left":case "top_center":case "top_right":case "middle_left":case "middle_center":case "middle_right":case "bottom_left":case "bottom_center":case "bottom_right":case "overlap":case "overlap_end":case "overlap_before":case "overlap_after":this._dir=
"n";break;default:this._dir="n"}}},_fixarrow:function(b){var a=this.$n("p");if(a){var c=this.$s("pointer"),d=this.$n();b=b.$n();var f=this._dir,e=zk(a),h=e.borderWidth(),k=e.borderHeight(),g=zk(d).revisedOffset(),m=zk(b).revisedOffset(),p=(b.offsetWidth-h)/2,q=(b.offsetHeight-k)/2;"n"!=f?("u"==f||"d"==f?(e="u"==f,h=(d.offsetWidth-h)/2||0,g=m[0]-g[0]+p||0,a.style.left=(b.offsetWidth>=d.offsetWidth?h:g)+"px",a.style[e?"top":"bottom"]=(2-k/2||0)+"px",a.style[e?"bottom":"top"]=""):(e="l"==f,k=(d.offsetHeight-
k)/2||0,g=m[1]-g[1]+q||0,a.style.top=(b.offsetHeight>=d.offsetHeight?k:g)+"px",a.style[e?"left":"right"]=(2-h/2||0)+"px",a.style[e?"right":"left"]=""),a.className=c+(l[f]?" "+this.$s(l[f]):""),jq(a).show()):(a.className=c,jq(a).hide())}},openAnima_:function(b,a,c,d){var f=this;jq(this.$n()).fadeIn(500,function(){f.afterOpenAnima_(b,a,c,d)})},closeAnima_:function(b){var a=this;jq(this.$n()).fadeOut(500,function(){a.afterCloseAnima_(b)})},afterCloseAnima_:function(b){b&&b.keepVisible?(this.setVisible(!1),
this.setFloating_(!1),b.sendOnOpen&&this.fire("onOpen",{open:!1})):this.detach()},getPositionArgs_:function(){return[this._fakeParent,null,this._nftPos,null]},reposition:function(){this.$supers("reposition",arguments);this._ref&&this._fixarrow(this._ref)}},{show:function(b,a,c){c||(c={});a=c.ref;var d=c.pos,f=c.dur,e=new zul.wgt.Notification(b,c);b=c.off;c=!0;a&&(c=a.$n("real")||a.$n(),c=zk(c).isRealScrollIntoView());c&&(d||b||(d=a?"end_center":"middle_center"),jq(document.body).append(e),e._nftPos=
d,e.open(a,b,d),0<f&&setTimeout(function(){e.desktop&&e.close()},f))}})})();
