text: define("arale/dialog/1.3.1/dialog",["$","arale/overlay/1.1.4/overlay","arale/position/1.0.1/position","arale/iframe-shim/1.0.2/iframe-shim","arale/widget/1.1.1/widget","arale/base/1.1.1/base","arale/class/1.1.0/class","arale/events/1.1.0/events","arale/overlay/1.1.4/mask","arale/templatable/0.9.2/templatable","gallery/handlebars/1.0.2/handlebars","./dialog.handlebars"],function(a,b,c){function d(a){null==a.attr("tabindex")&&a.attr("tabindex","-1")}function e(a){var b=a[0].contentWindow.document;return b.body.scrollHeight&&b.documentElement.scrollHeight?Math.min(b.body.scrollHeight,b.documentElement.scrollHeight):b.documentElement.scrollHeight?b.documentElement.scrollHeight:b.body.scrollHeight?b.body.scrollHeight:void 0}var f=a("$"),g=a("arale/overlay/1.1.4/overlay"),h=a("arale/overlay/1.1.4/mask"),i=a("arale/events/1.1.0/events"),j=a("arale/templatable/0.9.2/templatable"),k=g.extend({Implements:j,attrs:{template:a("./dialog.handlebars"),trigger:{value:null,getter:function(a){return f(a)}},classPrefix:"ui-dialog",content:{value:null,setter:function(a){return/^(https?:\/\/|\/|\.\/|\.\.\/)/.test(a)&&(this._type="iframe",(a.indexOf("?ajax")>0||a.indexOf("&ajax")>0)&&(this._ajax=!0)),a}},hasMask:!0,closeTpl:"×",width:500,height:null,initialHeight:300,effect:"none",zIndex:999,autoFit:!0,align:{value:{selfXY:["50%","50%"],baseXY:["50%","42%"]},getter:function(a){return this.element.height()>.84*f(window).height()?{selfXY:["50%","0"],baseXY:["50%","0"]}:a}}},parseElement:function(){this.set("model",{classPrefix:this.get("classPrefix")}),k.superclass.parseElement.call(this),this.contentElement=this.$("[data-role=content]"),this.contentElement.css({height:"100%",zoom:1}),this.$("[data-role=close]").hide()},events:{"click [data-role=close]":function(a){a.preventDefault(),this.hide()}},show:function(){return"iframe"===this._type&&(this._ajax?this._ajaxHtml():(!this.get("height")&&this.contentElement.css("height",this.get("initialHeight")),this._showIframe())),k.superclass.show.call(this),this},hide:function(){return"iframe"===this._type&&this.iframe&&(this.iframe.attr({src:"javascript:'';"}),this.iframe.remove(),this.iframe=null),k.superclass.hide.call(this),clearInterval(this._interval),delete this._interval,this},destroy:function(){return this.element.remove(),this._hideMask(),clearInterval(this._interval),k.superclass.destroy.call(this)},setup:function(){k.superclass.setup.call(this),this._setupTrigger(),this._setupMask(),this._setupKeyEvents(),this._setupFocus(),d(this.element),d(this.get("trigger")),this.activeTrigger=this.get("trigger").eq(0)},_onRenderContent:function(a){if("iframe"!==this._type){var b;try{b=f(a)}catch(c){b=[]}b[0]?this.contentElement.empty().append(b):this.contentElement.empty().html(a),this._setPosition()}},_onRenderCloseTpl:function(a){""===a?this.$("[data-role=close]").html(a).hide():this.$("[data-role=close]").html(a).show()},_onRenderVisible:function(a){a?"fade"===this.get("effect")?this.element.fadeIn(300):this.element.show():this.element.hide()},_setupTrigger:function(){this.delegateEvents(this.get("trigger"),"click",function(a){a.preventDefault(),this.activeTrigger=f(a.currentTarget),this.show()})},_setupMask:function(){var a=this;h._dialogs=h._dialogs||[],this.after("show",function(){if(this.get("hasMask")){h.set("zIndex",a.get("zIndex")).show(),h.element.insertBefore(a.element);for(var b=!1,c=0;c<h._dialogs.length;c++)h._dialogs[c]===a&&(b=!0);b||h._dialogs.push(a)}}),this.after("hide",this._hideMask)},_hideMask:function(){if(this.get("hasMask"))if(h._dialogs&&h._dialogs.pop(),h._dialogs&&h._dialogs.length>0){var a=h._dialogs[h._dialogs.length-1];h.set("zIndex",a.get("zIndex")),h.element.insertBefore(a.element)}else h.hide()},_setupFocus:function(){this.after("show",function(){this.element.focus()}),this.after("hide",function(){this.activeTrigger&&this.activeTrigger.focus()})},_setupKeyEvents:function(){this.delegateEvents(f(document),"keyup.esc",function(a){27===a.keyCode&&this.get("visible")&&this.hide()})},_showIframe:function(){var a=this;this.iframe||this._createIframe(),this.iframe.attr({src:this._fixUrl(),name:"dialog-iframe"+(new Date).getTime()}),this.iframe.one("load",function(){a.get("visible")&&(a.get("autoFit")&&(clearInterval(a._interval),a._interval=setInterval(function(){a._syncHeight()},300)),a._syncHeight(),a._setPosition(),a.trigger("complete:show"))})},_fixUrl:function(){var a=this.get("content").match(/([^?#]*)(\?[^#]*)?(#.*)?/);return a.shift(),a[1]=(a[1]&&"?"!==a[1]?a[1]+"&":"?")+"t="+(new Date).getTime(),a.join("")},_createIframe:function(){var a=this;this.iframe=f("<iframe>",{src:"javascript:'';",scrolling:"no",frameborder:"no",allowTransparency:"true",css:{border:"none",width:"100%",display:"block",height:"100%",overflow:"hidden"}}).appendTo(this.contentElement),i.mixTo(this.iframe[0]),this.iframe[0].on("close",function(){a.hide()})},_syncHeight:function(){var a;if(this.get("height"))clearInterval(this._interval),delete this._interval;else{try{this._errCount=0,a=e(this.iframe)+"px"}catch(b){this._errCount=(this._errCount||0)+1,this._errCount>=6&&(a=this.get("initialHeight"),clearInterval(this._interval),delete this._interval)}this.contentElement.css("height",a),this.element[0].className=this.element[0].className}},_ajaxHtml:function(){var a=this;this.contentElement.css("height",this.get("initialHeight")),this.contentElement.load(this.get("content"),function(){a._setPosition(),a.contentElement.css("height",""),a.trigger("complete:show")})}});c.exports=k,c.exports.outerBoxClass="arale-dialog-1_3_1"}),define("arale/dialog/1.3.1/dialog.handlebars",["gallery/handlebars/1.0.2/runtime"],function(a,b,c){var d=a("gallery/handlebars/1.0.2/runtime"),e=d.template;c.exports=e(function(a,b,c,d,e){this.compilerInfo=[3,">= 1.0.0-rc.4"],c=c||{};for(var f in a.helpers)c[f]=c[f]||a.helpers[f];e=e||{};var g,h="",i="function",j=this.escapeExpression;return h+='<div class="',(g=c.classPrefix)?g=g.call(b,{hash:{},data:e}):(g=b.classPrefix,g=typeof g===i?g.apply(b):g),h+=j(g)+'">\n    <a class="',(g=c.classPrefix)?g=g.call(b,{hash:{},data:e}):(g=b.classPrefix,g=typeof g===i?g.apply(b):g),h+=j(g)+'-close" title="Close" href="javascript:;" data-role="close"></a>\n    <div class="',(g=c.classPrefix)?g=g.call(b,{hash:{},data:e}):(g=b.classPrefix,g=typeof g===i?g.apply(b):g),h+=j(g)+'-content" data-role="content"></div>\n</div>\n'})});
  