!function(){const e="[DetectExistingPaypalButton.js] ",o=window.IAB_PAYPAL_IFRAME_DEBUG_FLAG,n=["xcomponent__ppbutton__","__zoid__paypal_buttons_","PAYPAL_EXPRESS-iframe"],t=n=>{window?.webkit?.messageHandlers?.fbIABPaypalJSIframeExpression?(window.webkit.messageHandlers.fbIABPaypalJSIframeExpression.postMessage(n),o&&console.log(e+"Sending message to fbIABPaypalJSButtonDetected",n)):BuyWithPayPalMessageHandler?(BuyWithPayPalMessageHandler.postMessage(JSON.stringify(n)),o&&console.log(e+"Sending message to BuyWithPaypalMessageHandler",n)):(window.webkit.messageHandlers.fbIABPaypalJSIframeExpression.postMessage(n),o&&console.log(e+"No message handler found for fbIABPaypalJSButtonDetected/BuyWithPayPalMessageHandler"))};o&&console.log(e+`DetectExistingPaypalButton.js injected into ${window.location.href}`),window.addEventListener("scroll",(()=>{!function(){let a=!1;const s=document.querySelectorAll("iframe");if(s.forEach((t=>{n.includes(t.name)&&(o&&console.log(e+"Found Paypal iframe"),a=!0)})),!a)return void(o&&console.log(e+"Not on a checkout page"));const l=Array.from(s).filter((e=>{const o=e.getBoundingClientRect();return o.top<window.innerHeight&&o.bottom>0}));let i=!1;l.forEach((e=>{e.title.toLowerCase().includes("paypal")&&(i=!0)})),i?(o&&console.log(e+"PayPal iframe found"),t({event_name:"IABExistingPaypalButtonDetected"})):(o&&console.log(e+"No PayPal iframe found"),t({event_name:"IABNoExistingPaypalButtonDetected"}))}()}))}();