var e,n,t,o;import{g as i,s as r}from"../../cookies-Btke1V1y.js";const a="FTR_Article_PageView";if((null==(n=null==(e=window.reduxStore)?void 0:e.getState())?void 0:n.vanilla.isArticle)&&(null==(o=null==(t=window.vanilla.featureFlags.recirculation)?void 0:t.overlay)?void 0:o.enabled)){const e=i(a);r(e?{name:a,value:String(Number(e)+1),path:"/"}:{name:a,value:"1",path:"/"})}document.addEventListener("alpine:init",(()=>{Alpine.data("overlayDialog",(e=>({open:!1,init(){var n,t,o;const r=new URLSearchParams(window.location.search).get("recirc-icymi");if(this.$watch("open",(e=>document.documentElement.classList.toggle("overflow-hidden",e))),"open"===r)return void(this.open=!0);if("1"!==i(a))return;if(document.referrer&&new URL(document.referrer).host===location.host)return;let l=!1,d=!1,c=location.hash;const s=()=>{d&&l&&(window.dispatchOrQueueAction("freyr.sendEventToFreyr",{name:"elementInteraction",eventObject:{element:{action:"exit",name:"ICYMI",label:null,url:document.URL}}}),window.removeEventListener("pointerdown",u),window.removeEventListener("scroll",u),window.removeEventListener("keydown",u),window.history.pushState(null,"",window.location.href))},w=setTimeout((()=>{l=!0,s(),clearTimeout(w)}),(null==(o=null==(t=null==(n=window.vanilla.featureFlags)?void 0:n.recirculation)?void 0:t.overlay)?void 0:o.minimumPageViewDuration)??5e3),u=()=>{d||(d=!0,s())};window.addEventListener("pointerdown",u,{once:!0}),window.addEventListener("scroll",u,{once:!0,passive:!0}),window.addEventListener("keydown",u,{once:!0});const v=()=>{this.open=!0},m=n=>{d&&l&&!this.open&&(n.preventDefault(),window.dispatchOrQueueAction("freyr.sendEventToFreyr",{name:"elementInteraction",eventObject:{element:{action:"show",name:"ICYMI",label:e,url:document.URL}}}),window.dispatchEvent(new CustomEvent("Show ICYMI")),v(),window.removeEventListener("popstate",h))},h=e=>{(()=>{const e=location.hash;return c!==e?(c=e,!0):(c=e,!1)})()||m(e)};window.addEventListener("popstate",h)},closeDialog(){this.open=!1,window.history.back(),window.dispatchOrQueueAction("freyr.sendEventToFreyr",{name:"elementInteraction",eventObject:{element:{action:"close",name:"ICYMI",label:e,url:document.URL}}})}})))}));