/**
 * @copyright  (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */((n,s)=>{const i=()=>{window.removeEventListener("load",i);const c=n.querySelectorAll(".system-counter");c.length&&c.forEach(e=>{const a=e.getAttribute("data-url");a&&s&&s.request&&typeof s.request=="function"&&s.enqueueRequest({url:a,method:"POST",promise:!0}).then(o=>{const d=o.responseText;let t;try{t=JSON.parse(d)}catch{throw new Error("Failed to parse JSON")}if(t.error||!t.success)e.classList.remove("icon-spin","icon-spinner"),e.classList.add("text-danger","icon-remove");else if(t.data){const r=n.createElement("span");r.classList.add("float-end","badge","bg-warning","text-dark"),r.innerHTML=s.sanitizeHtml(t.data),e.parentNode.replaceChild(r,e)}else e.classList.remove("icon-spin","icon-spinner"),e.classList.add("icon-check","text-success")}).catch(()=>{e.classList.remove("icon-spin","icon-spinner"),e.classList.add("text-danger","icon-remove")})})};window.addEventListener("load",()=>{setTimeout(i,300)})})(document,Joomla);
