!function(){var t;t=jQuery,Craft.FindAndReplaceUtility=Garnish.Base.extend({$trigger:null,$form:null,init:function(r){this.$form=t("#"+r),this.$trigger=t("input.submit",this.$form),this.$status=t(".utility-status",this.$form),this.addListener(this.$form,"submit","onSubmit")},onSubmit:function(r){var s=this;r.preventDefault(),this.$trigger.hasClass("disabled")||(this.progressBar?this.progressBar.resetProgressBar():this.progressBar=new Craft.ProgressBar(this.$status),this.progressBar.$progressBar.removeClass("hidden"),this.progressBar.$progressBar.velocity("stop").velocity({opacity:1},{complete:function(){var r=Garnish.getPostData(s.$form),e=Craft.expandPostArray(r),i={params:e};Craft.postActionRequest(e.action,i,(function(t,r){t&&t.error&&alert(t.error),s.updateProgressBar(),setTimeout(s.onComplete.bind(s),300)}),{complete:t.noop})}}),this.$allDone&&this.$allDone.css("opacity",0),this.$trigger.addClass("disabled"),this.$trigger.trigger("blur"))},updateProgressBar:function(){this.progressBar.setProgressPercentage(100)},onComplete:function(){var r=this;this.$allDone||(this.$allDone=t('<div class="alldone" data-icon="done" />').appendTo(this.$status),this.$allDone.css("opacity",0)),this.progressBar.$progressBar.velocity({opacity:0},{duration:"fast",complete:function(){r.$allDone.velocity({opacity:1},{duration:"fast"}),r.$trigger.removeClass("disabled"),r.$trigger.trigger("focus")}}),Craft.cp.trackJobProgress(!1,!0)}})}();
//# sourceMappingURL=FindAndReplaceUtility.js.map