!function(t){formintorjs.define(["text!tpl/dashboard.html"],function(e){return Backbone.View.extend({className:"wpmudev-section--popup",popupTpl:Forminator.Utils.template(t(e).find("#forminator-create-appearance-preset-tpl").html()),events:{"click #forminator-create-preset":"createPreset","keydown #forminator-preset-name":"toggleButton"},initialize:function(t){this.nonce=t.nonce,this.title=t.title,this.content=t.content,this.$target=t.$target},render:function(){var t=this.$target.data("modal-preset-form-label"),e=this.$target.data("modal-preset-loading-text"),a=this.$target.data("modal-preset-name-label"),o=this.$target.data("modal-preset-name-placeholder");this.$el.html(this.popupTpl({title:this.title,content:this.content,formLabel:t,loadingText:e,nameLabel:a,namePlaceholder:o}))},toggleButton:function(e){setTimeout(function(){var a=t(e.currentTarget).val().trim();t("#forminator-create-preset").prop("disabled",!a)},300)},createPreset:function(e){e.preventDefault(),e.stopImmediatePropagation();var a=t(e.target);a.addClass("sui-button-onload-text");var o=this.$el.find('select[name="form_id"]').val(),r=this.$el.find("#forminator-preset-name").val(),n={action:"forminator_create_appearance_preset",_ajax_nonce:this.nonce,form_id:o,name:r};return t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:n,success:function(t){t&&t.success?Forminator.openPreset(t.data):(Forminator.Notification.open("error",t.data,4e3),a.removeClass("sui-button-onload-text"))},error:function(t){Forminator.Notification.open("error",t.data,4e3),a.removeClass("sui-button-onload-text")}}),!1}})})}(jQuery);