!function(d,l){"use strict";l.querySelector&&d.addEventListener&&"undefined"!=typeof URL&&(d.wp=d.wp||{},d.wp.receiveEmbedMessage||(d.wp.receiveEmbedMessage=function(e){var t=e.data;if((t||t.secret||t.message||t.value)&&!/[^a-zA-Z0-9]/.test(t.secret)){for(var s,r,n,a=l.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),o=l.querySelectorAll('blockquote[data-secret="'+t.secret+'"]'),c=new RegExp("^https?:$","i"),i=0;i<o.length;i++)o[i].style.display="none";for(i=0;i<a.length;i++)s=a[i],e.source===s.contentWindow&&(s.removeAttribute("style"),"height"===t.message?(1e3<(r=parseInt(t.value,10))?r=1e3:~~r<200&&(r=200),s.height=r):"link"===t.message&&(r=new URL(s.getAttribute("src")),n=new URL(t.value),c.test(n.protocol))&&n.host===r.host&&l.activeElement===s&&(d.top.location.href=t.value))}},d.addEventListener("message",d.wp.receiveEmbedMessage,!1),l.addEventListener("DOMContentLoaded",function(){for(var e,t,s=l.querySelectorAll("iframe.wp-embedded-content"),r=0;r<s.length;r++)(t=(e=s[r]).getAttribute("data-secret"))||(t=Math.random().toString(36).substring(2,12),e.src+="#?secret="+t,e.setAttribute("data-secret",t)),e.contentWindow.postMessage({message:"ready",secret:t},"*")},!1)))}(window,document);
(()=>{"use strict";function e(t,n){const s=new XMLHttpRequest;s.onreadystatechange=()=>{if(4===s.readyState){if(s.status>=200&&s.status<300){const e=JSON.parse(s.responseText);return t.onSuccess(e)}return n?e(t,n-1):t.onError()}},s.open("GET",t.url),s.send()}function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}Array.prototype.forEach.call(document.querySelectorAll(".wp-block-newspack-blocks-homepage-articles.has-more-button"),function(n){const s=n.querySelector("[data-next]");if(!s)return;const o=n.querySelector("[data-posts]"),r=s.getAttribute("data-infinite-scroll");window.newspackBlocksIsFetching=window.newspackBlocksIsFetching||!1,window.newspackBlocksFetchQueue=window.newspackBlocksFetchQueue||[];let c=!1,i=!1;const a=()=>{i||(i=!0,u())},u=()=>{if(c)return!1;n.classList.remove("is-error"),n.classList.add("is-loading");const t=s.getAttribute("data-next")+"&exclude_ids="+function(){const e=document.querySelectorAll("[class^='wp-block-newspack-blocks'] [data-post-id]"),t=Array.from(e).map(e=>e.getAttribute("data-post-id"));return t.push(document.querySelector("div[data-current-post-id]").getAttribute("data-current-post-id")),[...new Set(t)]}().join(",");if(window.newspackBlocksIsFetching)return window.newspackBlocksFetchQueue.push(u),!1;window.newspackBlocksIsFetching=!0,e({url:t,onSuccess:l,onError:d},3)};function l(e){if(!function(e){let n=!1;return e&&t(e,"items")&&Array.isArray(e.items)&&t(e,"next")&&"string"==typeof e.next&&(n=!0,!e.items.length||t(e.items[0],"html")&&"string"==typeof e.items[0].html||(n=!1)),n}(e))return d();if(e.items.length){const t=e.items.map(e=>e.html).join("");o.insertAdjacentHTML("beforeend",t)}e.next&&s.setAttribute("data-next",e.next),e.items.length&&e.next||(c=!0,n.classList.remove("has-more-button")),w()}function d(){n.classList.add("is-error"),w()}function w(){window.newspackBlocksIsFetching=!1,n.classList.remove("is-loading"),window.newspackBlocksFetchQueue.length&&window.newspackBlocksFetchQueue.shift()(),i=!1}s.addEventListener("click",a),r&&new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&a()})},{root:null,rootMargin:"0px",threshold:1}).observe(s)})})();