!function(factory){"use strict";"function"==typeof define&&define.amd?define(["jquery","./button","./draggable","./mouse","./resizable","../focusable","../keycode","../position","../safe-active-element","../safe-blur","../tabbable","../unique-id","../version","../widget"],factory):factory(jQuery)}(function($){"use strict";return $.widget("ui.dialog",{version:"1.13.1",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(pos){var topOffset=$(this).css(pos).offset().top;topOffset<0&&$(this).css("top",pos.top-topOffset)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&$.fn.draggable&&this._makeDraggable(),this.options.resizable&&$.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var element=this.options.appendTo;return element&&(element.jquery||element.nodeType)?$(element):this.document.find(element||"body").eq(0)},_destroy:function(){var next,originalPosition=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),(next=originalPosition.parent.children().eq(originalPosition.index)).length&&next[0]!==this.element[0]?next.before(this.element):originalPosition.parent.append(this.element)},widget:function(){return this.uiDialog},disable:$.noop,enable:$.noop,close:function(event){var that=this;this._isOpen&&!1!==this._trigger("beforeClose",event)&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||$.ui.safeBlur($.ui.safeActiveElement(this.document[0])),this._hide(this.uiDialog,this.options.hide,function(){that._trigger("close",event)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(event,silent){var moved=!1,zIndices=this.uiDialog.siblings(".ui-front:visible").map(function(){return+$(this).css("z-index")}).get(),zIndices=Math.max.apply(null,zIndices);return zIndices>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",zIndices+1),moved=!0),moved&&!silent&&this._trigger("focus",event),moved},open:function(){var that=this;this._isOpen?this._moveToTop()&&this._focusTabbable():(this._isOpen=!0,this.opener=$($.ui.safeActiveElement(this.document[0])),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){that._focusTabbable(),that._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"))},_focusTabbable:function(){var hasFocus=this._focusedElement;(hasFocus=(hasFocus=(hasFocus=(hasFocus=(hasFocus=hasFocus||this.element.find("[autofocus]")).length?hasFocus:this.element.find(":tabbable")).length?hasFocus:this.uiDialogButtonPane.find(":tabbable")).length?hasFocus:this.uiDialogTitlebarClose.filter(":tabbable")).length?hasFocus:this.uiDialog).eq(0).trigger("focus")},_restoreTabbableFocus:function(){var activeElement=$.ui.safeActiveElement(this.document[0]);this.uiDialog[0]===activeElement||$.contains(this.uiDialog[0],activeElement)||this._focusTabbable()},_keepFocus:function(event){event.preventDefault(),this._restoreTabbableFocus(),this._delay(this._restoreTabbableFocus)},_createWrapper:function(){this.uiDialog=$("