(()=>{var s={669:e=>{"use strict";e.exports=jQuery}},o={};var p,e,h,r=function e(r){var t=o[r];if(void 0!==t)return t.exports;t=o[r]={exports:{}};return s[r](t,t.exports,e),t.exports}(669);p=r,e=document,h=envira_gallery_convert,p(function(){p(e).on("click",".convert-envira-gallery-tab-btn",function(e){var c,d,v,r,t;e.preventDefault(),window.confirm(h.bulk_confirmation_alert)&&(p(".envira-posttype-dropdown-error").hide(),p(".envira-convert-gallery-message").html("").removeClass("success error").hide(),p(".envira-convert-process-logs").html("").hide(),e=(c=p(this)).attr("data-converting"),d=c.attr("title"),(r=(v=p("#envira_convert_post_types_dropdown")).val())?((t=new FormData).append("selected_posttype",r),v.attr("disabled",!0),c.attr("disabled",!0),c.html(e),fetch(h.bulk_convert_rest_url,{method:"POST",body:t,headers:{"X-WP-Nonce":h.gallery_convert_rest_nonce}}).then(function(e){return e.json()}).then(function(e){var o,r,n,a,l,i;e.posts?(o=function(){var e=Math.round(l/a*100);p(".envira-convert-progress-bar").css("width",e+"%"),p(".envira-convert-progress-counts").html(e+"%")},r=function t(){var s,e;l<a?(s=n[l],(e=new FormData).append("post_id",s),fetch(h.process_item_rest_url,{method:"POST",body:e,headers:{"X-WP-Nonce":h.gallery_convert_rest_nonce}}).then(function(e){return e.json()}).then(function(e){var r;e.error&&(r="",e.edit_url&&(r=' (<a target="_blank" href="'+e.edit_url+'" target="_blank">'+h.edit_post_text+"</a>)"),0===i&&p(".envira-convert-process-logs").show().append("<p><strong>"+h.failed_conversion_logs+"</strong></p>"),p(".envira-convert-process-logs").show().append("<p><strong>"+h.post_id_text+" "+s+r+"</strong>: "+e.error+"</p>"),i++),l++,o(),t()}).catch(function(e){p(".envira-convert-gallery-message").addClass("error").html(e).show()})):(o(),p(".envira-convert-gallery-message").addClass("success").html(h.conversion_completed).show(),v.attr("disabled",!1),c.attr("disabled",!1),c.html(d))},n=e.posts,a=n.length,i=l=0,p(".envira-convert-gallery-message").addClass("success").html(h.bulk_conversion_started).show(),p(".envira-convert-process-logs").show().html("<p><strong>"+a+" "+h.found_posts_text+'</strong></p><div class="envira-convert-progress-bar-container"><div class="envira-convert-progress-bar"></div></div><div class="envira-convert-progress-counts"></div>'),o(),r()):(v.attr("disabled",!1),c.attr("disabled",!1),c.html(d),p(".envira-convert-gallery-message").addClass("error").html(e.message).show())}).catch(function(e){v.attr("disabled",!1),c.attr("disabled",!1),c.html(d),p(".envira-convert-gallery-message").addClass("error").html(e).show()}).finally(function(){v.attr("disabled",!1),c.attr("disabled",!1),c.html(d)})):p(".envira-posttype-dropdown-error").show())})})})();