import{T as e,h as r,u as s}from"./2c1ab0fe.Dbn2KvkT.js";import{n}from"./4b4bc88f.z1yoAwwH.js";import{o as i}from"./164ad2e3.FTBuhkTQ.js";function t({impressionType:t,impressionFeatures:o,enabled:c,children:m}){const p=function({impressionType:s,impressionFeatures:t,enabled:o=!0}){const c=i(),m=e(null),p=e(!1),u=n({impressionType:s,impressionFeatures:t});return r(()=>{if(!o||p.current||!window.IntersectionObserver)return;const e=new IntersectionObserver(s=>{const n=s.some(({isIntersecting:e})=>e);r&&n&&(e.unobserve(r),p.current=!0,c("impression",{...u.current,timestamp:new Date}))},{threshold:1}),r=m.current;return r&&e.observe(r),()=>{r&&e.unobserve(r)}},[c,o,u]),m}({impressionType:t,impressionFeatures:o,enabled:c});return s("div",{ref:p,children:m})}export{t as I};