/*! This file is auto-generated */ jQuery(function(o){var a,l=wp.i18n.__,n=wp.i18n._n,r=wp.i18n.sprintf,i=new ClipboardJS(".site-health-copy-buttons .copy-button"),c=o(".health-check-body.health-check-status-tab").length,e=o(".health-check-body.health-check-debug-tab").length,h=o("#health-check-accordion-block-wp-paths-sizes");function d(e){var t,s,a=wp.template("health-check-issue"),i=o("#health-check-issues-"+e.status);!function(e){var t,s,a,i,n={test:"string",label:"string",description:"string"},o=!0;if("object"==typeof e){for(t in n)if("object"==typeof(s=n[t]))for(a in s)i=s[a],void 0!==e[t]&&void 0!==e[t][a]&&i===typeof e[t][a]||(o=!1);else void 0!==e[t]&&s===typeof e[t]||(o=!1);return o}}(e)||(SiteHealth.site_status.issues[e.status]++,s=SiteHealth.site_status.issues[e.status],void 0===e.test&&(e.test=e.status+s),"critical"===e.status?t=r(n("%s critical issue","%s critical issues",s),''+s+""):"recommended"===e.status?t=r(n("%s recommended improvement","%s recommended improvements",s),''+s+""):"good"===e.status&&(t=r(n("%s item with no issues detected","%s items with no issues detected",s),''+s+"")),t&&o(".site-health-issue-count-title",i).html(t),o(".issues","#health-check-issues-"+e.status).append(a(e)))}function u(){var e=o(".site-health-progress"),t=e.closest(".site-health-progress-wrapper"),s=o(".site-health-progress-label",t),a=o(".site-health-progress svg #bar"),i=parseInt(SiteHealth.site_status.issues.good,0)+parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),n=.5*parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),n=100-Math.ceil(n/i*100);0!==i?(t.removeClass("loading"),i=a.attr("r"),i=Math.PI*(2*i),a.css({strokeDashoffset:(100-(n=100<(n=n<0?0:n)?100:n))/100*i+"px"}),parseInt(SiteHealth.site_status.issues.critical,0)<1&&o("#health-check-issues-critical").addClass("hidden"),parseInt(SiteHealth.site_status.issues.recommended,0)<1&&o("#health-check-issues-recommended").addClass("hidden"),80<=n&&0===parseInt(SiteHealth.site_status.issues.critical,0)?(t.addClass("green").removeClass("orange"),s.text(l("Good")),wp.a11y.speak(l("All site health tests have finished running. Your site is looking good, and the results are now available on the page."))):(t.addClass("orange").removeClass("green"),s.text(l("Should be improved")),wp.a11y.speak(l("All site health tests have finished running. There are items that should be addressed, and the results are now available on the page."))),c&&(o.post(ajaxurl,{action:"health-check-site-status-result",_wpnonce:SiteHealth.nonce.site_status_result,counts:SiteHealth.site_status.issues}),100===n&&(o(".site-status-all-clear").removeClass("hide"),o(".site-status-has-issues").addClass("hide")))):e.addClass("hidden")}function p(e,t){t={status:"recommended",label:l("A test is unavailable"),badge:{color:"red",label:l("Unavailable")},description:"

"+e+"

"+t+"

",actions:""};d(wp.hooks.applyFilters("site_status_test_result",t))}function t(){var t=(new Date).getTime(),s=window.setTimeout(function(){wp.a11y.speak(l("Please wait..."))},3e3);wp.apiRequest({path:"/wp-site-health/v1/directory-sizes"}).done(function(e){var a,s;a=e||{},e=o("button.button.copy-button"),s=e.attr("data-clipboard-text"),o.each(a,function(e,t){t=t.debug||t.size;void 0!==t&&(s=s.replace(e+": loading...",e+": "+t))}),e.attr("data-clipboard-text",s),h.find("td[class]").each(function(e,t){var s=o(t),t=s.attr("class");a.hasOwnProperty(t)&&a[t].size&&s.text(a[t].size)})}).always(function(){var e=(new Date).getTime()-t;o(".health-check-wp-paths-sizes.spinner").css("visibility","hidden"),u(),3e3