/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @since 3.5.0
*/Joomla=window.Joomla||{},((o,t)=>{const i={input:["type","name","value"],"joomla-alert":["type","dismiss","role"],button:["type"],table:[],tbody:[],thead:[],caption:[],th:["scope"],tr:[],td:[]},c=a=>{const s=t.getElementById("system-message-container").querySelector(".js-pstats-alert");t.addEventListener("click",e=>{e.target.classList.contains("js-pstats-btn-allow-always")&&(e.preventDefault(),s.close(),a({plugin:"sendAlways"}))}),t.addEventListener("click",e=>{e.target.classList.contains("js-pstats-btn-allow-never")&&(e.preventDefault(),s.close(),a({plugin:"sendNever"}))})},r=({plugin:a="sendStats"}={})=>{const l=`index.php?option=com_ajax&group=system&plugin=${a}&format=raw`,s=t.getElementById("system-message-container");o.request({url:l,headers:{"Content-Type":"application/json"},onSuccess:e=>{try{const n=JSON.parse(e);n&&n.html&&(s.insertAdjacentHTML("beforeend",o.sanitizeHtml(n.html,i)),s.querySelector(".js-pstats-alert").classList.remove("hidden"),c(r))}catch(n){throw new Error(n)}},onError:e=>{o.renderMessages({error:[e.response]})}})};t.addEventListener("DOMContentLoaded",()=>{r()})})(Joomla,document);