!function(o,i){"use strict";!function(){o(document).ready(function(){s.init()})}();var s={init:function(){o("body").addClass("sui-forminator-scgen "+forminatorScgenData.suiVersion),SUI.suiTabs(),this.init_select2(),o("#forminator-scgen-modal").show(),o(document).on("click","#forminator-generate-shortcode",this.open_modal),o(document).on("click",".sui-dialog .sui-dialog-close",this.close_modal),o(document).on("click",".sui-dialog-overlay",this.close_modal),o(document).on("click",".wpmudev-insert-cform",this.insert_form),o(document).on("click",".wpmudev-insert-poll",this.insert_poll),o(document).on("click",".wpmudev-insert-quiz",this.insert_quiz)},init_select2:function(){setTimeout(function(){o("#forminator-scgen-modal .sui-select").SUIselect2({dropdownCssClass:"sui-select-dropdown"})},10)},open_modal:function(o){SUI.openModal("forminator-popup",o.target,void 0,!1,!0)},close_modal:function(){SUI.dialogs["forminator-popup"].hide(),setTimeout(function(){o("#forminator-popup").find(".sui-tabs .sui-form-field").removeClass("sui-form-field-error"),o("#forminator-popup").find(".sui-tabs .sui-form-field .sui-error-message").hide()},1e3)},insert_form:function(i){var e=o(this),r=e.closest(".fui-simulate-footer").parent("div"),t=r.find(".sui-form-field"),n=e.closest(".sui-tabs").find(".sui-form-field"),u=o(".forminator-custom-form-list").val();e.addClass("sui-button-onload"),setTimeout(function(){e.removeClass("sui-button-onload"),u?(n.removeClass("sui-form-field-error"),n.find(".sui-error-message").hide(),s.insert_shortcode("forminator_form",u)):(t.addClass("sui-form-field-error"),t.find(".sui-error-message").show())},500),i.preventDefault(),i.stopPropagation()},insert_poll:function(i){var e=o(this),r=e.closest(".fui-simulate-footer").parent("div"),t=r.find(".sui-form-field"),n=e.closest(".sui-tabs").find(".sui-form-field"),u=o(".forminator-insert-poll").val();e.addClass("sui-button-onload"),setTimeout(function(){e.removeClass("sui-button-onload"),u?(n.removeClass("sui-form-field-error"),n.find(".sui-error-message").hide(),s.insert_shortcode("forminator_poll",u)):(t.addClass("sui-form-field-error"),t.find(".sui-error-message").show())},500),i.preventDefault(),i.stopPropagation()},insert_quiz:function(i){var e=o(this),r=e.closest(".fui-simulate-footer").parent("div"),t=r.find(".sui-form-field"),n=e.closest(".sui-tabs").find(".sui-form-field"),u=o(".forminator-quiz-list").val();e.addClass("sui-button-onload"),setTimeout(function(){e.removeClass("sui-button-onload"),u?(n.removeClass("sui-form-field-error"),n.find(".sui-error-message").hide(),s.insert_shortcode("forminator_quiz",u)):(t.addClass("sui-form-field-error"),t.find(".sui-error-message").show())},500),i.preventDefault(),i.stopPropagation()},insert_shortcode:function(o,i){var s="["+o+' id="'+i+'"]';window.parent.send_to_editor(s),SUI.closeModal()}}}(jQuery,document);