//>>built
define("mill/sizeableDialog",["dijit/_Widget","dijit/_Templated","dijit/Dialog","dojox/layout/ResizeHandle"],function(){dojo.declare("mill.sizeableDialog",[dijit.Dialog],{sizeable:"xy",userSize:null,_sizeDifferences:null,_startupResize:function(){var a=dojo._getMarginSize(this.domNode),d=dojo._getMarginSize(this.containerNode);this._sizeDifferences={dh:a.h-d.h,dw:a.w-d.w};this.userSize&&(dojo.style(this.domNode,this.userSize),this._onResize(),this._position());this._resizeHandle||(d=document.createElement("div"),
this.domNode.appendChild(d),this._resizeHandle=new dojox.layout.ResizeHandle({targetId:this.id,resizeAxis:this.sizeable,activeResize:!0,intermediateChanges:!1,minHeight:a.h,minWidth:a.w,onResize:dojo.hitch(this,function(){setTimeout(dojo.hitch(this,function(){this._onResize()}),1)})},d),this._resizeHandle.startup())},postCreate:function(){this.inherited(arguments);this.domNode.style.top="-1800px";this.containerNode.style.padding="0"},_resizeHandle:null,_onResize:function(){this.userSize={height:this.domNode.style.height,
width:this.domNode.style.width};var a=dojo._getMarginSize(this.domNode);dojo.style(this.containerNode,{height:a.h-this._sizeDifferences.dh+"px",width:a.w-this._sizeDifferences.dw+"px"});a=[];for(var d=0;d<this.containerNode.childNodes.length;d++){var c=this.containerNode.childNodes[d];c.style&&(dojo.style(c,{height:this.containerNode.style.height,width:this.containerNode.style.width}),(c=dijit.byNode(c))&&c.layout&&a.push(c))}a.length&&dojo.forEach(a,function(b){b.resize()})},_lastGoodMarginBox:null,
_size:function(){if(this.sizeable){this._checkIfSingleChild();this._singleChild?(this._singleChildOriginalStyle&&(this._singleChild.domNode.style.cssText=this._singleChildOriginalStyle),delete this._singleChildOriginalStyle):dojo.style(this.containerNode,{width:"auto",height:"auto"});var a=dojo._getContentBox(this.domNode),d=dojo.window.getBox(),c=dojo._getContentBox((this._singleChild?this._singleChild.domNode:null)||this.containerNode);d.w=d.w-(a.w-c.w)-3;d.h=d.h-(a.h-c.h)-3;1*a.w>=d.w||1*a.h>=
d.h?(this._lastGoodMarginBox||(this._lastGoodMarginBox={width:a.w+"px",height:a.h+"px"}),c=Math.min(1*a.w,Math.floor(d.w)),a=Math.min(1*a.h,Math.floor(d.h)),this._singleChild&&this._singleChild.resize?(this._singleChildOriginalStyle=this._singleChild.domNode.style.cssText,this._singleChild.resize({w:c/1,h:a/1}),dojo.style(this.containerNode,{width:"auto",height:"auto"}),dojo.style(this.domNode,{width:"auto",height:"auto"})):dojo.style(this.containerNode,{width:c/1+"px",height:a/1+"px"})):(this._lastGoodMarginBox&&
(dojo.style(this.domNode,this._lastGoodMarginBox),this._lastGoodMarginBox=null),this._singleChild&&this._singleChild.resize&&this._singleChild.resize())}},_position:function(){if(!dojo.hasClass(dojo.body(),"dojoMove")){var a=!1,d=this.domNode,c=dojo.window.getBox(),b=this._relativePosition,e=b?null:dojo.marginBox(d),f=Math.floor(c.l+(b?b.x:(c.w-1*e.w)/2));b=Math.floor(c.t+(b?b.y:(c.h-1*e.h)/2));if(0>f||0>b||this._lastGoodMarginBox){this._lastGoodMarginBox&&(dojo.style(this.domNode,this._lastGoodMarginBox),
this._lastGoodMarginBox=null);this._size();if(b=this._relativePosition)0>b.x&&(b.x=0),0>b.y&&(b.y=0),b.w>c.w&&(b.w=c.w,a=!0),b.h>c.h&&(b.h=c.h,a=!0),this._relativePosition=b;e=b?null:dojo.marginBox(d);a&&dojo.style(d,{width:(b?b.w:e.w)+"px",height:(b?b.h:e.h)+"px"});f=Math.floor(c.l+(b?b.x:(c.w-1*e.w)/2));b=Math.floor(c.t+(b?b.y:(c.h-1*e.h)/2))}dojo.style(d,{left:f/1+"px",top:b/1+"px"});a||dojo.style(d,{width:"auto",height:"auto"})}},show:function(){var a=new dojo.DeferredList([this.inherited(arguments)]);
this.sizeable&&this._startupResize();return a}})});