(()=>{var e={1669:e=>{"use strict";e.exports=jQuery}},t={};function r(o){var d=t[o];if(void 0!==d)return d.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,r),i.exports}var o=r(1669),d=r(1669),i={init:function(){this.submit()},submit:function(){const e=this;o(".edd-import-form").ajaxForm({beforeSubmit:e.before_submit,success:e.success,complete:e.complete,dataType:"json",error:e.error})},before_submit:function(e,t,r){if(t.find(".notice-wrap").remove(),t.append('<div class="notice-wrap"><div class="edd-progress"><div></div></div></div>'),!(window.File&&window.FileReader&&window.FileList&&window.Blob)){const e=o(".edd-import-form").find(".edd-progress").parent().parent(),t=e.find(".notice-wrap");return e.find(".button:disabled").attr("disabled",!1),t.html('<div class="update error"><p>'+edd_vars.unsupported_browser+"</p></div>"),!1}},success:function(e,t,r,o){},complete:function(e){const t=o(this),r=d.parseJSON(e.responseText);if(r.success){const e=o(".edd-import-form .notice-wrap").parent();e.find(".edd-import-file-wrap,.notice-wrap").remove(),e.find(".edd-import-options").slideDown();let d=e.find("select.edd-import-csv-column"),n=(d.parents("tr").first(),""),s=r.data.columns.sort((function(e,t){return e<t?-1:e>t?1:0}));o.each(s,(function(e,t){n+='<option value="'+t+'">'+t+"</option>"})),d.append(n),d.on("change",(function(){const e=o(this).val();e&&!1!==r.data.first_row[e]?o(this).parent().next().html(r.data.first_row[e]):o(this).parent().next().html("")})),o.each(d,(function(){o(this).val(o(this).attr("data-field")).change()})),o(document.body).on("click",".edd-import-proceed",(function(o){o.preventDefault(),e.find(".edd-import-proceed.button-primary").addClass("updating-message"),e.append('<div class="notice-wrap"><div class="edd-progress"><div></div></div></div>'),r.data.mapping=e.serialize(),i.process_step(1,r.data,t)}))}else i.error(e)},error:function(e){const t=d.parseJSON(e.responseText),r=o(".edd-import-form").find(".edd-progress").parent().parent(),i=r.find(".notice-wrap");r.find(".button:disabled").attr("disabled",!1),t.data.error?i.html('<div class="update error"><p>'+t.data.error+"</p></div>"):i.remove()},process_step:function(e,t,r){o.ajax({type:"POST",url:ajaxurl,data:{form:t.form,nonce:t.nonce,class:t.class,upload:t.upload,mapping:t.mapping,action:"edd_do_ajax_import",step:e},dataType:"json",success:function(e){if("done"===e.data.step||e.data.error){const t=o(".edd-import-form").find(".edd-progress").parent().parent(),r=t.find(".notice-wrap");t.find(".button:disabled").attr("disabled",!1),e.data.error?r.html('<div class="update error"><p>'+e.data.error+"</p></div>"):(t.find(".edd-import-options").hide(),o("html, body").animate({scrollTop:t.parent().offset().top},500),r.html('<div class="updated"><p>'+e.data.message+"</p></div>"))}else o(".edd-progress div").animate({width:e.data.percentage+"%"},50,(function(){})),i.process_step(parseInt(e.data.step),t,r)}}).fail((function(e){window.console&&window.console.log&&console.log(e)}))}};d(document).ready((function(e){i.init()}))})();