1import{K as e,U as t,s as n}from"./link-DWghAheB.js";import{a as r,n as i,o as a,r as o}from"./ads.functions-ULQ7qU9e.js";import{t as s}from"./utils-B6KiDbIe.js";var c=e(t(),1),l=n(),u={queryKey:[`published-ads`],queryFn:()=>i(),staleTime:6e4};function d(e,t,n){o({data:{slotId:e,creativeId:t,eventType:n}}).catch(()=>{})}function f({id:e,className:t}){let n=r(e),{data:i}=a(u),o=(i??[]).filter(t=>t.slotId===e),d=o.length,f=(n?.rotateSeconds??0)*1e3,[h,g]=(0,c.useState)(0);if((0,c.useEffect)(()=>{g(0)},[d]),(0,c.useEffect)(()=>{if(d<2||f<=0)return;let e=window.setInterval(()=>g(e=>(e+1)%d),f);return()=>window.clearInterval(e)},[d,f]),!n)return null;let _=d>0?o[h%d]:void 0;return(0,l.jsxs)(`aside`,{"aria-label":`Advertisement: ${n.unit}`,className:s(`w-full`,t),style:{maxWidth:n.width},children:[(0,l.jsx)(`p`,{className:`eyebrow mb-1.5 text-ad-label`,children:`Advertisement`}),_?(0,l.jsx)(p,{slot:n,creative:_},_.id):(0,l.jsx)(m,{slot:n})]})}function p({slot:e,creative:t}){let n=(0,c.useRef)(null),r=(0,c.useRef)(!1);(0,c.useEffect)(()=>{r.current=!1;let i=n.current;if(!i)return;if(typeof IntersectionObserver>`u`){d(e.id,t.id,`impression`),r.current=!0;return}let a=new IntersectionObserver(n=>{for(let i of n)i.isIntersecting&&!r.current&&(r.current=!0,d(e.id,t.id,`impression`),a.disconnect())},{threshold:.5});return a.observe(i),()=>a.disconnect()},[e.id,t.id]);let i=e.height>e.width;return(0,l.jsx)(`a`,{ref:n,href:t.clickUrl,target:`_blank`,rel:`noopener sponsored`,onClick:()=>d(e.id,t.id,`click`),className:`mx-auto block w-full overflow-hidden rounded-sm bg-ad-surface outline outline-ad-outline transition-opacity hover:opacity-90`,children:(0,l.jsx)(`img`,{src:t.imageUrl,alt:`${t.advertiser} advertisement`,width:e.width,height:e.height,loading:`lazy`,className:s(`mx-auto block h-auto w-full object-contain`,i?`max-h-[70vh] w-auto sm:max-h-none sm:w-full`:`max-h-[45vh] sm:max-h-none`)})})}function m({slot:e}){return(0,l.jsx)(`div`,{style:{aspectRatio:`${e.width} / ${e.height}`},className:s(`mx-auto grid w-full place-items-center rounded-sm bg-ad-surface outline outline-dashed outline-ad-outline`,e.height>e.width&&`max-h-[70vh] w-auto sm:max-h-none sm:w-full`),children:(0,l.jsxs)(`div`,{className:`px-4 text-center`,children:[(0,l.jsx)(`p`,{className:`eyebrow text-ad-label`,children:e.name}),(0,l.jsxs)(`p`,{className:`mt-1 font-serif text-lg leading-none text-sienna-clay`,children:[e.width,` à `,e.height]}),(0,l.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.capacity,` slots/month · $`,e.monthlyRate,`/mo`]})]})})}export{f as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.