(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[505],{80616:function(e,t,n){"use strict";n.d(t,{Z:function(){return h}});var r=n(11527),i=n(50959),l=n(91863),o=n(80805),a=n(94758),s=n.n(a),u=n(19800);function c(){let e=(0,u.$)();return(0,i.useMemo)(()=>{switch(e.key){case u.Y0.IlRestoDelCarlino:return"/watermark/watermark_ilresto.svg";case u.Y0.IlTelegrafoDiLivorno:return"/watermark/watermark_telegrafo.svg";case u.Y0.LaNazione:return"/watermark/watermark_lanazione.svg";case u.Y0.IlGiorno:return"/watermark/watermark_giorno.svg";case u.Y0.QN:return"/watermark/watermark_quotidiano.svg";case u.Y0.QuotidianoSportivo:return"/watermark/watermark_quotidiano_sportivo.svg";case u.Y0.Luce:return"/watermark/watermark_lanazione.svg";case u.Y0.Itinerari:case u.Y0.Salus:return"/watermark/watermark_quotidiano.svg";default:return""}},[e])}function d(e){let{enabled:t,width:n,height:i,style:l,ad:o,children:a}=e,u=c();return!function(){return t&&!(null==o?void 0:o.out_of_page)&&n>1&&i>1}()?(0,r.jsx)(r.Fragment,{children:a}):(0,r.jsxs)("div",{className:"jsx-d84191859cc16c0d",children:[(0,r.jsx)(s(),{id:"d84191859cc16c0d",children:".amp__watermark.jsx-d84191859cc16c0d{width:100%;background-color:var(--watermarkGray);background-position:center center;-webkit-background-size:36px;-moz-background-size:36px;-o-background-size:36px;background-size:36px;background-repeat:no-repeat;padding:6px;margin:auto;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center}"}),(0,r.jsx)("div",{style:{backgroundImage:"url(".concat(u,")"),...l},className:"jsx-d84191859cc16c0d amp__watermark",children:a})]})}var m=n(56373),v=n(66605),f=n(64636),g=n.n(f);function p(e){let{requireConsent:t}=(0,m.We)(),{id:n,children:l,reserveHeight:a,sticky:s,stickyTime:c}=e,[d,v]=(0,i.useState)(!1),[f,p]=(0,i.useState)(void 0),[y,b]=(0,i.useState)({}),_=(0,u.aF)();function h(e){if(e.slot.getSlotId().getDomId()===n&&!e.isEmpty&&s&&void 0!==c&&!d&&(v(!0),c>0)){let e=setInterval(()=>{p(t=>{let r=(null!=t?t:c)-1;if(r<1){v(!1),clearInterval(e);let t=new CustomEvent("endOfCountdown",{detail:{id:n}});window.dispatchEvent(t)}return r})},1e3)}}function w(){return d&&c&&f||d&&0===c?(0,r.jsx)("div",{className:g().stickyTime,children:0!==c?f:(0,r.jsx)("div",{className:g().stickyClose,onClick:()=>v(!1),children:(0,r.jsx)(u.Tw,{})})}):(0,r.jsx)(r.Fragment,{})}return(0,i.useEffect)(()=>{let e=document.getElementById("stickyHeader");e&&b({top:e.clientHeight}),t(()=>{googletag.cmd.push(()=>{googletag.pubads().addEventListener("slotRenderEnded",h)})})},[]),(0,r.jsx)("div",{className:d?g().sticky:"inPage",style:{minHeight:(0,o._c)(_.user)?a:0,...y},children:l({StickyCounterComponent:w})})}var y=n(41249),b=n(37105);function _(e){var t,n,a;let[s,c]=(0,i.useState)(!1);(0,i.useEffect)(()=>{c((0,b.F)())},[]);let f=(0,u.$)(),{style:g,index:h,width:w,height:x,reserveHeight:k}=e,{getAdId:E,getAd:I,defineSlot:S,destroySlot:C,canDefineAdv:A,setLoadedAds:T,loadedAds:L}=(0,o.Ny)(),j=E(e.name,h),z=null===(t=e.refresh_domains)||void 0===t?void 0:t.map(e=>e.name),M=(null==z?void 0:z.includes(f.key))?e.timerRefresh:0,q=I(j,h),[N,X]=(0,l.ht)(q),{requireConsent:B}=(0,m.We)(),V=(0,i.useRef)(null),[Y,H]=(0,i.useState)(!1),[R,W]=(0,i.useState)(!1),D=(0,u.c_)(V,(null==q?void 0:q.lazy_offset)?{rootMargin:"".concat(q.lazy_offset,"px 0px")}:{rootMargin:"400px 0px"}),{leaf:F}=(0,y.Vy)(),G=["hard","closable","registration"].includes(String((0,u.gw)().premium)),Q=(0,u.aF)(),[O,P]=(0,i.useState)(null),Z=q&&A(q),U=eg(),$=ep(),K=(()=>{let e=null==q?void 0:q.dimension;if(!e)return;let t=(Array.isArray(e)?e:[e]).filter(e=>Array.isArray(e)&&2===e.length).map(e=>{let[,t]=e;return t});if(t.length)return Math.max(...t)})(),J={"videobox-top-300":600,"videobox-bottom-300":600,"300x250top-mobile-article":250,"300x250-Inlettura":250},ee={"videobox-top-300":300,"videobox-bottom-300":300,"300x250top-mobile-article":300,"300x250-Inlettura":300},et=(e,t)=>t[e]?t[e]:e.includes("300x250-Inlettura")?t["300x250-Inlettura"]||250:void 0,en="number"==typeof w?w:null!==(n=et(e.name,ee))&&void 0!==n?n:e.name.includes("300x250-Inlettura")?300:U,er=(()=>{var t;if((null==q?void 0:q.name)==="web-interstitial")return null!=O?O:0;if("number"==typeof k)return k;let n=K,r="number"==typeof(null==q?void 0:q.reserved_height)?q.reserved_height:void 0,i=null!==(t=et(e.name,J))&&void 0!==t?t:e.name.includes("300x250-Inlettura")?250:void 0;if(n){let e="number"==typeof i?i:n;return Math.min(null!=r?r:n,e)}return"number"==typeof i?"number"==typeof r?Math.min(r,i):i:null!=r?r:"number"==typeof $?$:void 0})(),ei=!!(e.name.includes("videobox-top-300")||e.name.includes("videobox-bottom-300"))||((null==q?void 0:q.lazy)?Y&&Z:Z),el=ei&&null!==(a=null!=O?O:er)&&void 0!==a?a:0,eo=null!=en?en:U,ea=el,es=(0,i.useCallback)(e=>{let t=Math.max("number"==typeof er?er:0,e||0);P(e=>e===t?e:t)},[er]),eu=e=>{e.style.width="100%",e.style.height="100%",e.style.border="none",e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.zIndex="999999"},ec=e=>{let t=e.querySelector("div")||e.firstElementChild;if(t&&t!==e){let e=t.querySelector("iframe");e&&eu(e)}},ed=e=>{e.querySelectorAll("script:not([data-executed='true'])").forEach(e=>{try{var t;let n=document.createElement("script");Array.from(e.attributes).forEach(e=>{"data-executed"!==e.name&&n.setAttribute(e.name,e.value)}),e.textContent&&(n.textContent=e.textContent),e.src&&(n.src=e.src,n.async=e.hasAttribute("async"),n.defer=e.hasAttribute("defer")),e.setAttribute("data-executed","true"),null===(t=e.parentNode)||void 0===t||t.replaceChild(n,e)}catch(e){console.warn("Errore nell'esecuzione dello script overlay:",e)}})};(0,i.useEffect)(()=>()=>{C(j,h)},[]),(0,i.useEffect)(()=>{(null==D?void 0:D.isIntersecting)&&H(D.isIntersecting)},[D]),(0,i.useEffect)(()=>{Z&&(null==q||!q.lazy)&&ef()},[q,Z]),(0,i.useEffect)(()=>{Z&&(null==q?void 0:q.lazy)&&ef()},[Y,Z,null==q?void 0:q.lazy]),(0,i.useEffect)(()=>{if(!M||M<=0)return;let e=setInterval(()=>{try{C(j,h),ef()}catch(e){console.error("Errore refresh adv:",e)}},1e3*M);return()=>clearInterval(e)},[M,q,Y]),(0,i.useEffect)(()=>{let e=e=>{if(e.data&&"removeOverlayIframe"===e.data.type)try{let e=document.getElementById("div-gpt-ad-overlay")||document.getElementById("div-gpt-ad-interstitial-mobile");if(e){let t=e.querySelector("iframe");if(t){t.remove();let n=e.querySelector("div")||e.firstElementChild;n&&n!==e&&(n.style.width="0",n.style.height="0")}}}catch(e){console.error("Errore nella rimozione del primo iframe:",e)}};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[]),(0,i.useEffect)(()=>{if((null==q?void 0:q.name)!=="overlay"||!V.current)return;let e=V.current;ec(e),setTimeout(()=>{ed(e)},100);let t=new MutationObserver(()=>{ed(e),ec(e)});return t.observe(e,{childList:!0,subtree:!0}),()=>{t.disconnect()}},[null==q?void 0:q.name,Y]);let em=(0,i.useCallback)(()=>{var t,n,r;let i=[...googletag.pubads().getSlots()].find(e=>e.getSlotElementId()===j);null===(r=self.performance)||void 0===r||null===(n=r.getEntriesByType)||void 0===n||null===(t=n.call(r,"navigation")[0])||void 0===t||t.activationStart,!i&&A(q)&&(null==q||!q.lazy||Y)&&(i=S(j,h,null==F?void 0:F.__typename,G,Q.user.loginStatus,e.nameIndex),window.cX.callQueue.push(["invoke",()=>{var e,t,n;(0,v.T)(i),null==i||i.setTargeting("prerender",(null===(n=self.performance)||void 0===n?void 0:null===(t=n.getEntriesByType)||void 0===t?void 0:null===(e=t.call(n,"navigation")[0])||void 0===e?void 0:e.activationStart)>0?"true":"false")}]))},[Y]);function ev(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e3,i=e.scrollHeight,l=null,o=new MutationObserver(()=>{let r=e.scrollHeight;r!==i&&(i=r,l&&clearTimeout(l),l=setTimeout(()=>{o.disconnect(),t(e.scrollHeight)},n))});o.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),setTimeout(()=>{o.disconnect(),l&&clearTimeout(l),t(e.scrollHeight)},r)}function ef(){try{window.googletag=window.googletag||{cmd:[]},googletag.cmd.push(()=>{B(em)})}catch(e){console.error(e)}googletag.cmd.push(()=>{googletag.pubads().addEventListener("slotRenderEnded",t=>{let n=t.isEmpty,r=t.slot.getSlotElementId();r===j&&(n?((null==q?void 0:q.collapse_if_empty)||(null==q?void 0:q.name)==="web-interstitial"||(null==q?void 0:q.name)==="overlay"||(null==q?void 0:q.name)==="interstitial-mobile")&&P(0):setTimeout(()=>{let e=document.getElementById(j);e&&ev(e,e=>{es(e)})},100)),T(e=>[...e,r.replace("div-gpt-ad-","")]),"div-gpt-ad-interstitial-mobile"===r&&n&&(W(!0),C(j,h));let i=t.slot.getSlotElementId();setTimeout(()=>{let e=document.getElementById(i);if(e){for(let t of e.getElementsByTagName("iframe"))t.setAttribute("tabindex","-1"),t.setAttribute("aria-hidden","true");((null==q?void 0:q.name)!=="overlay"||n||r!==j)&&((null==q?void 0:q.name)!=="interstitial-mobile"||n||r!==j)||(ec(e),ed(e))}},200),e.isHpTopAd&&setTimeout(()=>{let e=document.getElementById("hpTopAdContainer"),t=document.getElementById(j);e&&t&&ev(t,t=>{e.style.height="".concat(t,"px