!function(){function e(){var e=localStorage.getItem("aaeReactionsPosts");return e?JSON.parse(e):[]}var t=function(t){var n=e();if(t.length){var a=t[0].querySelectorAll(".aaeaddon-reaction-btn");a.forEach((function(t){n.includes(WCF_ADDONS_JS.post_id)&&(t.disabled=!0),t.addEventListener("click",(function(){var n=t.dataset.rtype;t.disabled=!0,fetch(WCF_ADDONS_JS.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"aaeaddon_post_reaction",reaction:n,post_id:WCF_ADDONS_JS.post_id,nonce:WCF_ADDONS_JS._wpnonce})}).then((function(e){return e.json()})).then((function(o){o.success?(t.querySelector(".aae-reaction-count")&&(t.querySelector(".aae-reaction-count").textContent=o.data[n]),t.disabled=!0,function(t){var n=e();n.includes(t)||(n.push(t),localStorage.setItem("aaeReactionsPosts",JSON.stringify(n)))}(WCF_ADDONS_JS.post_id),function(t){var n=e();t.forEach((function(e){n.includes(WCF_ADDONS_JS.post_id)&&(e.disabled=!0)}))}(a)):(t.textContent="Try Again",t.disabled=!1)})).catch((function(){t.disabled=!1,t.textContent="Retry"}))}))}))}};window.addEventListener("elementor/frontend/init",(function(){elementorFrontend.hooks.addAction("frontend/element_ready/aaeaddon-post-reactions.default",t)}))}();