/*! For license information please see zephr.bundle.js.LICENSE.txt */ !function(){"use strict";function e(e){const t=document.documentElement,n=document.body;if(!0===e){if(t.scrollHeight>t.offsetHeight){const e=t.scrollTop?t.scrollTop:n.scrollTop;t.classList.add("no-scroll"),t.style.top=-e+"px"}}else{const e=-parseInt(t.style.top,10);t.classList.remove("no-scroll"),t.scrollTop=e,n.scrollTop=e}}window.requestAnimationFrame;var t;!function(e){e.NYPostPageSix="NYPostPageSix",e.NYPostBusinessUnit="NYPostBusinessUnit",e.TheSun="TheSun",e.NewsUK="NewsUK"}(t||(t={})),t.NYPostPageSix,t.NYPostBusinessUnit,t.TheSun,t.NewsUK;const n=e=>{const t=window.nypScripts?.nypost_wp_vars?.nypostSite||"";if(new RegExp(`https?://go.${t}.com/`).test(e))try{return new URL(e).searchParams.get("url")||e}catch{return e}return e};function o(e){for(var t=1;te.toUpperCase())).replace(/^Flyout /,"").replace(/ Left$/,"").replace(/ Right$/,""):e.startsWith("pencil-unit ")&&(n=e.replace("pencil-unit ","").trim()):n="Template name not defined - Zephr",`${t}${n}`}(s,c),((e,t=null,o=null)=>{const{event_name:r,...s}=e;Object.entries(s).forEach((([e,r])=>{s[e]=((e,t,o)=>{let r="";switch(e){case"ga_current_url":return encodeURI(window.location.href);case"click_time":return(new Date).toLocaleString();case"__href__":return r=t?.href||(o.target?.href??""),encodeURI(n(r));default:return e}})(r,t,o)}));const i=window.ga4Dims||{},c={...s,...i,source_page_type:i.page_type||"",source_page:encodeURI(window.location.href),destination:t&&o?encodeURI(n(t.href||(o.target?.href??""))):""};r&&"undefined"!=typeof gtag&>ag("event",r,c),window.optimizely=window.optimizely||[],window.optimizely.push({type:"event",eventName:"navclick_event__same_trigger_",properties:{Category:c.source_unit??""}})})({event_name:"ux_engagement",source_unit:i,source_page:window.location.href,event_category:s,event_action:t,event_label:o},{})}function f(e){const{email:t="",event:n,iframeId:o="",nypPhone:r="",maropostsource:s="",experienceActionId:i="",zephrComponent:c="",selectedLists:l={},towersource:p="nypost"}=e;let{lists:d="",source:h="",model:{templateName:f=""}={}}=e;const{model:{GAPrefix:g=""}={}}=e;d=function(e){return e.split(",").map((e=>e.trim())).filter((e=>e.length>1)).join(",")}(d),h=h||s,t&&d?(f=f||i||c,async function(e,t){try{const n=await fetch("https://developer.nypost.com/temp/maropost/webhooks/validate-email/",{body:`email=${encodeURIComponent(e)}&tower_source=${encodeURIComponent(t)}`,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},method:"POST"});if(!n.ok)return!0;const{pass:o=!0}=await n.json();return o}catch(e){return!0}}(t,p).then((s=>{if(s){!async function(e,t,n,o,r,s){const{nypZephr:{nonce:i=""}={}}=window,c=r.hasOwnProperty("trackingId")?r.trackingId:"",l=await fetch("/wp-json/nypost-zephr/v1/newsletters/",{body:(a={email:e,subscribe:t,_wpnonce:i,nypPhone:n,source:o,tpEvent:c},Object.keys(a).reduce(((e,t)=>[...e,`${t}=${encodeURIComponent(a[t])}`]),[]).join("&")),headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST"});var a;if(!l.ok)return void w(s,!1,"An error has ocurred.",r.event);const{status:u=!1}=await l.json()||{};u?w(s,!0,"Success",r.event):w(s,!1,"An error has ocurred.",r.event)}(t,d,r,h,e,o),window.newslettersConverted=window.newslettersConverted||[];const s=Object.values(l).filter((e=>!window.newslettersConverted.includes(e)));m(f,"newsletter-single-signup"===n?"button_click_single_sign_up":"button_click_multiple_sign_up","successful",c);const{permutive:i=!1}=window;i&&i.track("Newsletter",{pageUri:window.location.href,newsletters:s.join(", ")}),window.newslettersConverted.push(...s),function(e){const t=a(),{subscribed:n=[]}=t;n.push(e),u(t)}(c)}else w(o,!1,"An error has ocurred.","invalid-email"),m(f,"newsletter-single-signup"===n?"button_click_single_sign_up":"button_click_multiple_sign_up","failed",c)})).catch((()=>{m(f,"newsletter-single-signup"===n?"button_click_single_sign_up":"button_click_multiple_sign_up","failed",c),w(o,!1,"An error has ocurred.","invalid-email")}))):w(o,!1,"An error has ocurred. Missing email address or list IDs.",e.event)}window.nypZephr=window.nypZephr||{},window.zephr=window.zephr||[],window.nypZephr.isMobile=h,window.zephr.push(["loaded",e=>{w(e.iframeId,!0,"isMobile",{isMobile:h})}]),window.zephr.push(["flyout-close",t=>{const{iframeId:n="",eventAction:o="Button Click - Close",eventLabel:r="X button close",model:{disableScrollLock:s=!1,disableMobileScrollLock:i=!1,GAPrefix:c="",templateName:l=""}={},zephrComponent:a=""}=t;if(h&&!(s||i)&&e(!1),!n)return;const u=document.getElementById(n);if(u){const e=u.closest(".zephr-component");e&&!e.classList.contains("closed")&&(e.classList.add("closed"),m(l,"button_click_close","",a))}}]),window.zephr.push(["show",t=>{const{model:{disableScrollLock:n=!1,disableMobileScrollLock:o=!1,GAPrefix:r="",templateName:s=""}={},zephrComponent:i=""}=t,c=n||o;m(s,"show_template","",i),function(e,t=86400){const n=Math.floor(Date.now()/1e3),o=a();o.suppressedAllowList=[e,n+t],u(o)}(s||i),h&&!c&&e(!0)}]),window.zephr.push(["*",e=>{const{event:t,eventAction:n="",eventLabel:o="",model:{GAPrefix:r="",templateName:s=""}={},zephrComponent:i=""}=e;"flyout-close"!==t&&(-1===t.indexOf("-clicked")&&-1===t.indexOf("-close")&&"track-analytics"!==t||m(s,n||t,"",i))}]),window.zephr.push(["newsletter-single-signup",f]),window.zephr.push(["newsletter-multi-signup",f]);const g=()=>{const{hooks:{addFilter:e=()=>null}={}}=window.zephr;e("zephr.componentQueryParameters","nypost",(e=>{d(l)&&e.append("suppressAll","true");const t=p();return t&&e.append("suppressedExcept",t),e})),e("zephr.componentProps","nypost",((e,t,n)=>!!function(e){const{subscribed:t=[]}=a()||{},{env:n="local"}=window.nypZephr||{};return!(("production"===n||!window.location.hash.includes("zephrRender=1"))&&(t.includes(e)||d(l)||"local"===n&&d(e)))}(n)&&e))};window.zephr.booted?g():window.zephr.push(["boot",g])}();