define("common/popup/1.0.0:popup",["lib/jquery/1.11.3:jquery"],function(t,i,e){function n(){this._buildDOM(),this._bindEvents()}function o(){f=h('<iframe frameborder="0" src=""></iframe>').appendTo(document.body),f.css({background:"red",position:"absolute",top:0,left:0,"z-index":5444,opacity:0,filter:"alpha(opacity=0)"})}function s(){v&&(null===f&&o(),f.css({width:d.width(),height:l.height()>d.height()?l.height():d.height()}).show())}function a(){v&&f.hide()}function r(t){var t=t||"",i=h('<div class="'+t+'" />').appendTo(l);return i.css({position:m?"absolute":"fixed",width:m?d.width():"100%",height:m?u.outerHeight(!0):"100%",top:0,left:0,"z-index":5555,"background-color":"#000",opacity:.2,filter:"alpha(opacity=20)"}),i}function c(t){var i=h(t).eq(0).css("position","absolute"),e=i.outerWidth(),n=i.outerHeight(),o=u.scrollLeft(),s=u.scrollTop(),a=d.width(),r=d.height(),c=(a-e)/2+o,l=382*(r-n)/1e3+s;return i.css({left:Math.max(parseInt(c),o)+"px",top:Math.max(parseInt(l),s)+"px"}),i}var h=t("lib/jquery/1.11.3:jquery"),u=h(document),l=h(document.body),d=h(window),f=null,p="x-popup",m=!window.XMLHttpRequest,v=m||navigator.userAgent.indexOf("MSIE 7.0")>0,g='<div class="'+p+'-main"><a class="'+p+'-close" href="#" title="关闭窗口">×</a>'+(v?'<table class="'+p+'-table"><tr><td class="'+p+'-cell">':"")+'<div class="'+p+'-title"></div><div class="'+p+'-content"></div><div class="'+p+'-footer"></div>'+(v?"</td></tr></table>":"")+"</div>",b={};n.prototype={init:function(t){var i=this,e=i.DOM;return e.main.attr("id",t.id),e.main.css("border",t.border),e.content.css({width:t.width,height:t.height}),e.close[t.closeButton?"show":"hide"](),i.config=t,i.title(t.title),i.content(t.content),i.button(t.button),i._setMask(t.mask),i},title:function(t){var i=this.DOM.title;return t===!1?i.empty().hide():i.html(t).show(),this},content:function(t){return this.DOM.content.empty()["object"==typeof t?"append":"html"](t),this},button:function(t){var i=this,e=i.DOM.footer,t=t||[],n="";return i.config._callbacks=[],e[t.length?"show":"hide"](),"string"==typeof t?n=t:h.each(t,function(t,e){i.config._callbacks[t]=e.callback||"";var o=p+"-button"+(e.focus?" x-button-hilight":"");n+='<a href="javascript:;" class="'+o+'" data-index="'+t+'">'+e.text+"</a>"}),e.html(n),i},show:function(){var t=this.DOM;return t.main.show(),this._setMask(this.config.mask),this.position(),s(),this},hide:function(){var t=this.DOM;return t.main.hide(),t.mask&&t.mask.fadeOut(),a(),this},remove:function(){var t=this.DOM,i=t.main;i.off().remove(),t.mask&&t.mask.remove(),delete b[this.config.id]},position:function(){var t=this.config.align,t=h.isFunction(t)?t.call(this):t;return h.isArray(t)&&t.length?this.setPosition(t[0],t[1]):this.center(),this},setPosition:function(t,i){return this.DOM.main.css({left:t,top:i}),this},center:function(){return c(this.DOM.main),this},_setMask:function(t){var i=this.DOM;t&&(i.mask||(i.mask=r(p+"-mask")),i.mask.stop(!0).show()),t||i.mask&&i.mask.fadeOut()},_buildDOM:function(){var t={};return t.main=h(g).appendTo(l),h.each(["close","title","content","footer"],function(i,e){t[e]=h("."+p+"-"+e,t.main)}),this.DOM=t,this},_bindEvents:function(){var t=this,i=t.DOM.main;i.on("click","."+p+"-close",function(i){i.preventDefault(),t.hide()}),i.on("click","."+p+"-button",function(i){i.preventDefault();var e=this.getAttribute("data-index");t._trigger(e)})},_trigger:function(t){var i=this.config._callbacks[t];return"function"!=typeof i||i.call(this)!==!1?this.hide():this}};var x=null;d.on("resize",function(){x&&clearTimeout(x),x=setTimeout(function(){h.each(b,function(t,i){i.config.fixed&&i.position()})})});var k={id:p+"-default",title:!1,mask:!0,closeButton:!0,content:"",align:[],fixed:!1,button:[]};e.exports={instances:b,show:function(t){var i="string"==typeof t?{content:t}:t,t=h.extend({},k,i),e=t.id||(t.id="P"+h.now()),o=this.getInstance(e)||(b[e]=new n);return o.init(t).show(),o},alert:function(t,i,e){var i="undefined"==typeof i?!0:i,n=i?" x-alert-ok":" x-alert-warn",o=e||4e3,s='<div class="x-alert-box'+n+'"><div class="x-alert-icon"></div><div class="x-alert-inner">'+t+"</div></div>";this._timer&&clearTimeout(this._timer);var a=this.show({id:"x-dialog-alert",closeButton:!1,border:0,content:s,mask:!1});return this._timer=setTimeout(function(){a.hide()},o),a},confirm:function(t,i,e,n){var o={id:"x-confirmBox",title:t,content:i,mask:!0,fixed:!0,button:[{text:"确 定",focus:!0,callback:e},{text:"取 消"}]};n&&"object"==typeof n&&(o=h.extend(o,n));var s=this.show(o);return s},getInstance:function(t){return b[t]},showMask:r,center:c}});