(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{onTemplateShow:()=>i});var n={};e.r(n),e.d(n,{onTemplateShow:()=>N});const o=(e,t=null)=>{const n=`; ${document.cookie}`.split(`; ${e}=`);return 2===n.length?decodeURIComponent(n.pop().split(";").shift()):t},r=(e,t,n)=>{const o=new Date;if(n){const e=n.days?24*n.days*60*60*1e3:60*n.hours*60*1e3;o.setTime(o.getTime()+e)}const r=[];r.push(`${e}=${encodeURIComponent(t)}`),r.push("path=/"),r.push("secure"),n&&r.push(`expires=${o.toGMTString()}`),document.cookie=r.join(";")},i=e=>{"OTN6797XUKB0"===e.templateId&&window.ga&&window.ga("send","event","adBlocker",location.pathname)};const a=(e,t=null)=>{var n,o;const r=`; ${document.cookie}`.split(`; ${e}=`);return 2===r.length?decodeURIComponent(null!==(n=null===(o=r.pop())||void 0===o?void 0:o.split(";").shift())&&void 0!==n?n:""):t},s=e=>{location.href=e},c=(e="/")=>((e,t)=>{const n=new URLSearchParams(t);return 0===Array.from(n.keys()).length?`${e}`:`${e}?${n}`})(e,{showUpgradeSuccessMessage:"true"});let d,l;const u=()=>{if("undefined"==typeof window)return"prod"!=={NODE_ENV:"production",npm_config_domain:""}.SERVER;if("undefined"!=typeof window&&void 0===d){var e;const t=new URLSearchParams(null===(e=window)||void 0===e||null===(e=e.location)||void 0===e?void 0:e.search);d=t.has("__DEBUG__")}return d||"true"===a("__DEBUG__")},p=()=>{var e;return void 0===l&&(l=!0===(null===(e=window.JSGlobals)||void 0===e||null===(e=e.featureFlags)||void 0===e?void 0:e.feat__sentry)),l},m=(...e)=>{u()&&console.log(...e)},f=()=>{var e;null===(e=window.braze)||void 0===e||e.requestImmediateDataFlush((e=>{e||((...e)=>{const t=u(),n=p();t&&console.warn(...e),n&&Sentry.captureException(...e)})("Braze data flush was unsuccessful")}))};function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}function y(e){var t=function(e,t){if("object"!=w(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=w(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==w(t)?t:t+""}function v(e,t,n){return(t=y(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const b="indy",h=`${b}:spError`,g=async(e,t)=>new Promise((n=>{var o;null!==(o=JSGlobals)&&void 0!==o&&null!==(o=o.cmp)&&void 0!==o&&o.enabled?window.__tcfapi&&new Promise((e=>{JSGlobals.cmp.enabled?(document.getElementById("sp-script").error&&e(!1),window.addEventListener(h,(()=>{e(!1)})),window.__tcfapi("addEventListener",2,((t,n)=>{var o;if(n)if(["useractioncomplete","tcloaded"].includes(t.eventStatus))if(window.__tcfapi("removeEventListener",2,(()=>{}),t.listenerId),t.gdprApplies){if(m("Consent Or Pay: valid GDPR tcData ---\x3e",t),null!==(o=t.publisher)&&void 0!==o&&null!==(o=o.consents)&&void 0!==o&&o[1])return m('Consent Or Pay: tcData.publisher?.consents?.["1"] ---\x3e',t),void e(!0);e(!1)}else e(!0);else m("Consent Or Pay: !['useractioncomplete', 'tcloaded'].includes(tcData.eventStatus) ---\x3e",{tcData:t,eventStatus:t.eventStatus})}))):e(!0)})).then((o=>{o?window.__tcfapi("getCustomVendorConsents",2,(o=>{var r;const i=!(null===(r=o.grants)||void 0===r||null===(r=r[e])||void 0===r||!r.vendorGrant);m("CMP:getCustomVendorConsents",t,i),n(i)})):n(!1)})):n(!0)})),S=(e,{async:t=!0,defer:n=document.location.search.includes("___FORCE_DEFER___"),parent:o=document.body,attributes:r}={})=>{window.JSGlobals=window.JSGlobals||{};const i=window.JSGlobals.loadedJS=[];return new Promise(((a,s)=>{const c=(e instanceof Array?e:[e]).map((e=>i.includes(e)?Promise.resolve():new Promise(((a,s)=>{const c=((e,{id:t,async:n,defer:o,ok:r,error:i,attributes:a})=>{const s=document.createElement("script");return s.onload=r,s.onerror=i,t&&"undefined"!==t&&(s.id=t),n&&!o&&s.setAttribute("async",""),o&&s.setAttribute("defer",""),a&&a.forEach((([e,t])=>{s.setAttribute(e,t)})),s.src=e,s})(e,{async:t,defer:n,ok:a,error:s,attributes:r});o.appendChild(c),i.push(e)}))));return Promise.all(c).then(a,s)}))},_=()=>{var e;null===(e=document.querySelector(".notification-prompt"))||void 0===e||null===(e=e.classList)||void 0===e||e.remove("notification-prompt--show")},E=()=>{braze.openSession(),Notification.requestPermission(),_()};function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}const O=()=>{const e=a("esi_puid");var t;e&&(null===(t=window.braze)||void 0===t||t.changeUser(e))},k=async()=>{if(!!window.braze)return O(),!0;try{var e;if(!await g("5ed8c49c4b8ce4571c7ad801","braze"))return!1;const{braze:{sdkAPIKey:t="",sdkEndpoint:n=""}={}}=window.JSGlobals;return await S(["https://js.appboycdn.com/web-sdk/4.8/braze.min.js"]),null===(e=window.braze)||void 0===e||e.initialize(t,function(e){for(var t=1;t{const e=document.querySelector(".notification-prompt__accept"),t=document.querySelector(".notification-prompt__deny");null==e||e.addEventListener("click",E),null==t||t.addEventListener("click",(()=>_()))})(),document.dispatchEvent(new CustomEvent("brazeLoaded")),!0}catch(e){return((...e)=>{const t=u(),n=p();t&&console.error(...e),n&&Sentry.captureException(...e)})("Error initializing braze sdk",e),!1}},j=async(e,t)=>{try{var n;if(await k())null===(n=window.braze)||void 0===n||n.logCustomEvent(e,t),f()}catch(t){console.error(`Error logging ${e} Braze event:`,t.message)}},C=()=>{const e=window.tp||[];return window.tp=e,e},U=(...e)=>{C().push(...e)},x=e=>{const t=new URLSearchParams;new URL(document.location.href).pathname.startsWith("/donations")&&(t.set("donations",""),t.set("regSourceMethod","Donations")),(async(e,t)=>{if(t){r("__pianoParams",JSON.stringify(t),{hours:1});const n=new URL(location.origin);n.pathname="/internal-api/subscription/term",n.searchParams.set("__amp_source_origin",location.origin),n.searchParams.set("termId",t.termId);const o=await fetch(n.toString(),{credentials:"same-origin"}),i=await o.json();r("__pianoTerm",JSON.stringify(i),{hours:1}),e.set("offerId",t.offerId),e.set("termId",t.termId)}location.href=`/register?${e.toString()}`})(t,e)},I=e=>{switch(e.eventName){case"openLogin":(()=>{var e;return null===(e=document.getElementById("loginButton"))||void 0===e?void 0:e.click()})();break;case"set-return-url":document.cookie=`ref_url=${location.origin}${location.pathname}; path=/;`;break;case"reg-return-url":localStorage.setItem("regReturnUrl",location.href)}};function D(e){const[t]=document.getElementsByClassName("tp-modal"),n=(new Date).toUTCString();t&&(t.scrollTop=0),document.cookie=`__pianoTerm=null; expires=${n}; path=/;`,document.cookie=`__pianoParams=null; expires=${n}; path=/;`,fetch("/internal-api/update-user-subscription-auto-renew",{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}})}function T(){}function A(e){if("checkoutCompleted"!==e.state){const[e]=document.getElementsByClassName("payment-methods");e.classList.remove("hide")}}function J(e){0===e.viewsLeft&&"DefaultMeter"===e.meterName&&j("premium_meter_expired",{})}function L(){}function $(){}function G(){}function z(){}function R(e){if(-1===e.origin.indexOf("tinypass.com")&&-1===e.origin.indexOf("independent.co.uk")||!e.data)return;const t=function(e){if(null==e)return;if("object"==typeof e&&!Array.isArray(e))return e;if("string"==typeof e)try{return JSON.parse(e)}catch{return}}(e.data);if(t&&"completeUpgradePurchase"===t.event)s(c(window.location.href))}const N=e=>{if(window.JSGlobals.MOCK_ENV&&"modal"===e.displayMode){const e=C();if(Array.isArray(e))return;e.template.close()}};(async(e=!1)=>{const r=e?n:t,{onTemplateShow:i}=r;(()=>{const e="true"===a("feat__force_piano_prod"),t="development"===window.JSGlobals.pianoEnvironment&&!e;U(["setAid",window.JSGlobals.piano.pianoAppId],...t?[]:[["setCxenseSiteId","1134082880659765068"]],["setEndpoint",window.JSGlobals.piano.pianoEndpoint],["setUseTinypassAccounts",!1],["setSandbox",t],["setDebug",!1])})(),U(["addHandler","checkoutComplete",D],["addHandler","checkoutClose",A],["addHandler","checkoutCustomEvent",T],["addHandler","loginRequired",x],["addHandler","loginSuccess",$],["addHandler","meterExpired",J],["addHandler","meterActive",L],["addHandler","experienceExecute",G],["addHandler","experienceExecutionFailed",z],["addHandler","showTemplate",i],["addHandler","customEvent",I],["setUseTinypassAccounts",!1],["setUsePianoIdUserProvider",!1],["setUsePianoIdLiteUserProvider",!0],["setExternalJWT",o("esi_auth")]),window.addEventListener("message",R),await(async()=>{await S(["https://cdn.tinypass.com/api/tinypass.min.js"])})()})()})();