(function(){function e(){let e;let t;let n;if(window.comment_likes_loaded){return}window.comment_likes_loaded=true;const i={};let s;function l(){if(!s){s=new Promise((e,t)=>{if(window.Swipe){e(window.Swipe)}else{const n=document.createElement("script");n.src=comment_like_text.swipeUrl;n.async=true;document.body.appendChild(n);n.addEventListener("load",()=>e(window.Swipe));n.addEventListener("error",e=>t(e))}})}return s}function o(e){const t=e&&e.getAttribute("href")&&e.getAttribute("href").split("like_comment=");return t[1].split("&_wpnonce=")[0]}function c(e,t,n,i){const s=e&&e.getAttribute("href")&&e.getAttribute("href").split("_wpnonce=")[1];fetch("/wp-admin/admin-ajax.php",{method:"POST",body:new URLSearchParams({action:t,_wpnonce:s,like_comment:n,blog_id:Number(e.dataset.blog)}),headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8","X-Requested-With":"XMLHttpRequest",Accept:"application/json","cache-control":"no-cache",pragma:"no-cache"}}).then(e=>e.json()).then(i)}function r(){const e=document.createElement("iframe");e.id="wp-login-polling-iframe";e.src="https://wordpress.com/public.api/connect/?iframe=true";document.body.appendChild(e);e.style.display="none"}function a(){const e=document.querySelector("#wp-login-polling-iframe");if(e){e.remove()}}function d(e){if(e&&e.style){e.style.display="none"}}function m(e){if(e&&e.style){e.style.removeProperty("display")}}class u{constructor(){this.el=document.createElement("div");this.el.classList.add("comment-likes-overlay");document.body.appendChild(this.el);d(this.el);this.el.addEventListener("mouseenter",()=>{p.cancelHide()});this.el.addEventListener("mouseleave",()=>p.requestHide());this.innerEl=null;this.swipe=null;this.hideTimeout=null}clear(){if(this.swipe){this.swipe.kill();this.swipe=null}this.el.innerHTML="";this.innerEl=document.createElement("div");this.innerEl.classList.add("inner");this.el.appendChild(this.innerEl)}getUserBits(e,t,n,i){n=n||0;let s=n+(i||e.length);s=s>e.length?e.length:s;const l=document.createElement("div");l.classList.add("liker-list");let o=`<ul class="${t||""}">`;for(let t=n;t<s;++t){const n=e[t];o+=`
						<li>
							<a rel="nofollow" title="${n.display_name_esc}" href="${n.profile_url_esc}">
								<img src="${n.avatar_url_esc}" alt="${n.display_name_esc}" />
								<span class="user-name">${n.display_name_esc}</span>
							</a>
						</li>
					`}o+="</ul>";l.innerHTML=o;return l}showLikes(e,t){this.clear();e.dataset.likeCount=t.length;if(t.length===0){d(this.el);return}this.innerEl.style.padding="12px";if(t.length<6){this.innerEl.style.maxWidth="200px";this.innerEl.innerHTML="";this.innerEl.appendChild(this.getUserBits(t,"single"));this.setPosition(e)}else if(t.length<11){this.innerEl.innerHTML="";this.innerEl.appendChild(this.getUserBits(t,"double"));this.setPosition(e)}else{this.renderLikesWithPagination(t,e)}}renderLikesWithPagination(e,t){l().then(()=>{const n=Math.ceil(e.length/10);const i=document.createElement("div");i.classList.add("swipe");this.innerEl.appendChild(i);const s=document.createElement("div");s.classList.add("swipe-wrap");i.appendChild(s);for(let t=0;t<n;++t){s.appendChild(this.getUserBits(e,"double",t*10,10))}const l=document.createElement("nav");l.classList.add("slider-nav");let o=`
						<a href="#" class="prev">
							<span class="noticon noticon-previous" title="Previous" alt="<"></span>
						</a>
						<span class="position">
					`;for(let e=0;e<n;++e){o+=`<em data-page="${e}" class="${e===0?"on":""}">&bull;</em>`}o+=`
						</span>
						<a href="#" class="next">
							<span class="noticon noticon-next" title="Next" alt=">"></span>
						</a>
					`;this.innerEl.appendChild(l);l.innerHTML=o;m(this.el);this.setPosition(t);this.swipe=new Swipe(i,{callback:function(e){e=e%n;l.querySelectorAll("em").forEach(t=>{const n=Number(t.dataset.page);t.setAttribute("class",e===n?"on":"")})}});l.querySelectorAll("em").forEach(e=>{e.addEventListener("click",t=>{this.swipe.slide(Number(e.dataset.page));t.preventDefault()})});l.querySelector(".prev").addEventListener("click",e=>{this.swipe.prev();e.preventDefault()});l.querySelector(".next").addEventListener("click",e=>{this.swipe.next();e.preventDefault()})})}showLoadingMessage(e){this.clear();this.innerEl.textContent=comment_like_text.loading;this.setPosition(e)}setPosition(e){const t=document.createElement("span");this.el.appendChild(t);t.classList.add("icon","noticon","noticon-downarrow");t.style.textShadow="0px 1px 1px rgb(223, 223, 223)";const n=e.getBoundingClientRect();const i=document.defaultView;const s={top:n.top+i.scrollY,left:n.left+i.scrollX};m(this.el);let l=s.left-(this.el.offsetWidth-e.offsetWidth)/2;l=l<5?5:l;let o=s.top-this.el.offsetHeight+5;d(this.el);const c=document.querySelector("#wpadminbar");if(o<i.scrollY+(c&&c.offsetHeight||0)){o=s.top+e.offsetHeight;t.remove();this.el.prepend(t);t.classList.remove("noticon-downarrow");t.classList.add("noticon-uparrow");t.style.textShadow="0px -1px 1px rgb(223, 223, 223)";t.style.verticalAlign="bottom"}this.el.style.left=`${l}px`;this.el.style.top=`${o}px`;m(this.el);t.style.marginTop=`${t.scrollHeight-26}px`;t.style.marginBottom=`${20-t.scrollHeight}px`;t.style.paddingLeft=`${s.left-l+(e.offsetWidth-t.scrollWidth)/2}px`}isVisible(){return this.el.style.getPropertyValue("display")!=="none"}requestHide(){if(this.hideTimeout!==null){return}this.hideTimeout=setTimeout(()=>{d(this.el);this.clear()},300)}cancelHide(){if(this.hideTimeout!==null){clearTimeout(this.hideTimeout);this.hideTimeout=null}}}const p=new u;var h;var f=null;function w(e,t){i[t]=null;const n=e&&e.parentElement&&e.parentElement.parentElement;const s=n.querySelector("a.comment-like-link");s&&c(s,"view_comment_likes",t,n=>{i[t]=n;if(p.isVisible()&&h===t){p.showLikes(e,n)}})}function g(e){const t=e+"=";const n=document.cookie.split(";");for(let e=0;e<n.length;e++){let i=n[e];while(i.charAt(0)===" "){i=i.substring(1,i.length)}if(i.indexOf(t)===0){const e=i.substring(t.length,i.length);const n=e.split("&");const s={};for(let e=n.length-1;e>=0;e--){const t=n[e].split("=");s[t[0]]=decodeURIComponent(t[1])}return s}}return null}function k(){const e=g("wpc_wpc");if(e===null||typeof e.access_token==="undefined"||!e.access_token){return false}return e}function y(i){const s=i.data;if(typeof s.event==="undefined"){return}if(s.event==="login"&&s.success){t=setInterval(function(){if(!e||e.closed){clearInterval(t);if(k()){const e=document.createElement("iframe");e.id="wp-login-comment-nonce-iframe";e.style.display="none";e.src=n+"";document.body.appendChild(e);const t=(n+"").split("like_comment=")[1].split("&_wpnonce=")[0];let i;const s=setTimeout(()=>{window.location=n},5e3);const l=setInterval(()=>{const e=document.querySelector("#wp-login-comment-nonce-iframe");if(e){i=e.querySelector(`#comment-like-${t} .comment-like-link`)}if(i&&typeof i.href!=="undefined"){clearTimeout(s);clearInterval(l);window.location=i.href}},100)}}},100);if(e){if(!e.closed){e.close()}e=false}a()}}if(typeof window.postMessage!=="undefined"){window.addEventListener("message",e=>{let t=e&&e.data;if(typeof t==="string"){try{t=JSON.parse(t)}catch(e){return}}const n=t&&t.type;if(n==="loginMessage"){y(t)}})}document.body.addEventListener("click",t=>{let s=t.target;if(s.matches("p.comment-likes a.view-likers")){t.preventDefault();return}const l=s.closest("p.comment-not-liked");if(!s.matches("a.comment-like-link")&&!l){return}if(l){s=l.querySelector("a.comment-like-link");if(!s){return}}if(s.classList.contains("needs-login")){t.preventDefault();n=s;if(e){if(!e.closed){e.close()}e=false}a();const i="https://wordpress.com/public.api/connect/?action=request&service=wordpress";e=window.open(i,"likeconn","status=0,toolbar=0,location=1,menubar=0,directories=0,resizable=1,scrollbars=1,height=560,width=500");r();return false}const d=o(s);s.classList.add("loading");let m=document.querySelector(`p#comment-like-${d}`);const u=m&&m.dataset.liked==="comment-liked"?"unlike_comment":"like_comment";c(s,u,d,e=>{delete i[d];const t=document.querySelector(`#comment-like-count-${e.context}`);if(t){t.innerHTML=e.display}m=document.querySelector(`p#comment-like-${e.context}`);if(u==="like_comment"){m.classList.remove("comment-not-liked");m.classList.add("comment-liked");m.dataset.liked="comment-liked"}else{m.classList.remove("comment-liked");m.classList.add("comment-not-liked");m.dataset.liked="comment-not-liked"}const n=s.closest(".comment-likes");const l=n&&n.querySelector("a.view-likers");if(l){w(l,d)}s.classList.remove("loading")});t.preventDefault();t.stopPropagation()});document.body.addEventListener("mouseenter",function(e){if(!e.target.matches("p.comment-likes a.view-likers")){return}const t=e.target;if(Number(t.dataset.likeCount||0)===0){return}p.cancelHide();const n=t.parentElement&&t.parentElement.parentElement;const s=n&&n.querySelector("a.comment-like-link");const l=s&&o(s);h=l;if(l in i){const e=i[l];if(e!==null){p.showLikes(t,e)}else{p.showLoadingMessage(t)}return}p.showLoadingMessage(t);w(t,l)},true);document.body.addEventListener("mouseleave",e=>{if(!e.target.matches("p.comment-likes a.view-likers")){return}p.requestHide()},true);document.body.addEventListener("mouseenter",e=>{if(!e.target.matches(".comment")||!e.target.querySelector("a.comment-like-link")){return}if(f!==null){clearTimeout(f);f=null}const t=e.target.querySelector("a.comment-like-link");const n=t.closest(".comment-likes");const s=n&&n.querySelector("a.view-likers");if(!s||Number(s.dataset.likeCount||0)===0){return}const l=o(t);if(l in i){return}f=setTimeout(()=>{f=null;if(l in i){return}w(s,l)},1e3)},true)}if(document.readyState!=="loading"){e()}else{document.addEventListener("DOMContentLoaded",e)}})();