var updraft_restore_screen=!0;jQuery(function(p){var n,d,u,l=p("#updraftplus_ajax_restore_job_id").val(),e=p("#updraftplus_ajax_restore_action").val(),i=0,c=p("#updraftplus_ajax_restore_output"),_=p(".updraft_restore_components_list"),r=!1,f=0,g=0;function h(e,t){var r=new XMLHttpRequest,e="action="+t+"&updraftplus_ajax_restore=do_ajax_restore&job_id="+e,o=("updraft_ajaxrestore"===t&&(e+="&nonce="+updraft_credentialtest_nonce),0),n=!0,d=p("#updraftplus_ajax_restore_debug").length;r.open("POST",ajaxurl,!0),r.onprogress=function(e){if(200<=e.currentTarget.status&&e.currentTarget.status<300){if(-1!==e.currentTarget.responseText.indexOf(""+e.data.fileindex+"").replace("%s2",""+e.data.total_files+"")),"db"==e.stage&&e.data.hasOwnProperty("stage")&&("table"==e.data.stage?t.find(".updraft_component--progress").html(" — "+updraftlion.restore_db_table_progress.replace("%s",""+e.data.table+"")):"stored_routine"==e.data.stage?t.find(".updraft_component--progress").html(" — "+updraftlion.restore_db_stored_routine_progress.replace("%s",""+e.data.routine_name+"")):"finished"==e.data.stage?t.find(".updraft_component--progress").html(" — "+updraftlion.finished):"begun"==e.data.stage&&t.find(".updraft_component--progress").html(" — "+updraftlion.begun+"...")),d!==u&&(d&&((r=_.find("[data-component="+d+"]")).find(".updraft_component--progress").html(""),r.removeClass("active").addClass("done")),"finished"==u?(t.addClass("done"),_.find("[data-component]").each(function(e,t){($el=p(t)).is(".done")||$el.addClass("error")}),e.data.hasOwnProperty("actions")&&"object"==typeof e.data.actions&&(r=e.data.urls,a=function(e){p.isEmptyObject(e)||(p(".updraft_restore_result").before(updraftlion.ajax_restore_404_detected),p.each(e,function(e,t){p(".updraft_missing_pages").append("
  • "+t+"
  • ")}))},s=[],o=[],p.each(r,function(e,t){var r=p.Deferred(),a=(o.push(r.promise()),new XMLHttpRequest);a.onreadystatechange=function(){4==this.readyState&&(404==this.status&&s.push(t),r.resolve())},a.open("GET",t,!0),a.send(null)}),p.when.apply(p,o).done(function(){a(s)}),p.each(e.data.actions,function(e,t){_.after(''+e+"")}))):t.addClass("active")),d=u)}p("#updraft-restore-hidethis").remove(),h(l,e),p("#updraftplus_ajax_restore_progress").on("click","#updraft_restore_resume",function(e){e.preventDefault(),p("#updraftplus_ajax_restore_progress").slideUp(1e3,function(){p(this).remove()}),h(l,"updraft_ajaxrestore_continue")}),p(document).on("heartbeat-tick",function(e,t){t.hasOwnProperty("wp-auth-check")&&(t["wp-auth-check"]?(r&&t["wp-auth-check"]&&(i=Math.round(Date.now()/1e3),r=!1),t.hasOwnProperty("updraftplus")&&(t=t.updraftplus).hasOwnProperty("updraft_credentialtest_nonce")&&(updraft_credentialtest_nonce=t.updraft_credentialtest_nonce,i=Math.round(Date.now()/1e3))):r=!0)})});