(()=>{"use strict";function e(t){return e="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},e(t)}function t(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var r=o.call(t,n||"default");if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}function n(e,n,o){return(n=t(n))in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}const o=["Registration is a free and easy way to support our truly independent journalism"];const r="ssr-auth-state";let i=function(e){return e.GDPR="gdpr",e.USNAT="usnat",e.IOS14="ios14",e.CUSTOM="custom",e}({}),c=function(e){return e[e.CONTINUE_WITHOUT_AGREEING=1]="CONTINUE_WITHOUT_AGREEING",e[e.OPT_IN=2]="OPT_IN",e[e.VIEW_IFRAME=4]="VIEW_IFRAME",e[e.REDIRECT=5]="REDIRECT",e[e.MICRO_PAYMENT=7]="MICRO_PAYMENT",e[e.CUSTOM_JS=9]="CUSTOM_JS",e[e.WELECT_VIDEO=10]="WELECT_VIDEO",e[e.ACCEPT_ALL=11]="ACCEPT_ALL",e[e.VIEW_PRIVACY_MANAGER=12]="VIEW_PRIVACY_MANAGER",e[e.REJECT_ALL=13]="REJECT_ALL",e[e.SAMBA_VIDEO=14]="SAMBA_VIDEO",e[e.DISMISS=15]="DISMISS",e}({});const a="uk";const s=function(){window.dataLayer=window.dataLayer||[],window.dataLayer.push(arguments)},l=(e,t)=>s("event",e,t),u="indy",d=`${u}:ga4Loaded`,p=e=>{window.__GA4__READY?e():document.body.addEventListener(d,e)},_=e=>{p(()=>{l("cookiebanner_click",{link_label:e.label})})},f="AUTHENTICATED";const y=(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};let g=function(e){return e.ACCEPT_ALL="Accept All",e.REJECT_ALL="Reject All",e.LOG_IN="Log In",e.PRIVACY_POLICY="Privacy Policy",e.PRIVACY_MANAGER="Privacy Manager",e}({});const b="cmp-choice";function m(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}function w(e){for(var t=1;t(((e,t={})=>{const n=JSON.stringify(t,null,2),o=n.split("\n").reduce((e,t)=>t.length>=e?t.length:e,0),r=e.length,i=Math.max(r,o),c=` ${e.padEnd(i)} `,a=n.split("\n").map(e=>` ${e.padEnd(i)} `),s=a.length>1?`%c${a.slice(0,1)}\n%c${a.slice(1,-1).join("\n")}\n%c${a.slice(-1)}\n`:`%c${a[0]}\n`,l=a.length>1?["font-family:monospace; background: #333; color: #eee; padding-top: 5px;","font-family:monospace; background: #333; color: #eee;","font-family:monospace; background: #333; color: #eee; padding-bottom: 10px; border-radius: 0 0 6px 6px"]:["font-family:monospace; background: #333; color: #eee; padding-top: 5px; padding-bottom: 10px; border-radius: 0 0 6px 6px"];console.log(`%c${c}\n${s}`,"font-family:monospace; background: #333; color: #eee; border-bottom: 1px solid #666; padding: 5px 0; border-radius: 6px 6px 0 0",...l)})(`CustomEvent: ${e}`,t),new CustomEvent("analytics-trigger",{detail:{data:w({},t),eventName:e}})),E=(e,t)=>{return n=O(e,t),void document.body.dispatchEvent(n);var n};const v=(e={})=>E("sourcepoint_cmp_click",e),P=e=>{sessionStorage.setItem(b,`${e}`)},h=(e,t)=>{const n=sessionStorage.getItem(b)===`${e}`;return n&&(sessionStorage.removeItem(b),v(t),_(t)),n},I="/login";let A;const S=()=>{if("undefined"==typeof window)return"prod"!=={NODE_ENV:"production",npm_config_domain:""}.SERVER;if("undefined"!=typeof window&&void 0===A){var e;const t=new URLSearchParams(null===(e=window)||void 0===e||null===(e=e.location)||void 0===e?void 0:e.search);A=t.has("__DEBUG__")}return A||"true"===y("__DEBUG__")},C=(...e)=>{S()&&console.log(...e)};let R;function j(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}function T(e){for(var t=1;t{try{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(atob(t));return JSON.parse(n)}catch(e){return null}};function N(){if(void 0===globalThis.window)return null;const e=(()=>{var e;const t=null!==(e=y("esi_auth"))&&void 0!==e?e:"";return D(t)})();if(!e)return null;const{email:t,given_name:n,family_name:o,userStatus:r,pUid:i,exp:c,isAdFreeUser:a,isActiveRecurringDonator:s,adFreeExpiryTimestamp:l,recurringDonatorExpiryTimestamp:u,permutiveId:d}=e;return{email:t,givenName:n,familyName:o,userStatus:r,uid:i,exp:c,isAdFreeUser:a,isActiveRecurringDonator:s,adFreeExpiryTimestamp:l,recurringDonatorExpiryTimestamp:u,permutiveId:d}}var M;function L(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 U=Math.random().toString(36).slice(2),G={status:"ANONYMOUS",loading:!1,__id__:U},V=function(e){let t=e;const n=new Set;return{get:()=>t,set:e=>{t=e,n.forEach(e=>e(t))},patch:e=>{t=T(T({},t),e),n.forEach(e=>e(t))},subscribe:e=>(n.add(e),()=>n.delete(e))}}(null!==(M="undefined"!=typeof window?function(e=document){if(void 0===e)return null;if(void 0!==R)return R;const t=e.getElementById(r),n=null==t?void 0:t.textContent;let o=null;try{if(!n)throw new Error("No auth snapshot found in DOM");o=JSON.parse(atob(n))}catch(e){C(e)}finally{var i;null===(i=document.getElementById(r))||void 0===i||i.remove()}return R=o,o}(document):void 0)&&void 0!==M?M:G),k={__id__:U,get:V.get,subscribe:V.subscribe,actions:{set:V.set,patch:V.patch,login:e=>{V.patch({loading:!0});const t=new URL(I,window.location.origin);e&&t.searchParams.set("returnPath",e),window.location.href=t.toString()},logout:async()=>{V.patch({loading:!0});try{await fetch("/user/logout",{credentials:"include"})}finally{V.set(G)}},loadProfile:()=>{const e=N();e?V.patch(function(e){for(var t=1;t{const o=new Date;if(n&&(n.days||n.hours)){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.toUTCString()}`),document.cookie=r.join(";")};var $;function J(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}function Y(e){for(var t=1;t{E("sourcepoint_cmp_impression",e)})(),p(()=>l("cookiebanner_view")))},onConsentReady(e,t,n,o){const r=document.getElementById("privacy-settings");if(r){if(e===i.GDPR&&o.applies){var s;const e=B?1141355:1171350,o=1403163,i=849303;C("Consent Or Pay: consentUUID and euconsent ---\x3e",{consentUUID:t,euconsent:n});const l=(null!==(s=y("subscriber_origin"))&&void 0!==s?s:a)===a;r.innerHTML="Privacy settings",r.onclick=()=>{var t,n;(P(c.VIEW_PRIVACY_MANAGER),"the-independent.com"===window.JSGlobals.domain)?null===(t=window._sp_)||void 0===t||null===(t=t.gdpr)||void 0===t||t.loadPrivacyManagerModal(i):null===(n=window._sp_)||void 0===n||null===(n=n.gdpr)||void 0===n||n.loadPrivacyManagerModal(l?e:o)},x("gdprApplies","true",{hours:1})}if(e===i.USNAT){if(!o.applies)return void(r.style.display="none");r.innerHTML="Do Not Sell or Share My Information",r.onclick=()=>{var e;null===(e=window._sp_)||void 0===e||null===(e=e.usnat)||void 0===e||e.loadPrivacyManagerModal(1318285)},x("us_privacy_string",n,{hours:1})}}},onMessageChoiceSelect(e,t,n){switch(e===i.GDPR&&9===n&&window.localStorage.setItem("consent-to-pay-original-page-redirect-url",window.location.href),n){case c.REJECT_ALL:{const e={label:g.REJECT_ALL};v(e),_(e);break}case c.ACCEPT_ALL:{const e={label:g.ACCEPT_ALL};v(e),_(e);break}case c.CUSTOM_JS:P(c.CUSTOM_JS);break;case c.VIEW_PRIVACY_MANAGER:P(c.VIEW_PRIVACY_MANAGER)}}}})();