"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26812],{26812:function(e,t,n){n.r(t),n.d(t,{default:function(){return a}});var o=n(67294),r=n(621),i=function(e){var t=e.targetClass,n=e.widgetName,i=e.section,a=void 0===i?"":i,c=e.threshold,l=void 0===c?.5:c,d=e.onVisible,s=e.enabled,u=void 0===s||s,v=e.parentSelector,f=void 0===v?"":v,g=e.trackMultiple,m=void 0===g||g,p=e.storyIndex,b=void 0===p?0:p,h=(0,o.useRef)(new Set),w=(0,o.useRef)(null),y=(0,o.useRef)(null),I=!1;((0,r.KV)("small")||(0,r.KV)("medium"))&&(I=!0),(0,o.useEffect)((function(){if(u&&t){var e=function(){var e=t.startsWith(".")?t:"."+t,o=f?"".concat(f," ").concat(e):e,i=m?document.querySelectorAll(o):[document.querySelector(o)].filter(Boolean);return 0!==i.length&&(w.current||(w.current=new IntersectionObserver((function(e){e.forEach((function(e){if(e.isIntersecting){var i,c=e.target,l=document.querySelectorAll(o);!function(e){var o,i,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,l=(null===(o=e.dataset)||void 0===o?void 0:o.storyId)||(null===(i=e.dataset)||void 0===i?void 0:i.id)||"".concat(t,"-").concat(c);if(!h.current.has(l)){h.current.add(l),d&&"function"===typeof d&&d(e);var s=(null===r.ej||void 0===r.ej?void 0:(0,r.ej)("token"))||"",u=(null===r.ej||void 0===r.ej?void 0:(0,r.ej)("_ht_clientid"))||"",v=s&&!s.includes("amp-"),f={widget:n,pageType:"article",userId:v?u:"",section:a||"",platform:I?"MWeb":"web",position:c,logged_in_status:v?"logged_in":"non_logged_in",property:"HT",type:"Impression"};(null===window||void 0===window?void 0:window.dapTracker)?window.dapTracker.track("widget_impression",f,"event"):console.warn("dapTracker not found on window object")}}(c,Array.from(l).indexOf(c)),null===(i=w.current)||void 0===i||i.unobserve(c)}}))}),{threshold:l,rootMargin:"0px"})),i.forEach((function(e,n){var o,r;if(e){var i=(null===(o=e.dataset)||void 0===o?void 0:o.storyId)||(null===(r=e.dataset)||void 0===r?void 0:r.id)||"".concat(t,"-").concat(n);h.current.has(i)||w.current.observe(e)}})),!0)};return y.current=setInterval((function(){e()}),500),e(),function(){y.current&&clearInterval(y.current),w.current&&w.current.disconnect()}}}),[t,n,a,l,d,u,f,m]),(0,o.useEffect)((function(){if(b>0&&y.current){var e=(null===t||void 0===t?void 0:t.startsWith("."))?t:"."+t,n=f?"".concat(f," ").concat(e):e;setTimeout((function(){document.querySelectorAll(n).forEach((function(e,n){var o,r,i=(null===(o=e.dataset)||void 0===o?void 0:o.storyId)||(null===(r=e.dataset)||void 0===r?void 0:r.id)||"".concat(t,"-").concat(n);!h.current.has(i)&&w.current&&w.current.observe(e)}))}),300)}}),[b,t,f])},a=function(e){var t=e.section,n=void 0===t?"":t,o=e.enabled,r=void 0===o||o,a=e.storyIndex,c=void 0===a?0:a;return i({targetClass:"middleTaboola",widgetName:"taboola mid article",section:n,threshold:.5,enabled:r,trackMultiple:!0,storyIndex:c,onVisible:function(e){}}),i({targetClass:"bottomTaboolaClass",widgetName:"taboola bottom article",section:n,threshold:.3,enabled:r,trackMultiple:!0,storyIndex:c,onVisible:function(e){}}),i({targetClass:"leadImageClass",widgetName:"Lead image impression",section:n,threshold:.5,enabled:r,parentSelector:'figure[class*="artImage"], figure[class*="leadImage"], .articleDetail',trackMultiple:!0,storyIndex:c,onVisible:function(e){}}),null}}}]);