import{r as t,h as i}from"./p-1e44390c.js";import"./p-74149bb1.js";import{P as o,a as e}from"./p-aeac88c9.js";let a,n=null;const s=()=>{var t;const i=[];for(const o of a)if(o.data){o.data.ad_weight||(o.data.ad_weight=1);for(let t=0;t<o.data.ad_weight;t++)i.push(o)}return(null===(t=i[Math.floor(Math.random()*i.length)])||void 0===t?void 0:t.data)||null},r=(t,i)=>{window._hsq?window._hsq.push(["trackEvent",{id:`Docs ad - ${t} - ${i}`}]):console.warn("Unable to track Hubspot event, _hsq not found",t,i)},c=(t,i)=>{window.gtag?window.gtag("event",`Docs ad - ${t} - ${i}`,{event_category:`Docs ad - ${t}`,event_label:i}):console.warn("Unable to track Google Analytics event, gtag not found",t,i)},l=t=>t.href?t:t.parentNode?l(t.parentNode):void 0,d=class{constructor(i){t(this,i),this.update()}async update(){this.ad=await(async()=>((null===n||Date.now()-n>12e5)&&await(async()=>{const t=await o.getApi("https://ionicframeworkcom.prismic.io/api/v2"),i=await t.query(o.Predicates.at("document.type","docs_ad"),{});a=i.results,n=Date.now()})(),s()))(),this.ad&&(this.timeout=setTimeout(()=>{var t;r("View",t=this.ad.ad_id),c("View",t)},50))}disconnectedCallback(){clearTimeout(this.timeout)}render(){if(this.ad&&0!==Object.keys(this.ad).length)return i("a",{href:this.ad.ad_url.url,target:this.ad.ad_url.target,onClick:t=>{return i=this.ad.ad_id,(o=t)&&o.preventDefault(),r("Click",i),c("Click",i),void setTimeout(()=>{const t=l(null==o?void 0:o.target);t.target&&"_blank"===t.target.toLowerCase()?window.open(t.href):t.href&&(document.location=t.href)},150);var i,o}},i("picture",null,i("source",{media:"(min-width: 37.5em)",src:this.ad.ad_image.url}),i("source",{src:this.ad.ad_image["1x"].url}),i("img",{src:this.ad.ad_image.url,alt:this.ad.ad_image.alt,height:this.ad.ad_image["1x"].dimensions.height,width:this.ad.ad_image["1x"].dimensions.width}),i("p",null,this.ad.ad_image.alt)),i("div",{innerHTML:e.RichText.asHtml(this.ad.ad_copy)}))}};d.style="internal-ad{max-width:148px;display:block;margin:48px 0 0}internal-ad p{font-size:13px;line-height:19px;font-weight:400;letter-spacing:0.02em;color:var(--text-color--dark);-webkit-transition:.2s color;transition:.2s color}internal-ad a:hover p{color:var(--text-color)}@media (max-width: 1233px){internal-ad{display:none}}";export{d as internal_ad}