const WPFormsWPCode=window.WPFormsWPCode||function(t){const o={spinnerBlue:'',spinnerWhite:'',snippetSearch:null,init(){t(o.ready)},ready(){o.snippetSearch=new List("wpforms-wpcode-snippets-list",{valueNames:["wpforms-wpcode-snippet-title"]}),o.events()},events(){t(".wpforms-wpcode-snippet-button").on("click",o.installSnippet),t(".wpforms-wpcode-popup-button").on("click",o.installPlugin),t("#wpforms-wpcode-snippet-search").on("keyup search",function(){o.searchSnippet(this)})},installSnippet(){var n,i=t(this);"edit"!==i.data("action")&&(n=i.width(),i.prev(".wpforms-wpcode-snippet-badge").addClass("wpforms-wpcode-installing-in-progress").text(wpformsWpcodeVars.installing_text),i.width(n).html(o.spinnerBlue))},searchSnippet(n){var n=t(n).val(),n=o.snippetSearch.search(n),i=t("#wpforms-wpcode-no-results");0===n.length?i.show():i.hide()},installPlugin(){var n,i,e,s=t(this);s.hasClass("disabled")||(e=s.attr("data-action"),n=s.attr("data-plugin"),i=JSON.stringify({overwrite_package:!0}),e="activate"===e?"wpforms_activate_addon":"wpforms_install_addon",s.width(s.width()).html(o.spinnerWhite).addClass("disabled"),s={action:e,nonce:wpforms_admin.nonce,plugin:n,args:i,type:"plugin"},t.post(wpforms_admin.ajax_url,s).done(function(){location.reload()}))}};return o}((document,window,jQuery));WPFormsWPCode.init();