!function(){var a;a=jQuery,Craft.ClearCachesUtility=Garnish.Base.extend({init:function(t){for(var e=this,s=a("form.utility"),r=function(){var a=s.eq(n),t=a.find("input[type=checkbox]"),r=a.find(".btn"),i=function(){t.filter(":checked").length?r.removeClass("disabled"):r.addClass("disabled")};t.on("change",i),i(),e.addListener(a,"submit",(function(a){a.preventDefault(),r.hasClass("disabled")||e.onSubmit(a)}))},n=0;n<s.length;n++)r()},onSubmit:function(t){var e,s,r=a(t.currentTarget),n=r.find("button.submit"),i=r.find(".utility-status");n.hasClass("disabled")||(r.data("progressBar")?((e=r.data("progressBar")).resetProgressBar(),s=r.data("allDone")):(e=new Craft.ProgressBar(i),r.data("progressBar",e)),e.showProgressBar(),e.$progressBar.velocity("stop").velocity({opacity:1},{complete:function(){var t=Garnish.getPostData(r),o=Craft.expandPostArray(t);Craft.sendActionRequest("POST",o.action,{data:o}).then((function(t){e.setProgressPercentage(100),setTimeout((function(){s||((s=a('<div class="alldone" data-icon="done" />').appendTo(i)).css("opacity",0),r.data("allDone",s)),e.hideProgressBar(),s.velocity({opacity:1},{duration:"fast"}),Craft.cp.announce(Craft.t("app","Success")),n.removeClass("disabled"),n.focus()}),300)})).catch((function(a){var t=a.response;Craft.cp.displayError(t.data.message)}))}}),s&&s.css("opacity",0),n.addClass("disabled"),n.trigger("blur"))}})}();
//# sourceMappingURL=ClearCachesUtility.js.map