(t=>{"function"==typeof define&&define.amd?define("dialog",t):t()})(function(){MyListing.Dialog=function(t){var i=this;this.visible=!1,i.args=jQuery.extend({message:"",status:"info",dismissable:!0,spinner:!1,timeout:3e3},t),i.show(),i.setTimeout()},MyListing.Dialog.prototype.draw=function(){this.template=jQuery(jQuery("#mylisting-dialog-template").text()),this.template.addClass(this.args.status),this.insertContent(),this.template.appendTo("body")},MyListing.Dialog.prototype.refresh=function(t){this.args=jQuery.extend(this.args,t),this.setTimeout(),this.insertContent()},MyListing.Dialog.prototype.insertContent=function(){var i=this;this.template.find(".mylisting-dialog--message").html(this.args.message),this.template.find(".mylisting-dialog--dismiss")[this.args.dismissable?"removeClass":"addClass"]("hide").click(function(t){t.preventDefault(),i.hide()}),this.template.find(".mylisting-dialog--loading")[this.args.spinner?"removeClass":"addClass"]("hide")},MyListing.Dialog.prototype.setTimeout=function(){var t=this;t.timeout&&clearTimeout(t.timeout),!isNaN(t.args.timeout)&&0<t.args.timeout&&(t.timeout=setTimeout(function(){t.hide()},t.args.timeout))},MyListing.Dialog.prototype.show=function(){var t=this;t.draw(),setTimeout(function(){t.template.addClass("slide-in"),t.visible=!0},15)},MyListing.Dialog.prototype.hide=function(){var t=this;t.template.removeClass("slide-in").addClass("slide-out"),setTimeout(function(){t.template.remove(),t.visible=!1},250)}});
