PageSourceSearch

https://www.sompio.fi/analytics.min.js?ver=1.5

js sompio.fi collected 2026-09-25 01:15:30 UTC 238,443 bytes, 1 lines download raw bytes

1"use strict";(()=>{var Cc=Object.defineProperty;var p=(n,e)=>()=>(n&&(e=n(n=0)),e);var O=(n,e)=>{for(var t in e)Cc(n,t,{get:e[t],enumerable:!0})};var k=p(()=>{"use strict"});var Jr,o,y=p(()=>{"use strict";S();h();Jr=typeof window!="undefined"&&typeof console!="undefined",o=class{static logMessage(e,...t){l(()=>{try{if(!f.get().loggingEnabled||!Jr)return;console[e]("[NavigaAnalytics]",...t)}catch{}},void 0)}static warnAlways(...e){l(()=>{try{if(!Jr)return;console.warn("[NavigaAnalytics]",...e)}catch{}},void 0)}static log(...e){this.logMessage("log",...e)}static info(...e){this.logMessage("info",...e)}static warn(...e){this.logMessage("warn",...e)}static error(...e){this.logMessage("error",...e)}}});var V,Xe=p(()=>{"use strict";y();V=class{static report(e){try{o.error(`[${e.source}] ${e.message}`,e.data?this.safeStringify(e.data):""),this.errors.unshift({...e,data:e.data?this.safeClone(e.data):void 0}),this.errors.length>this.MAX_ERRORS&&this.errors.pop()}catch(t){try{console.error("Error in error reporter:",t)}catch{}}}static getErrors(){try{return this.safeClone(this.errors)}catch{return[]}}static clearErrors(){try{this.errors=[]}catch{}}static safeClone(e){try{return JSON.parse(JSON.stringify(e))}catch{if(typeof e=="object"&&e!==null){let t={};for(let i in e){let r=e[i];typeof r!="object"||r===null?t[i]=r:t[i]="[Object]"}return t}return e}}static safeStringify(e){try{return JSON.stringify(e)}catch{return"[Object]"}}};V.errors=[],V.MAX_ERRORS=10});function Y(n){return{success:!0,value:n,unwrap(){return this.value},unwrapOr(){return this.value}}}function Pe(n){return{success:!1,error:n,unwrap(){throw this.error},unwrapOr(e){return e}}}var ht=p(()=>{"use strict"});function l(n,e){try{return n()}catch{return e}}function _(n,e){try{return Y(n())}catch(t){let i=t instanceof Error?t.message:String(t),r={...e,message:`${e.message}: ${i}`};try{V.report(r)}catch{try{console.error("Failed to handle error:",i)}catch{}}return Pe(r)}}async function C(n,e){try{return Y(await n())}catch(t){let i=t instanceof Error?t.message:String(t),r=t==null?void 0:t.statusCode,a={...e,...typeof r=="number"?{statusCode:r}:{},message:`${e.message}: ${i}`};try{V.report(a)}catch{try{console.error("Failed to handle async error:",i)}catch{}}return Pe(a)}}var h=p(()=>{"use strict";Xe();ht()});var N,Wt=p(()=>{"use strict";y();N=class{static ensureInitialized(){this.initialized||(o.info("[EventDataCache] Cache initialized with caching enabled by default"),this.initialized=!0)}static get(){this.ensureInitialized();try{return this.config.enabled?this.staticData?(o.log("[EventDataCache] Cache hit - returning cached data"),{...this.staticData}):(o.log("[EventDataCache] Cache empty, returning null"),null):(o.log("[EventDataCache] Cache disabled, returning null"),null)}catch(e){return o.warn("[EventDataCache] Cache retrieval failed:",e),null}}static set(e){this.ensureInitialized();try{if(!this.config.enabled){o.log("[EventDataCache] Cache disabled, skipping storage");return}this.staticData={...e},o.log("[EventDataCache] Cache populated with static data"),this.logCacheStats()}catch(t){o.warn("[EventDataCache] Cache storage failed:",t)}}static clear(){try{let e=this.staticData!==null;this.staticData=null,this.stats.lastClearTime=Date.now(),e?o.log("[EventDataCache] Cache cleared"):o.log("[EventDataCache] Cache clear called (cache was already empty)")}catch(e){o.warn("[EventDataCache] Cache clear failed:",e),this.staticData=null}}static invalidateArticleData(){try{if(this.staticData){let e=this.staticData.ex_articleData!==void 0;this.staticData={...this.staticData,ex_articleData:void 0}
1,e?o.log("[EventDataCache] Article data invalidated"):o.log("[EventDataCache] Article data invalidation called (no article data was cached)")}else o.log("[EventDataCache] Article data invalidation called (cache is empty)")}catch(e){o.warn("[EventDataCache] Article data invalidation failed:",e)}}static invalidateUserData(){try{if(this.staticData){let e=this.staticData.ex_userData!==void 0;this.staticData={...this.staticData,ex_userData:void 0},e?o.log("[EventDataCache] User data invalidated"):o.log("[EventDataCache] User data invalidation called (no user data was cached)")}else o.log("[EventDataCache] User data invalidation called (cache is empty)")}catch(e){o.warn("[EventDataCache] User data invalidation failed:",e)}}static updateArticleData(e){try{if(!this.config.enabled){o.log("[EventDataCache] Cache disabled, skipping article data update");return}this.staticData?(this.staticData={...this.staticData,ex_articleData:e},o.log("[EventDataCache] Article data updated in cache")):o.log("[EventDataCache] Article data update called but cache is empty")}catch(t){o.warn("[EventDataCache] Article data update failed:",t)}}static updateUserData(e){try{if(!this.config.enabled){o.log("[EventDataCache] Cache disabled, skipping user data update");return}this.staticData?(this.staticData={...this.staticData,ex_userData:e},o.log("[EventDataCache] User data updated in cache")):o.log("[EventDataCache] User data update called but cache is empty")}catch(t){o.warn("[EventDataCache] User data update failed:",t)}}static getStats(){return{...this.stats}}static setEnabled(e){try{let t=this.config.enabled;this.config.enabled=e,t!==e&&(o.info(`[EventDataCache] Configuration changed: caching ${e?"enabled":"disabled"}`),this.logCacheStats()),!e&&this.staticData!==null&&(o.info("[EventDataCache] Clearing cache due to caching being disabled"),this.clear())}catch(t){o.warn("[EventDataCache] Failed to set enabled state:",t)}}static isEnabled(){return this.config.enabled}static recordHit(e){try{this.stats.hits++,this.stats.timeSavedMs+=e,o.log(`[EventDataCache] Cache hit recorded - total hits: ${this.stats.hits}, time saved this hit: ${e.toFixed(2)}ms, total time saved: ${this.stats.timeSavedMs.toFixed(2)}ms`)}catch(t){o.warn("[EventDataCache] Failed to record cache hit:",t)}}static recordMiss(){try{this.stats.misses++,o.log(`[EventDataCache] Cache miss recorded - total misses: ${this.stats.misses}`)}catch(e){o.warn("[EventDataCache] Failed to record cache miss:",e)}}static resetStats(){this.stats={hits:0,misses:0,timeSavedMs:0,lastClearTime:Date.now()},o.log("[EventDataCache] Cache statistics reset")}static logCacheStats(){try{let e=this.stats.hits+this.stats.misses>0?(this.stats.hits/(this.stats.hits+this.stats.misses)*100).toFixed(1):"0.0";o.log(`[EventDataCache] Statistics - Hits: ${this.stats.hits}, Misses: ${this.stats.misses}, Hit Rate: ${e}%, Total Time Saved: ${this.stats.timeSavedMs.toFixed(2)}ms, Avg Time Saved per Hit: ${this.stats.hits>0?(this.stats.timeSavedMs/this.stats.hits).toFixed(2):"0.00"}ms`)}catch(e){o.warn("[EventDataCache] Failed to log cache statistics:",e)}}};N.staticData=null,N.config={enabled:!0},N.stats={hits:0,misses:0,timeSavedMs:0,lastClearTime:Date.now()},N.initialized=!1});var hn,vt,vn,yn,Qt,bn,Cn,wc,wn,_n,f,S=p(()=>{"use strict";k();h();y();Wt();hn={hiddenPageTimeout:3e4,enableSPATracking:!1,enableVisibilityTracking:!0,trackHashChanges:!1},vt={enabled:!0,ping_interval_seconds:15,send_on_visibility_change:!0,min_active_time_for_visibility_ping:3,visibility_debounce_ms:1e3,enable_spa_tracking:!1,ping_decay_schedule:[],ping_sampling_rate:1},vn={enabled:!0,maxEvents:100,ttlHours:24,maxAttempts:3},yn={enabled:!1,report_interval_seconds:300},Qt={trackInertClicks:!1,inertClickSamplingRate:1,internalHosts:[]},bn={enabled:!1,samplingRate:1,rawHtmlCheck:!1,rawHtmlCheckSamplingRate:.01,maxChecksPayloadBytes:2048},Cn={enabled:!0,articleDetection:"auto",articlePaths:[],wordCount:"auto"},wc="dataLayer",wn={enabled:!1,cookieName:"naviga_ab_session",variantCookiePrefix:"naviga_ab_variant_",tokenQueryParam:"naviga_ab_token",previewQueryParam:"naviga_ab_preview",headlineSelectors:["h1","h2","h3"],experimentTTLSeconds:60,variantCookieDays:30,exposureGating:!0,stickinessMode:"session"},_n={treatReplaceStateAsNavigation:!1},f=class{static set(e){l(()=>{this.config={...this.config,...e},e.enableEventDataCaching!==void 0&&N.setEnabled(e.enableEventDataCaching),this.validateEncryptionConfig()},void 0)}static get(){return l(()=>({...this.config}),{organisation_name:"",publication_name:"",publication_id:"",api_base_url:"",api_key:"",loggingEnabled:!1,sdk_health_enabled:!1,preload:!1})}static isSdkHealthEnabled(){return l(()=>this.config.sdk_health_enabled===!0,!1)}static disable_set(e){l(()=>{this.disable_config={...this.disable_config,...e}},void 0)}static disable_get(){return l(()=>this.disable_config,{DisableOption:!1})}static getValue(e){return l(()=>this.config[e],void 0)}static getArticleDetails(){return _(()=>{let e=this.config.articleDetailsMapping;if(!e||!e.variableName)return o.warn("Article details mapping not configured"),{};let t=this.getGlobalVariable(e.variableName,e.path);return t||(o.warn(`Article details variable "${e.variableName}" not found`),{})}
1,{message:"Failed to get article details",severity:"medium",source:"ConfigManager.getArticleDetails",configKey:"articleDetailsMapping"})}static getUserDetails(){return _(()=>{let e=this.config.userDetailsMapping;if(!e||!e.variableName)return o.warn("User details mapping not configured"),{};let t=this.getGlobalVariable(e.variableName,e.path);return t||(o.warn(`User details variable "${e.variableName}" not found`),{})},{message:"Failed to get user details",severity:"medium",source:"ConfigManager.getUserDetails",configKey:"userDetailsMapping"})}static getCustomEventCommonDetails(){return l(()=>{var i;let e=(i=this.config.customEvents)==null?void 0:i.commonDetailsMapping;if(!e||!e.variableName)return{};let t=this.getGlobalVariable(e.variableName,e.path);return!t||typeof t!="object"||Array.isArray(t)?(o.warn(`[ConfigManager] customEvents.commonDetailsMapping variable "${e.variableName}" not found or not an object`),{}):{...t}},{})}static getCustomEventExcludeKeys(){var e;return this.normalizeKeyList((e=this.config.customEvents)==null?void 0:e.excludeKeys)}static getCrossDomainLinkerHosts(){return l(()=>{var t;let e=(t=this.config.customEvents)==null?void 0:t.linkerHosts;return e===void 0?[".subscriberconcierge.com"]:Array.isArray(e)?e.filter(i=>typeof i=="string").map(i=>i.trim().toLowerCase()).filter(i=>i!==""):[]},[".subscriberconcierge.com"])}static getCustomEventBindings(){return l(()=>{var t;let e=(t=this.config.customEvents)==null?void 0:t.bindings;return Array.isArray(e)?e.filter(i=>i&&typeof i=="object"&&(i.sourceType==="dom"||i.sourceType==="knockout")&&typeof i.sourceEventName=="string"&&i.sourceEventName.trim()!==""&&typeof i.targetEventName=="string"&&i.targetEventName.trim()!==""&&(i.payloadMapper===void 0||typeof i.payloadMapper=="function")):[]},[])}static normalizeKeyList(e){return l(()=>{if(!Array.isArray(e))return[];let t=e.filter(i=>typeof i=="string").map(i=>i.trim()).filter(i=>i.length>0);return Array.from(new Set(t))},[])}static resolveMappedGlobal(e){return l(()=>!e||!e.variableName?null:this.getGlobalVariable(e.variableName,e.path),null)}static getGlobalVariable(e,t){return l(()=>{let i=window[e];return i?t?t.split(".").reduce((r,a)=>r&&r[a]!==void 0?r[a]:null,i):i:null},null)}static setPageLeaveConfig(e){l(()=>{this.pageLeaveConfig={...hn,...e},o.info("[ConfigManager] Page leave config updated:",this.pageLeaveConfig)},void 0)}static getPageLeaveConfig(){return l(()=>({...this.pageLeaveConfig}),{...hn})}static setHeartbeatConfig(e){l(()=>{let t={};if(e.enabled!==void 0&&(t.enabled=e.enabled),e.ping_interval_seconds!==void 0&&(t.ping_interval_seconds=e.ping_interval_seconds),e.send_on_visibility_change!==void 0&&(t.send_on_visibility_change=e.send_on_visibility_change),e.min_active_time_for_visibility_ping!==void 0&&(t.min_active_time_for_visibility_ping=e.min_active_time_for_visibility_ping),e.visibility_debounce_ms!==void 0&&(t.visibility_debounce_ms=e.visibility_debounce_ms),e.enable_spa_tracking!==void 0&&(t.enable_spa_tracking=e.enable_spa_tracking),e.ping_decay_schedule!==void 0&&(t.ping_decay_schedule=e.ping_decay_schedule),e.ping_sampling_rate!==void 0&&(t.ping_sampling_rate=e.ping_sampling_rate),t.ping_decay_schedule!==void 0){let i=Array.isArray(t.ping_decay_schedule)?t.ping_decay_schedule:[],r=i.filter(a=>a&&Number.isFinite(a.after_seconds)&&Number.isFinite(a.interval_seconds)&&a.after_seconds>=0).map(a=>({after_seconds:Math.floor(a.after_seconds),interval_seconds:Math.min(300,Math.max(5,Math.floor(a.interval_seconds)))})).sort((a,s)=>a.after_seconds-s.after_seconds);r.length!==i.length&&o.warn("[ConfigManager] Dropped invalid ping_decay_schedule entries"),t.ping_decay_schedule=r}if(t.ping_sampling_rate!==void 0){let i=t.ping_sampling_rate;(!Number.isFinite(i)||i<0||i>1)&&(o.warn(`[ConfigManager] Invalid ping_sampling_rate: ${i}. Must be 0..1. Using default: 1`),t.ping_sampling_rate=1)}t.ping_interval_seconds!==void 0&&(t.ping_interval_seconds<5||t.ping_interval_seconds>60)&&(o.warn(`[ConfigManager] Invalid ping_interval_seconds: ${t.ping_interval_seconds}. Must be between 5 and 60. Using default value: ${vt.ping_interval_seconds}`),t.ping_interval_seconds=vt.ping_interval_seconds),this.heartbeatConfig={...vt,...t},o.info("[ConfigManager] Heartbeat config updated:",this.heartbeatConfig)},void 0)}static getHeartbeatConfig(){return l(()=>({...this.heartbeatConfig}),{...vt})}static setABConfig(e){l(()=>
1{this.abTestingConfig={...wn,...e},o.info("[ConfigManager] A/B testing config updated:",this.abTestingConfig)},void 0)}static getABConfig(){return l(()=>({...this.abTestingConfig}),{...wn})}static setEventQueueConfig(e){l(()=>{this.eventQueueConfig={...vn,...e},o.info("[ConfigManager] Event queue config updated:",this.eventQueueConfig)},void 0)}static getEventQueueConfig(){return l(()=>({...this.eventQueueConfig}),{...vn})}static setTelemetryConfig(e){l(()=>{this.telemetryConfig={...yn,...e},o.info("[ConfigManager] Telemetry config updated:",this.telemetryConfig)},void 0)}static getTelemetryConfig(){return l(()=>({...this.telemetryConfig}),{...yn})}static setClickTrackingConfig(e){l(()=>{let t={...Qt};if(e&&e.trackInertClicks!==void 0&&(t.trackInertClicks=e.trackInertClicks===!0),e&&e.inertClickSamplingRate!==void 0){let i=e.inertClickSamplingRate;!Number.isFinite(i)||i<0||i>1?o.warn(`[ConfigManager] Invalid inertClickSamplingRate: ${i}. Must be 0..1. Using default: ${Qt.inertClickSamplingRate}`):t.inertClickSamplingRate=i}e&&e.internalHosts!==void 0&&(t.internalHosts=this.normalizeKeyList(e.internalHosts).map(i=>i.toLowerCase())),this.clickTrackingConfig=t,o.info("[ConfigManager] Click tracking config updated:",this.clickTrackingConfig)},void 0)}static getClickTrackingConfig(){return l(()=>({...this.clickTrackingConfig}),{...Qt})}static setContentReadinessConfig(e){l(()=>{this.contentReadinessConfig={...bn,...e},o.info("[ConfigManager] Content readiness config updated:",this.contentReadinessConfig)},void 0)}static getContentReadinessConfig(){return l(()=>({...this.contentReadinessConfig}),{...bn})}static setSpaNavigationConfig(e){l(()=>{let t={..._n};e&&e.treatReplaceStateAsNavigation!==void 0&&(t.treatReplaceStateAsNavigation=e.treatReplaceStateAsNavigation===!0),this.spaNavigationConfig=t,o.info("[ConfigManager] SPA navigation config updated:",this.spaNavigationConfig)},void 0)}static getSpaNavigationConfig(){return l(()=>({...this.spaNavigationConfig}),{..._n})}static setAutoContextConfig(e){l(()=>{let t={...Cn};if(e&&e.enabled!==void 0&&(t.enabled=e.enabled),e&&e.articleDetection!==void 0&&(t.articleDetection=e.articleDetection),e&&e.articlePaths!==void 0&&(t.articlePaths=Array.isArray(e.articlePaths)?[...e.articlePaths]:[]),e&&e.wordCount!==void 0&&(t.wordCount=e.wordCount),e&&e.dataLayerMapping!==void 0){let i=e.dataLayerMapping;i&&typeof i=="object"&&(t.dataLayerMapping={variableName:typeof i.variableName=="string"&&i.variableName.trim()!==""?i.variableName:wc,fields:i.fields&&typeof i.fields=="object"?{...i.fields}:{}})}e&&e.profile!==void 0&&e.profile&&typeof e.profile=="object"&&(t.profile={...e.profile}),e&&e.pageClasses!==void 0&&(t.pageClasses=this.sanitizePageClasses(e.pageClasses)),this.autoContextConfig=t,o.info("[ConfigManager] Auto context config updated:",this.autoContextConfig)},void 0)}static getAutoContextConfig(){return l(()=>({...this.autoContextConfig}),{...Cn})}static sanitizePageClasses(e){return l(()=>{if(!e||typeof e!="object"||Array.isArray(e))return;let t={};for(let[i,r]of Object.entries(e)){if(!r||typeof r!="object"||Array.isArray(r))continue;let a={},{hosts:s,paths:c}=r;Array.isArray(s)&&(a.hosts=[...s]),Array.isArray(c)&&(a.paths=[...c]),t[i]=a}return t},void 0)}static validateEncryptionConfig(){l(()=>{let{enableEncryption:e,publicKey:t,encryptionKeys:i}=this.config;if(i!==void 0){if(!Array.isArray(i)){o.error("[ConfigManager] encryptionKeys must be an array");return}i.forEach((a,s)=>{typeof a!="string"||a.trim()===""?o.error(`[ConfigManager] encryptionKeys[${s}] must be a non-empty string`):this.hasInvalidFieldPathCharacters(a)&&o.warn(`[ConfigManager] encryptionKeys[${s}] "${a}" contains invalid characters or malformed dot notation`)})}t!==void 0&&t!==""&&(this.isValidPEMFormat(t)||o.error("[ConfigManager] publicKey must be in PEM format (contains BEGIN/END markers)")),e===!0&&(!t||t.trim()==="")&&o.error("[ConfigManager] Encryption is enabled but publicKey is missing");let r=Array.isArray(i)&&i.some(a=>typeof a=="string"&&a.trim()!=="");e===!0&&!r&&o.error("[ConfigManager] Encryption is enabled but encryptionKeys is empty \u2014 NO fields will be encrypted. List the field paths to encrypt, e.g. encryptionKeys: ['user_id', 'hashed_email']")},void 0)}static isValidPEMFormat(e){return l(()=>{let t=e.trim();return t.includes("-----BEGIN")&&t.includes("-----END")},!1)}static hasInvalidFieldPathCharacters(e){return l(()=>!/^[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)*$/.test(e),!1)}static getEncryptionConfig(){return l(()=>{let{enableEncryption:e,encryptionKeys:t,publicKey:i}=this.config;return{enabled:e===!0,keys:Array.isArray(t)?t.filter(r=>typeof r=="string"&&r.trim()!==""):[],publicKey:i&&i.trim()!==""?i:void 0}},{enabled:!1,keys:[],publicKey:void 0})}};f.config={organisation_name:"",publication_name:"",publication_id:"",api_base_url:"",bff_base_url:"",api_key:"",loggingEnabled:!1,sdk_health_enabled:!1,preload:!0},f.pageLeaveConfig={...hn},f.heartbeatConfig={...vt}
1,f.abTestingConfig={...wn},f.eventQueueConfig={...vn},f.telemetryConfig={...yn},f.clickTrackingConfig={...Qt},f.contentReadinessConfig={...bn},f.spaNavigationConfig={..._n},f.autoContextConfig={...Cn},f.disable_config={DisableOption:!1}});var _c,Re,Yt=p(()=>{"use strict";_c={page_title:"",article_section:"",article_section_uuid:"",article_title:"",author_uuid:"",author_name:"",article_url:"",article_uuid:"",article_publication_date:"",article_is_premium:"",additional_info:{},article_concept_uuid:"",article_concept_name:"",article_publication:"",article_content:""},Re=_c});function Ec(n){if(typeof n!="string")return null;let e=n.trim();if(e==="")return null;let t=Math.min(e.indexOf("?")===-1?e.length:e.indexOf("?"),e.indexOf("#")===-1?e.length:e.indexOf("#"));return e=e.slice(0,t),e===""?null:e.startsWith("/")?e:`/${e}`}function ea(n){if(typeof n!="string")return null;let e=n.trim();if(e==="")return null;if(e.length>Xr)return o.warn(`[PathMatcher] ignoring oversized articlePaths entry (${e.length} chars > ${Xr})`),null;let t=e.endsWith("*")?e.slice(0,-1):e;return t.includes("*")?(o.warn(`[PathMatcher] ignoring articlePaths entry "${e}" \u2014 only a trailing "*" is supported, and a "*" in the middle cannot be expressed as a path prefix. Use the prefix alone, e.g. '/news/'.`),null):t===""?null:t.startsWith("/")?t:`/${t}`}function Sc(n,e){if(!n.startsWith(e))return!1;if(e.endsWith("/"))return!0;let t=n.charAt(e.length);return t===""||t==="/"}function yt(n,e){return l(()=>{if(!Array.isArray(e)||e.length===0)return!1;let t=Ec(n);if(t===null)return!1;for(let i of e.slice(0,Zr)){let r=ea(i);if(r!==null&&Sc(t,r))return!0}return!1},!1)}function Ze(n){return l(()=>Array.isArray(n)?n.slice(0,Zr).some(e=>ea(e)!==null):!1,!1)}var Zr,Xr,Jt=p(()=>{"use strict";y();h();Zr=50,Xr=256});function Xt(n,e){let t=(n||"").toLowerCase();return t?e.some(i=>i.startsWith(".")?t===i.slice(1)||t.endsWith(i):t===i):!1}var En=p(()=>{"use strict"});function Ct(n){return!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(n)&&!n.startsWith("//")}function Sn(n){for(let t of Ac)if(n.has(t))return!0;let e=n.get("error");return!!(e!==null&&kc.has(e))}function An(n){return Sn(n)||n.has("code")&&n.has("state")}function ta(n){return typeof n!="string"||n.indexOf("?")===-1?null:new URL(n,Ct(n)?bt:void 0).searchParams}function kn(n){return l(()=>{let e=ta(n);return e!==null&&Sn(e)},!1)}function ia(n){return l(()=>{let e=ta(n);return e!==null&&An(e)&&!Sn(e)},!1)}var Ac,kc,bt,Tn=p(()=>{"use strict";h();Ac=["access_token","id_token","id_token_hint","refresh_token","code_verifier","code_challenge","client_secret","session_state","error_description","error_uri","response_type","grant_type","token_type","redirect_uri"],kc=new Set(["invalid_request","unauthorized_client","access_denied","unsupported_response_type","invali
1d_scope","server_error","temporarily_unavailable","interaction_required","login_required","account_selection_required","consent_required","invalid_request_uri","invalid_request_object","request_not_supported","request_uri_not_supported","registration_not_supported"]),bt="http://relative.invalid"});function ra(){try{let n=window;return n[na]===!0?!1:(n[na]=!0,!0)}catch{return!0}}function xn(n){try{n()}catch(e){o.error("[StartupBoundary] Queued startup task failed:",e)}}function Zt(n){if(wt){xn(n);return}Pn.push(n)}function aa(n=Rn,e){wt||et!==null||(et=setTimeout(()=>{et=null,e&&xn(e),In("grace period elapsed without init()")},n))}function In(n){if(wt)return;wt=!0,et!==null&&(clearTimeout(et),et=null);let e=Pn;Pn=[],e.length>0&&o.info(`[StartupBoundary] Ready (${n}); running ${e.length} queued startup task(s)`);for(let t of e)xn(t)}function ei(){return wt}var na,Rn,wt,Pn,et,ti=p(()=>{"use strict";y();na="__navigaAnalyticsInstalled";Rn=250,wt=!1,Pn=[],et=null});function oa(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.trim()!==""):[]}function Pc(n,e){if(!n)return!1;let t=n.toLowerCase();return oa(e).some(i=>i.toLowerCase()===t)}function sa(n){return l(()=>{if(!n||typeof n!="object")return!1;let{hosts:e,paths:t}=n;return oa(e).length>0||Ze(t)},!1)}function la(n){return l(()=>new URL(n,Ct(n)?bt:void 0),null)}function Rc(){return l(()=>{if(typeof performance=="undefined"||typeof performance.getEntriesByType!="function")return null;let n=performance.getEntriesByType("navigation"),e=Array.isArray(n)&&n.length>0?n[0].name:"";return typeof e!="string"||e.trim()===""||la(e)===null?null:e},null)}function ua(){var n;ii===null&&(ii=(n=Rc())!=null?n:l(()=>typeof window!="undefined"?window.location.href:"",""))}function Dn(){return!ca&&ii?ii:null}function xc(){var e,t;let n=Dn();return n===null?null:(t=(e=la(n))==null?void 0:e.pathname)!=null?t:null}function da(){return l(()=>{let n=Dn();return n===null?null:ia(n)?Ic:null},null)}var _t,tt,Tc,ii,ca,q,Ic,it=p(()=>{"use strict";S();En();y();Tn();h();ti();Jt();_t="[PageClassContext]",tt=["transit","commerce","content"],Tc=new Set(["content","commerce","transit","unknown"]);ii=null,ca=!1;q=class{static resolve(){if(this.decision)return{...this.decision};let e=l(()=>this.classify(),{pageClass:"unknown",source:"default"});return(this.apiOverride!==null||ei())&&(this.decision=e,o.info(`${_t} classified ${e.pageClass} via ${e.source}`)),{...e}}static setPageClass(e){l(()=>{if(!Tc.has(e)){o.warn(`${_t} ignoring unknown page class ${JSON.stringify(e)}; unchanged`);return}if(this.apiOverride=e,this.decision){let t=this.decision;this.decision={pageClass:e,source:"api"},o.warn(`${_t} setPageClass(${e}) after this page session latched as ${t.pageClass}; sent events keep the old class`);return}o.info(`${_t} page class set to ${e}`)},void 0)}static reset(){this.decision=null,this.apiOverride=null,ca=!0,o.log(`${_t} reset for new page session`)}static isDecided(){return this.decision!==null}static classify(){if(this.apiOverride)return{pageClass:this.apiOverride,source:"api"};let e=this.resolveFromConfig();if(e)return{pageClass:e,source:"config"};let t=this.resolveFromHeuristic();return t?{pageClass:t,source:"heuristic"}:{pageClass:"unknown",source:"default"}}static resolveFromConfig(){var e,t;return(t=(e=this.resolveDeclaredPageClass())!=null?e:this.resolveFromConfigPatterns())!=null?t:this.resolveFromLinkerHosts()}static resolveDeclaredPageClass(){let e=f.getValue("pageClass");return typeof e=="string"&&tt.includes(e)?e:null}static resolveFromConfigPatterns(){var s;let e=f.getAutoContextConfig().pageClasses;if(!e||typeof e!="object")return null;let t=l(()=>window.location.pathname,""),i=l(()=>window.location.hostname,""),r=xc(),a=r!==null&&r!==t?r:null;for(let c of tt){let u=e[c];if(!u||typeof u!="object")continue;let d=(s=u.paths)!=null?s:[];if(Pc(i,u.hosts)||yt(t,d)||a!==null&&yt(a,d))return c}return null}static resolveFromLinkerHosts(){let e=f.getCrossDomainLinkerHosts();if(e.length===0)return null;let t=l(()=>window.location.hostname,"");return Xt(t,e)?"commerce":null}static resolveFromHeuristic(){let e=l(()=>window.location.href,"");if(e&&kn(e))return"transit";let t=Dn();return t!==null&&kn(t)?"transit":null}};q.decision=null,q.apiOverride=null;Ic="oauth_url_shape"});var ie,nt=p(()=>
1{ie={SDK_VERSION:"1.7.0",API_BASE_URL:"",Session:{session_key:"naviga-analytics-session",timeout_ms:18e5},DeviceId:{storage_key:"naviga-analytics-device-id"},ARTICLE_READING_SPEED_WPM:225,Heartbeat:{enabled:!0,ping_interval_seconds:15,send_on_visibility_change:!0,min_active_time_for_visibility_ping:3,visibility_debounce_ms:1e3,enable_spa_tracking:!1}}});var me,ri=p(()=>{"use strict";h();me=class{constructor(e,t){this.loadPromise=null;this.loader=e,this.errorDetails=t}async get(){return this.loadPromise||(this.loadPromise=C(this.loader,this.errorDetails)),this.loadPromise}isLoaded(){return this.loadPromise!==null}preload(){this.loadPromise||(this.loadPromise=C(this.loader,this.errorDetails))}}});function ha(n){return Fc.replace(/[xy]/g,e=>{let t=n();return(e==="x"?t:t&3|8).toString(16)})}function xe(){if(typeof crypto!="undefined"&&crypto&&typeof crypto.randomUUID=="function")try{return crypto.randomUUID()}catch(n){o.warn("[uuid] crypto.randomUUID failed:",n)}if(typeof crypto!="undefined"&&crypto&&typeof crypto.getRandomValues=="function")try{return ha(()=>crypto.getRandomValues(new Uint8Array(1))[0]%16)}catch(n){o.warn("[uuid] crypto.getRandomValues failed:",n)}return ha(()=>Math.random()*16|0)}var Fc,Et=p(()=>{"use strict";y();Fc="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"});var ze,va,oe,ya=p(()=>{"use strict";h();y();k();Et();nt();ze=ie.DeviceId.storage_key,va="anonymous-"+Math.random().toString(36).substring(2,15),oe=class{static getPersistentUUID(){return _(()=>{let e=null;try{typeof localStorage!="undefined"&&(e=localStorage.getItem(ze))}catch(t){o.warn("[UUIDDeviceIdentifier] Failed to read from localStorage:",t)}if(e)o.info("[UUIDDeviceIdentifier] Retrieved existing persistent device ID");else{e=xe(),o.info("[UUIDDeviceIdentifier] Generated new persistent device ID:",e);try{typeof localStorage!="undefined"&&(localStorage.setItem(ze,e),o.info("[UUIDDeviceIdentifier] Device ID saved to localStorage"))}catch(t){o.warn("[UUIDDeviceIdentifier] Failed to save device ID to localStorage:",t)}}return e},{message:"Failed to get persistent UUID",severity:"high",source:"UUIDDeviceIdentifier.getPersistentUUID"}).unwrapOr(va)}static getCurrentDeviceId(){return _(()=>{try{return typeof localStorage!="undefined"?localStorage.getItem(ze):null}catch(e){return o.warn("[UUIDDeviceIdentifier] Failed to read device ID from localStorage:",e),null}},{message:"Failed to get current device ID",severity:"low",source:"UUIDDeviceIdentifier.getCurrentDeviceId"}).unwrapOr(null)}static hasStoredDeviceId(){return _(()=>{try{if(typeof localStorage!="undefined"){let e=localStorage.getItem(ze);return e!=null}return!1}catch(e){return o.warn("[UUIDDeviceIdentifier] Failed to check stored device ID:",e),!1}},{message:"Failed to check stored device ID",severity:"low",source:"UUIDDeviceIdentifier.hasStoredDeviceId"}).unwrapOr(!1)}static clearDeviceId(){_(()=>{try{typeof localStorage!="undefined"&&(localStorage.removeItem(ze),o.info("[UUIDDeviceIdentifier] Device ID cleared from localStorage"))}catch(e){o.warn("[UUIDDeviceIdentifier] Failed to clear device ID from localStorage:",e)}},{message:"Failed to clear device ID",severity:"low",source:"UUIDDeviceIdentifier.clearDeviceId"})}static regenerateDeviceId(){return this.clearDeviceId(),this.getPersistentUUID()}static getDeviceIdStats(){return _(()=>{let e=this.getCurrentDeviceId(),t=this.hasStoredDeviceId();return{storageKey:ze,uuidDeviceId:e?e.substring(0,8)+"...":null,hasStoredUUID:t,fallbackId:va.substring(0,8)+"..."}},{message:"Failed to get UUID device ID statistics",severity:"low",source:"UUIDDeviceIdentifier.getDeviceIdStats"}).unwrapOr({})}static isValidUUID(e){return _(()=>/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e),{message:"Failed to validate UUID format",severity:"low",source:"UUIDDeviceIdentifier.isValidUUID"}).unwrapOr(!1)}static getStorageKey(){return ze}static getUUIDCapabilities(){return _(()=>({hasCryptoRandomUUID:typeof crypto!="undefined"&&typeof crypto.randomUUID=="function",hasCryptoGetRandomValues:typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function",hasLocalStorage:typeof localStorage!="undefined",mathRandomFallback:!0}),{message:"Failed to get UUID capabilities",severity:"low",source:"UUIDDeviceIdentifier.getUUIDCapabilities"}).unwrapOr({hasCryptoRandomUUID:!1,hasCryptoGetRandomValues:!1,hasLocalStorage:!1,mathRandomFallback:!0})}}});function ai(n,e){try{return n()}catch{return e}}var eg,oi,ba,Ca,si=p(()=>{"use strict";eg=ai(()=>"split","single"),oi=ai(()=>"analytics.abtesting.hud.1.7.0.min.js",""),ba=ai(()=>"",""),Ca=ai(()=>!1,!0)});var wa={};O(wa,{load:()=>Hc});function Hc(){return Promise.reject(new Error("fingerprintjs is not bundled in this build (BUNDLE_MODE=split). Rebuild with INCLUDE_FINGERPRINT=1 if a site requires anonymousIdProcessor: 'fingerprint'."))}var _a=p(()=>{});var Ln,Ie,ci=p(()=>{"use strict";h();ri();S();y();k();ya();Xe();si();Ln=new me(()=>Promise.resolve().then(()=>(_a(),wa)).then(n=>n.load()),{message:"Failed to load fingerprint library",severity:"high",source:"DeviceIdentifier.loadFingerprint",moduleName:"@fingerprintjs/fingerprintjs"}),Ie=class{static async getVisitorId(){return await C(async()=>{let t=f.get().anonymousIdProcessor;return o.info("[DeviceIdentifier] Anonymous ID Processor:",t),t==="fingerprint"?Ca?(o.info("[DeviceIdentifier] Using fingerprint-based device ID"),await this.getFingerprintId()):(V.report({message:"Site config requests anonymousIdProcessor 'fingerprint' but fingerprintjs is not bundled in this build \u2014 falling back to persistent UUID, which changes this site's device_id strategy. Rebuild with INCLUDE_FINGERPRINT=1.",severity:"high",source:"DeviceIdentifier.fingerprintNotBundled"}),o.error("[DeviceIdentifier] fingerprintjs not bundled; using persistent UUID"),oe.getPersistentUUID()):(o.info("[DeviceIdentifier] Using persistent UUID-based device ID"),oe.getPersistentUUID())},{message:"Failed to generate visitor ID",severity:"high",source:"DeviceIdentifier.getVisitorId",fallbackUsed:!0})}static async getFingerprintId(){try{let e=await Ln.get();if(!e.success)return o.warn("[DeviceIdentifier] Fingerprint loading failed, falling back to persistent UUID"),oe.getPersistentUUID();let t=e.value;if(!t)return o.warn("[DeviceIdentifier] Fingerprint instance not available, falling back to persistent UUID"),oe.getPersistentUUID();let i=await t.get();return o.info("[DeviceIdentifier] Fingerprint device ID generated successfully"),i.visitorId}catch(e){return o.warn("[DeviceIdentifier] Fingerprint generation failed:",e),oe.getPersistentUUID()}}static getCurrentDeviceId(){return _(()=>f.get().anonymousIdProcessor==="fingerprint"?(o.info("[DeviceIdentifier] Cannot retrieve fingerprint-based device ID without regeneration"),null):oe.getCurrentDeviceId(),{message:"Failed to get current device ID",severity:"low",source:"DeviceIdentifier.getCurrentDeviceId"}).unwrapOr(null)}static hasStoredDeviceId(){return _(()=>f.get().anonymousIdProcessor==="fingerprint"?!1:oe.hasStoredDeviceId(),{message:"Failed to check 
1stored device ID",severity:"low",source:"DeviceIdentifier.hasStoredDeviceId"}).unwrapOr(!1)}static getDeviceIdType(){return _(()=>{let t=f.get().anonymousIdProcessor;return t==="fingerprint"?"fingerprint":"uuid"},{message:"Failed to get device ID type",severity:"low",source:"DeviceIdentifier.getDeviceIdType"}).unwrapOr("unknown")}static getDeviceIdStats(){return _(()=>{let e=this.getCurrentDeviceId(),t=this.hasStoredDeviceId(),i=this.getDeviceIdType(),r={currentDeviceId:e?e.substring(0,8)+"...":null,hasStoredId:t,idType:i,fingerprintLoaded:Ln.isLoaded()};return i==="uuid"?{...r,...oe.getDeviceIdStats()}:r},{message:"Failed to get device ID statistics",severity:"low",source:"DeviceIdentifier.getDeviceIdStats"}).unwrapOr({})}static preload(){f.get().anonymousIdProcessor==="fingerprint"?(o.info("[DeviceIdentifier] Preloading fingerprint library"),Ln.preload()):o.info("[DeviceIdentifier] Skipping fingerprint preload (using persistent UUID mode)")}}});var li,ui,Ea,se,St=p(()=>{"use strict";k();h();ri();ht();ui={detectPlatformType(){let n=navigator.userAgent.toLowerCase(),e=/ipad|android(?!.*mobile)|tablet|kindle|playbook/.test(n)||navigator.maxTouchPoints>1&&screen.width>=768&&screen.width<=1024;return/iphone|ipod|android.*mobile|blackberry|phone/.test(n)||navigator.maxTouchPoints>1&&screen.width<768?"mobile":e?"tablet":"desktop"},isIOSSafari(){let n=navigator.userAgent,e=/iPad|iPhone|iPod/.test(n),t=/Safari/.test(n)&&!/Chrome|CriOS|FxiOS|EdgiOS/.test(n);return e&&t},isIOS(){return/iPad|iPhone|iPod/.test(navigator.userAgent)},isDesktop(){return this.detectPlatformType()==="desktop"},detectPlatformModel(){let n=navigator.userAgent,e=[{pattern:/Edg\//i,name:"Edge"},{pattern:/Edge\//i,name:"Edge"},{pattern:/Arc\//i,name:"Arc"},{pattern:/Atlas\//i,name:"Atlas"},{pattern:/Comet\//i,name:"Comet"},{pattern:/Brave\//i,name:"Brave"},{pattern:/Vivaldi\//i,name:"Vivaldi"},{pattern:/OPR\//i,name:"Opera"},{pattern:/Opera/i,name:"Opera"},{pattern:/SamsungBrowser\//i,name:"Samsung Internet"},{pattern:/UCBrowser\//i,name:"UC Browser"},{pattern:/DuckDuckGo\//i,name:"DuckDuckGo"},{pattern:/Yandex\//i,name:"Yandex"},{pattern:/Chrome\//i,name:"Chrome"},{pattern:/Firefox\//i,name:"Firefox"},{pattern:/Safari\//i,name:"Safari"}];for(let{pattern:t,name:i}of e)if(t.test(n))return i;return"unknown"},detectPlatformVersion(){let n=navigator.userAgent,e=[{pattern:/Edg\/([\d.]+)/,name:"Edge"},{pattern:/Edge\/([\d.]+)/,name:"Edge"},{pattern:/Arc\/([\d.]+)/,name:"Arc"},{pattern:/Atlas\/([\d.]+)/,name:"Atlas"},{pattern:/Comet\/([\d.]+)/,name:"Comet"},{pattern:/Brave\/([\d.]+)/,name:"Brave"},{pattern:/Vivaldi\/([\d.]+)/,name:"Vivaldi"},{pattern:/OPR\/([\d.]+)/,name:"Opera"},{pattern:/Opera\/([\d.]+)/,name:"Opera"},{pattern:/SamsungBrowser\/([\d.]+)/,name:"Samsung Internet"},{pattern:/UCBrowser\/([\d.]+)/,name:"UC Browser"},{pattern:/DuckDuckGo\/([\d.]+)/,name:"DuckDuckGo"},{pattern:/Yandex\/([\d.]+)/,name:"Yandex"},{pattern:/Chrome\/([\d.]+)/,name:"Chrome"},{pattern:/Version\/([\d.]+)/,name:"Safari"},{pattern:/Firefox\/([\d.]+)/,name:"Firefox"}];for(let{pattern:t}of e){let i=n.match(t);if(i)return i[1]}return"unknown"},detectPlatformOS(){if(typeof navigator=="undefined")return"unknown";let n=navigator.userAgent;return/Android/i.test(n)?/Mobile/i.test(n)?"Android Phone":"Android Tablet":/iPhone|iPod/i.test(n)?"iOS Phone":/iPad/i.test(n)?"iOS Tablet":/Win|Windows/i.test(n)?"Windows":/Mac/i.test(n)&&!/iPhone|iPod|iPad/i.test(n)?"macOS":/CrOS/i.test(n)?"ChromeOS":/Linux/i.test(n)&&!/Android/i.test(n)?"Linux":"unknown"}},Ea=new me(async()=>ui,{message:"Failed to load platform detection",severity:"medium",source:"PlatformDetector.load",moduleName:"PlatformDetection"}),se=class{static async getPlatformInfo(){return li?Y(li):await C(async()=>{let e=await Ea.get();if(!e.success)throw new Error("Failed to load platform detection module");let t=e.value;return li={type:t.detectPlatformType(),model:t.detectPlatformModel(),version:t.detectPlatformVersion(),os:t.detectPlatformOS()},li},{message:"Failed to detect platform information",severity:"medium",source:"PlatformDetector.getPlatformInfo"})}static preload(){Ea.preload()}static isIOSSafari(){return typeof navigator=="undefined"?!1:ui.isIOSSafari()}static isIOS(){return typeof navigator=="undefined"?!1:ui.isIOS()}static isDesktop(){return typeof navigator=="undefined"?!1:ui.isDesktop()}}});var Mn,De,Nn=p(()=>{"use strict";y();Mn="naviga-analytics-user-identity",De=class{static set(e,t){if(typeof e!="string"||e.length===0){o.warn("[UserIdentity] set() ignored: userId must be a non-empty string");return}if(typeof localStorage!="undefined")try{let i={userId:e,traits:t&&typeof t=="object"?t:void 0,identifiedAt:Date.now()};localStorage.setItem(Mn,JSON.stringify(i))}catch(i){o.warn("[UserIdentity] Failed to persist identity:",i)}}static clear(){if(typeof localStorage!="undefined")try{localStorage.removeItem(Mn)}catch(e){o.warn("[UserIdentity] Failed to clear identity:",e)}}static getUserId(){var e,t;return(t=(e=this.read())==null?void 0:e.userId)!=null?t:null}static getTraits(){var e,t;return(t=(e=this.read())==null?void 0:e.traits)!=null?t:null}static hasIdentity(){return this.read()!==null}static identifiedAt(){var e,t;return(t=(e=this.read())==null?void 0:e.identifiedAt)!=null?t:null}static read(){if(typeof localStorage=="undefined")return null;try{let e=localStorage.getItem(Mn);if(!e)return null;let t=JSON.parse(e);return typeof(t==null?void 0:t.userId)!="string"||t.userId.length===0?null:t}catch{return null}}}});function Bc(){try{let n=document.currentScript,e=n&&n.src;if(!e)return"";let t=new URL(e,window.location.href);return`${t.origin}${t.pathname.replace(/[^/]*$/,"")}`}catch{return""}}function Sa(){di===null&&(di=Bc())}function Aa(){return di||""}function ka(n){if(!n)return"";let e=di||""||ba;return e?`${e.replace(/\/*$/,"/")}${n}`:""}var di,Un=p(()=>{"use strict";si();di=null});var On,Vc,he,fi=p(()=>{"use strict";y();h();On="[ContentAccessContext]",Vc=new Set(["granted","metered","blocked"]),he=class{static set(e){l(()=>{if(!Vc.has(e)){o.warn(`${On} ignoring unknown content access ${JSON.stringify(e)}; unchanged`);return}this.access=e,o.info(`${On} content access set to ${e}`)},void 0)}static get(){return this.access}
1static reset(){this.access=null,o.log(`${On} reset for new page session`)}};he.access=null});var ve,pi=p(()=>{"use strict";h();S();ve=class{static merge(e){l(()=>{for(let[t,i]of Object.entries(e))i==null||i===""||(this.context[t]=i)},void 0)}static resolveSubscriptionData(){return l(()=>{if(typeof window=="undefined")return null;let e=window,t=e.Connext||e.CnnXt;if(!t||typeof t.GetAccountData!="function")return null;let i=t.GetAccountData();if(!i||typeof i!="object")return null;let r={};return Array.isArray(i.OwnedSubscriptions)&&i.OwnedSubscriptions.length>0&&(r.engage_subscriptions=i.OwnedSubscriptions),i.MasterId&&(r.engage_master_id=i.MasterId),i.DigitalAccess&&typeof i.DigitalAccess=="object"&&i.DigitalAccess.AccessLevel&&(r.engage_access_level=i.DigitalAccess.AccessLevel),Object.keys(r).length>0?r:null},null)}static getContext(){return l(()=>{var i,r;let e={...this.context},t=this.resolveSubscriptionData();if(t)for(let[a,s]of Object.entries(t))(e[a]===void 0||e[a]===null||e[a]==="")&&(e[a]=s);if(typeof window!="undefined"){let a=(r=(i=f.get())==null?void 0:i.customEvents)==null?void 0:r.commonDetailsMapping,s=a!=null&&a.variableName?f.resolveMappedGlobal(a):window.navigaEngageDetails;if(s&&typeof s=="object"&&!Array.isArray(s))for(let[c,u]of Object.entries(s))u==null||u===""||(e[c]===void 0||e[c]===null||e[c]==="")&&(e[c]=u)}return e},{})}static reset(){this.context={}}};ve.context={}});var yi,Oa,Le,bi=p(()=>{"use strict";h();y();Et();nt();k();yi=ie.Session.session_key,Oa=ie.Session.timeout_ms,Le=class{static isValidSession(e){return!!(e&&typeof e.id=="string"&&e.id.length>0&&typeof e.timestamp=="number"&&Number.isFinite(e.timestamp))}static getSessionId(){return _(()=>{let e=Date.now(),t=localStorage.getItem(yi),i=null;if(t)try{i=JSON.parse(t)}catch{i=null}this.isValidSession(i)||(i=null);let r=!i||e-i.timestamp>Oa;!i||r?(i={id:xe(),timestamp:e},o.info("[SessionStorage] New session created")):(i.timestamp=e,o.info("[SessionStorage] Existing session reused"));try{localStorage.setItem(yi,JSON.stringify(i))}catch{o.warn("[SessionStorage] Failed to save session to localStorage")}return i.id},{message:"Failed to manage session",severity:"high",source:"SessionStorage.getSessionId"})}static touchSession(){try{if(typeof localStorage=="undefined")return;let e=localStorage.getItem(yi);if(!e)return;let t=JSON.parse(e);if(!this.isValidSession(t))return;let i=Date.now();if(i-t.timestamp>Oa)return;t.timestamp=i,localStorage.setItem(yi,JSON.stringify(t))}catch{}}}});var at,Fa=p(()=>{"use strict";h();k();y();at=class{static async encryptValue(e,t){return await C(async()=>{if(typeof crypto=="undefined"||!crypto.subtle)throw new Error("Web Crypto API not available");let i=await this.importRsaPublicKey(t),r=await this.encryptWithRSA(e,i),a={encryptedValue:this.arrayBufferToBase64(r)};return o.log("[PayloadEncryption] Field value encrypted successfully"),a},{message:"Failed to encrypt field value",severity:"high",source:"PayloadEncryption.encryptValue"})}static async encryptWithRSA(e,t){let i=new TextEncoder().encode(e);return await crypto.subtle.encrypt({name:this.RSA_ALGORITHM},t,i)}static async importRsaPublicKey(e){let t=e.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),i=this.base64ToArrayBuffer(t);return await crypto.subtle.importKey("spki",i,{name:this.RSA_ALGORITHM,hash:"SHA-256"},!1,["encrypt"])}static arrayBufferToBase64(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),i="";for(let r=0;r<t.byteLength;r++)i+=String.fromCharCode(t[r]);return btoa(i)}static base64ToArrayBuffer(e){let t=atob(e),i=new Uint8Array(t.length);for(let r=0;r<t.length;r++)i[r]=t.charCodeAt(r);return i.buffer}static isSupported(){return typeof crypto!="undefined"&&typeof crypto.subtle!="undefined"&&typeof crypto.subtle.encrypt=="function"}};at.RSA_ALGORITHM="RSA-OAEP"});var ot,zn=p(()=>{"use strict";ht();k();Fa();ot=class{static async preparePayload(e,t){var i;try{if(!t.enabled||!((i=t.keys)!=null&&i.length)||!t.publicKey||!at.isSupported())return Y({data:e,encrypted:!1});let r=await this.encryptFields(e,t.keys,t.publicKey);if(!r.success)return Pe(r.error);let{encryptedData:a,metadata:s}=r.value;if(s.fields.length===0)return Y({data:e,encrypted:!1});let c={...a,_encryption:s};return Y({data:c,encrypted:!0})}catch(r){let a={message:`Failed to prepare payload: ${r instanceof Error?r.message:String(r)}`,severity:"high",source:"PayloadGenerator.preparePayload",data:{error:r}};return Pe(a)}}static async encryptFields(e,t,i){try{let r={...e},a=[];for(let c of t){let u=this.getFieldValue(r,c);if(u===void 0)continue;let d=typeof u=="string"?u:JSON.stringify(u),g=await at.encryptValue(d,i);if(!g.success){let v={message:`Failed to encrypt field "${c}": ${g.error.message}`,severity:"high",source:"PayloadGenerator.encryptFields",data:{fieldPath:c,originalError:g.error}};return Pe(v)}let{encryptedValue:m}=g.value;this.setFieldValue(r,c,m),a.push(c)}
1return a.length===0?Y({encryptedData:r,metadata:{fields:[],algorithm:"RSA-OAEP"}}):Y({encryptedData:r,metadata:{fields:a,algorithm:"RSA-OAEP"}})}catch(r){let a={message:`Failed to encrypt fields: ${r instanceof Error?r.message:String(r)}`,severity:"high",source:"PayloadGenerator.encryptFields",data:{error:r}};return Pe(a)}}static getFieldValue(e,t){return t.split(".").reduce((i,r)=>i==null?void 0:i[r],e)}static setFieldValue(e,t,i){let r=t.split("."),a=r.pop(),s=e;for(let c of r){let u=s[c];if(!u||typeof u!="object")return;s[c]=Array.isArray(u)?[...u]:{...u},s=s[c]}s[a]=i}}});var Kn,jn,$,At=p(()=>{"use strict";h();y();k();S();zn();Kn=typeof window!="undefined"&&typeof fetch!="undefined",jn=5e3,$=class{static resolveBaseUrl(e){let t=f.getValue("api_base_url")||"";return e==="bff"&&f.getValue("bff_base_url")||t}static async post(e,t,i,r="api"){return await C(async()=>{if(!Kn)throw o.warn("Not in browser environment, skipping API request"),new Error("Not in browser environment");let a=this.resolveBaseUrl(r);if(!a)throw o.warn("API configuration missing: base URL not set"),new Error("API configuration missing");let s=f.getEncryptionConfig(),c=await ot.preparePayload(t,s);if(!c.success)throw o.error("Failed to prepare payload:",c.error),new Error("Failed to prepare payload: "+c.error.message);let{data:u}=c.value,d=JSON.stringify(u),g={"Content-Type":"application/json",...i||{}},m=a+e;o.log("Making API request to:",m);let v=new AbortController,b=setTimeout(()=>v.abort(),jn);try{let E=await fetch(m,{method:"POST",headers:g,body:d,signal:v.signal});if(!E.ok)throw Object.assign(new Error(`HTTP error! status: ${E.status}`),{statusCode:E.status});let w=await E.json();return o.info("API request successful:",w),w}finally{clearTimeout(b)}},{message:"Failed to make API request",severity:"medium",source:"ApiClient.post",endpoint:this.resolveBaseUrl(r)+e,statusCode:0})}static async patch(e,t,i,r="api"){return await C(async()=>{if(!Kn)throw new Error("Not in browser environment");let a=this.resolveBaseUrl(r);if(!a)throw new Error("API configuration missing");let s={"Content-Type":"application/json",...i||{}},c=a+e,u=new AbortController,d=setTimeout(()=>u.abort(),jn);try{let g=await fetch(c,{method:"PATCH",headers:s,body:JSON.stringify(t),signal:u.signal});if(!g.ok)throw new Error(`HTTP error! status: ${g.status}`);return await g.json()}finally{clearTimeout(d)}},{message:"Failed to make API PATCH request",severity:"medium",source:"ApiClient.patch",endpoint:this.resolveBaseUrl(r)+e,statusCode:0})}static async get(e,t,i="api"){return await C(async()=>{if(!Kn)throw o.warn("Not in browser environment, skipping API request"),new Error("Not in browser environment");let r=this.resolveBaseUrl(i);if(!r)throw o.warn("API configuration missing: base URL not set"),new Error("API configuration missing");let a={Accept:"application/json",...t||{}},s=r+e;o.log("Making API GET request to:",s);let c=new AbortController,u=setTimeout(()=>c.abort(),jn);try{let d=await fetch(s,{method:"GET",headers:a,signal:c.signal});if(!d.ok)throw new Error(`HTTP error! status: ${d.status}`);let g=await d.json();return o.info("API GET successful:",g),g}finally{clearTimeout(u)}},{message:"Failed to make API GET request",severity:"medium",source:"ApiClient.get",endpoint:this.resolveBaseUrl(i)+e,statusCode:0})}}});var Ci,Ha=p(()=>{"use strict";h();S();k();At();Ci=class{static async getTimezoneData(){return await C(async()=>{let e=f.get(),t=e.organisation_name,i=e.publication_name;if(!t||!i)throw new Error("Organization name and publication name are required");let r=await $.post("/eventsConfig",{orgName:t,pubName:i});if(!r.success)throw new Error(r.error.message);return r.value},{message:"Failed to fetch timezone data from API",severity:"low",source:"TimezoneService.getTimezoneData"})}}});function ye(n){var e;try{if(!n||n.indexOf("?")===-1)return n;let t=new Set(Gc),i=(e=f.getABConfig())==null?void 0:e.tokenQueryParam;typeof i=="string"&&i.trim()!==""&&t.add(i);let r=!1;for(let u of t)if(n.indexOf(u+"=")!==-1){r=!0;break}if(!r){for(let u of Ba)if(n.indexOf(u+"=")!==-1){r=!0;break}}if(!r)return n;let a=Ct(n),s=new URL(n,a?bt:void 0);if(An(s.searchParams))for(let u of Ba)t.add(u);let c=!1;for(let u of t)s.searchParams.has(u)&&(s.searchParams.delete(u),c=!0);return c?a?s.pathname+s.search+s.hash:s.href:n}catch{return n}}var Gc,Ba,wi=p(()=>{"use strict";S();Tn();Gc=["naviga_ab_token","access_token","id_token","id_token_hint","refresh_token","code_verifier","client_secret","session_state"],Ba=["code","state"]});var Wc,_i,Qc,kt,Va=p(()=>{"use strict";Wc="naviga_analytics_v1",_i="event_queue",Qc=1,kt=class{constructor(){this.db=null}static isSupported(){return typeof indexedDB!="undefined"}async open(){if(!this.db)return new Promise((e,t)=>
1{let i=indexedDB.open(Wc,Qc);i.onupgradeneeded=()=>{let r=i.result;r.objectStoreNames.contains(_i)||r.createObjectStore(_i,{keyPath:"id",autoIncrement:!0})},i.onsuccess=()=>{this.db=i.result,e()},i.onerror=()=>t(i.error||new Error("IDB open failed")),i.onblocked=()=>t(new Error("IDB open blocked by another tab"))})}async tx(e,t){return await this.open(),new Promise((i,r)=>{let a=this.db.transaction(_i,e),s=a.objectStore(_i),c=t(s);c.onsuccess=()=>i(c.result),c.onerror=()=>r(c.error),a.onabort=()=>r(a.error||new Error("IDB transaction aborted")),a.onerror=()=>r(a.error||new Error("IDB transaction failed"))})}async add(e){return await this.tx("readwrite",i=>i.add(e))}async update(e){await this.tx("readwrite",t=>t.put(e))}async getAll(){return await this.tx("readonly",e=>e.getAll())}async remove(e){await this.tx("readwrite",t=>t.delete(e))}async count(){return await this.tx("readonly",e=>e.count())}async clear(){await this.tx("readwrite",e=>e.clear())}}});var Tt,$a=p(()=>{"use strict";Tt=class{constructor(){this.records=new Map;this.nextId=1}async add(e){let t=this.nextId++;return this.records.set(t,{id:t,...e}),t}async update(e){this.records.has(e.id)&&this.records.set(e.id,e)}async getAll(){return Array.from(this.records.values()).sort((e,t)=>e.id-t.id)}async remove(e){this.records.delete(e)}async count(){return this.records.size}async clear(){this.records.clear(),this.nextId=1}}});var za={};O(za,{EventQueue:()=>j});var j,Ei=p(()=>{"use strict";y();h();S();k();At();Va();$a();Pt();j=class{static async init(){if(!f.getEventQueueConfig().enabled)return this.teardown(),!1;if(this.storage)return!0;if(this.initPromise)return this.initPromise;this.initPromise=this.doInit();try{return await this.initPromise}finally{this.initPromise=null}}static async doInit(){if(kt.isSupported()){let e=new kt;try{await e.open(),this.storage=e,o.info("[EventQueue] IDB storage ready")}catch(t){o.warn("[EventQueue] IDB open failed; falling back to in-memory storage:",t),this.storage=new Tt}}else o.info("[EventQueue] IndexedDB not supported; using in-memory storage"),this.storage=new Tt;if(this.preInitBuffer.length>0){let e=this.preInitBuffer.splice(0);o.info(`[EventQueue] Persisting ${e.length} event(s) buffered before init`);for(let t of e)await this.enqueue(t)}return await this.prune(),this.drain(),typeof window!="undefined"&&(this.onlineHandler||(this.onlineHandler=()=>void this.drain(),window.addEventListener("online",this.onlineHandler)),this.drainTimer||(this.drainTimer=setInterval(()=>void this.drain(),3e4))),!0}static async enqueue(e){var i;let t=f.getEventQueueConfig();if(t.enabled){if(A.isHealthEvent(e==null?void 0:e.event_name)){o.log("[EventQueue] Not queueing sdk_health (self-telemetry is not retried)");return}if(!this.storage){this.preInitBuffer.length<this.PRE_INIT_BUFFER_MAX&&(this.preInitBuffer.push(e),o.log(`[EventQueue] Buffered ${(i=e.event_name)!=null?i:"<unknown>"} until storage is ready`));return}await C(async()=>{var s;let r=Date.now(),a=await this.storage.count();if(a>=t.maxEvents){let c=await this.storage.getAll(),u=a-t.maxEvents+1,d=c.slice(0,u);for(let g of d)await this.storage.remove(g.id);o.warn(`[EventQueue] Capped at ${t.maxEvents}; dropped ${d.length} oldest`)}await this.storage.add({event:e,attemptCount:0,firstAttemptAt:r,lastAttemptAt:r}),o.log(`[EventQueue] Enqueued ${(s=e.event_name)!=null?s:"<unknown>"}`)},{message:"EventQueue.enqueue failed",severity:"low",source:"EventQueue.enqueue"})}}static async drain(){var i,r;let e=this.storage;if(!e||this.draining)return;let t=f.getEventQueueConfig();if(t.enabled){this.draining=!0;try{await this.prune();let a=await e.getAll();for(let s of a){let c=(i=s.event)==null?void 0:i.event_name;if(A.isHealthEvent(c)){await e.remove(s.id),o.log("[EventQueue] Purged stale queued sdk_health record");continue}if(s.attemptCount>=t.maxAttempts){await e.remove(s.id),A.recordDropped(c),o.warn(`[EventQueue] Dropped after ${s.attemptCount} attempts:`,c);continue}s.attemptCount+=1,s.lastAttemptAt=Date.now(),await e.update(s);let u=!1,d=!1;try{let g=await $.post("/event",this.markAsReplay(s.event,s.attemptCount));if(u=g.success,!g.success){let m=(r=g.error)==null?void 0:r.statusCode;d=typeof m=="number"&&m>=400&&m<500&&m!==408&&m!==429}}catch(g){o.warn("[EventQueue] Drain attempt threw:",g),u=!1}u?(await e.remove(s.id),A.recordReplayDelivered(c)):d&&(await e.remove(s.id),A.recordDropped(c),o.warn("[EventQueue] Dropped permanently rejected event:",c))}}finally{this.draining=!1}}}static markAsReplay(e,t){try{let i={};
1if(typeof e.additional_info=="string"&&e.additional_info)try{i=JSON.parse(e.additional_info)}catch{i={}}else e.additional_info&&typeof e.additional_info=="object"&&(i={...e.additional_info});return i.retry_attempt=t,{...e,additional_info:JSON.stringify(i)}}catch{return e}}static async prune(){let e=this.storage;if(!e)return;let t=f.getEventQueueConfig(),i=Date.now()-t.ttlHours*60*60*1e3,r=await e.getAll(),a=0;for(let s of r)s.firstAttemptAt<i&&(await e.remove(s.id),a++);a>0&&o.warn(`[EventQueue] Pruned ${a} expired records`)}static setStorageForTesting(e){this.storage=e}static getStorageForTesting(){return this.storage}static teardown(){this.storage=null,this.preInitBuffer=[],this.drainTimer&&(clearInterval(this.drainTimer),this.drainTimer=null),this.onlineHandler&&typeof window!="undefined"&&(window.removeEventListener("online",this.onlineHandler),this.onlineHandler=null)}};j.storage=null,j.draining=!1,j.drainTimer=null,j.onlineHandler=null,j.initPromise=null,j.preInitBuffer=[],j.PRE_INIT_BUFFER_MAX=50});var qn={};O(qn,{BeaconSender:()=>ce});var ce,Ke=p(()=>{"use strict";h();y();k();S();zn();Rt();Ei();Pt();ce=class{static async send(e,t){return await C(async()=>{let i=t.event_name;if(!Ka.has(i))return o.error(`[BeaconSender] Event "${i}" is not in BEACON_SENDER_ALLOWED \u2014 not sent via beacon; enqueued for retry. Add it to the allowlist in common/config/AllowedEvents.ts if it must survive unload.`),A.recordFailed(i),A.recordEnqueued(i),j.enqueue(t),{success:!1,method:"failed",error:"Event not in BeaconSender allow-list"};let r=f.getValue("api_base_url");if(!r)throw new Error("API configuration missing: api_base_url not set");let a=f.getEncryptionConfig(),s=await ot.preparePayload(t,a);if(!s.success)throw o.error("[BeaconSender] Failed to prepare payload:",s.error),new Error("Failed to prepare payload: "+s.error.message);let{data:c}=s.value,u=r+e;if(o.log("[BeaconSender] Attempting to send event to:",u),A.recordAttempt(i),this.isBeaconSupported()){if(o.log("[BeaconSender] Trying Beacon API..."),this.sendViaBeacon(u,c))return o.info("[BeaconSender] Event sent successfully via Beacon API"),A.recordDelivered(i,"beacon"),{success:!0,method:"beacon"};o.warn("[BeaconSender] Beacon API failed, trying fallback...")}else o.log("[BeaconSender] Beacon API not supported");try{if(o.log("[BeaconSender] Trying fetch with keepalive..."),await this.sendViaFetchKeepalive(u,c))return o.info("[BeaconSender] Event sent successfully via fetch keepalive"),A.recordDelivered(i,"fetch-keepalive"),{success:!0,method:"fetch-keepalive"};o.warn("[BeaconSender] Fetch keepalive failed, enqueuing for retry...")}catch(g){o.warn("[BeaconSender] Fetch keepalive threw error:",g)}A.recordFailed(i),A.recordEnqueued(i),j.enqueue(t);let d="All transmission methods failed";return o.error("[BeaconSender]",d),{success:!1,method:"failed",error:d}},{message:"Failed to send event via BeaconSender",severity:"medium",source:"BeaconSender.send",endpoint:e,statusCode:0})}static isBeaconSupported(){return typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function"}static sendViaBeacon(e,t){try{let i=new Blob([JSON.stringify(t)],{type:"application/json"}),r=navigator.sendBeacon(e,i);return r||o.warn("[BeaconSender] Beacon API returned false (queue full or size limit exceeded)"),r}catch(i){return o.warn("[BeaconSender] Beacon API error:",i),!1}}static async sendViaFetchKeepalive(e,t){try{return typeof fetch=="undefined"?!1:(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0})).ok}catch(i){return o.warn("[BeaconSender] Fetch keepalive error:",i),!1}}}});var xt={};O(xt,{EventSender:()=>ne});var ne,Se=p(()=>{"use strict";h();y();k();At();Ei();Pt();ne=class{static async send(e){return await C(async()=>{let t=e.event_name;if(typeof t!="string"||t.trim()==="")return o.warn("[EventSender] Dropping event without event_name"),!0;o.log("Sending event:",e),A.recordAttempt(t);let i=await $.post("/event",e);if(i.success)return A.recordDelivered(t),o.info("Event sent successfully:",i.value),!0;throw A.recordFailed(t),A.recordEnqueued(t),j.enqueue(e),new Error(i.error.message)}
1,{message:"Failed to send analytics event",severity:"medium",source:"EventSender.send",endpoint:"/event",statusCode:0})}}});function Gn(){return{attempted:0,delivered:0,failed:0,enqueued:0,replay_delivered:0,dropped:0,delivered_via_beacon:0,delivered_via_fetch_keepalive:0,delivered_via_xhr_sync:0}}var Si,A,Pt=p(()=>{"use strict";y();S();Si="sdk_health",A=class{static isHealthEvent(e){return e===Si}static isEnabled(){try{return f.isSdkHealthEnabled()}catch{return!1}}static record(e){if(this.isEnabled())try{e(this.counters),this.dirty=!0,this.ensureStarted()}catch{}}static recordAttempt(e){this.isHealthEvent(e)||this.record(t=>{t.attempted++})}static recordDelivered(e,t){this.isHealthEvent(e)||this.record(i=>{i.delivered++,t==="beacon"?i.delivered_via_beacon++:t==="fetch-keepalive"&&i.delivered_via_fetch_keepalive++})}static recordFailed(e){this.isHealthEvent(e)||this.record(t=>{t.failed++})}static recordEnqueued(e){this.isHealthEvent(e)||this.record(t=>{t.enqueued++})}static recordReplayDelivered(e){this.isHealthEvent(e)||this.record(t=>{t.replay_delivered++})}static recordDropped(e){this.isHealthEvent(e)||this.record(t=>{t.dropped++})}static ensureStarted(){if(this.started||typeof window=="undefined")return;this.started=!0;let e=f.getTelemetryConfig().report_interval_seconds;this.flushTimer=setInterval(()=>{this.flush("interval")},Math.max(30,e)*1e3),this.beforeUnloadListener=()=>{this.flush("beforeunload")},window.addEventListener("beforeunload",this.beforeUnloadListener),this.pageHideListener=()=>{this.flush("pagehide")},window.addEventListener("pagehide",this.pageHideListener),Promise.all([Promise.resolve().then(()=>(le(),It)),Promise.resolve().then(()=>(Ke(),qn)),Promise.resolve().then(()=>(Se(),xt))]).then(([t,i,r])=>{this.modules.EventFactory=t.EventFactory,this.modules.BeaconSender=i.BeaconSender,this.modules.EventSender=r.EventSender}).catch(()=>{})}static async flush(e){var i,r,a;if(!this.dirty||this.flushing||!this.isEnabled())return;this.flushing=!0;let t=this.counters;this.counters=Gn(),this.dirty=!1;try{let s=t.attempted,c={...t,delivery_rate_percent:s>0?Math.round(t.delivered/s*100):100,report_trigger:e},d=await((i=this.modules.EventFactory)!=null?i:(await Promise.resolve().then(()=>(le(),It))).EventFactory).createEvent(Si,c);if(!d.success||d.value===null)return;e==="pagehide"||e==="beforeunload"?await((r=this.modules.BeaconSender)!=null?r:(await Promise.resolve().then(()=>(Ke(),qn))).BeaconSender).send("/event",d.value):await((a=this.modules.EventSender)!=null?a:(await Promise.resolve().then(()=>(Se(),xt))).EventSender).send(d.value),o.log("[DeliveryMonitor] sdk_health flushed",c)}catch(s){o.warn("[DeliveryMonitor] Failed to flush sdk_health:",s)}finally{this.flushing=!1}}static getCountersForTesting(){return{...this.counters}}static resetForTesting(){this.counters=Gn(),this.dirty=!1,this.flushing=!1,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),this.pageHideListener&&typeof window!="undefined"&&(window.removeEventListener("pagehide",this.pageHideListener),this.pageHideListener=null),this.beforeUnloadListener&&typeof window!="undefined"&&(window.removeEventListener("beforeunload",this.beforeUnloadListener),this.beforeUnloadListener=null),this.started=!1}};A.counters=Gn(),A.dirty=!1,A.started=!1,A.flushTimer=null,A.pageHideListener=null,A.beforeUnloadListener=null,A.flushing=!1,A.modules={}});function Wn(n){return`${Yc}${n}`}function Qn(n){return Dt.has(n)?new Set([n,Wn(n)]):new Set([n])}var Ka,Dt,Yc,Rt=p(()=>{"use strict";Pt();Ka=new Set(["page_leave","engagement_ping","click","article_page_view","article_page_leave","article_engagement_ping","ab_experiment_click",Si]),Dt=new Set(["page_view","page_leave","engagement_ping"]),Yc="article_"});function Xc(n){let e=new Map;for(let[t,i]of Object.entries(n)){let r=new Set(i);e.set(t,r),Dt.has(t)&&e.set(Wn(t),r)}return e}function Ga(){return l(()=>{let n=f.get()[ja];return n==="enforce"?"enforce":(n!==void 0&&n!=="observe"&&o.warn(`${qa} unrecognised ${ja} ${JSON.stringify(n)}; staying in observe mode`),"observe")},"observe")}function Wa(n,e={}){return l(()=>{if(Ga()!=="enforce"||el(e))return!1;let t=Zc.get(n);if(!t)return!1;let{pageClass:i}=q.resolve();return t.has(i)?(o.info(`${qa} suppressing ${n} on a ${i} page`),!0):!1},!1)}function el(n){return n.skipArticleContext===!0}function Qa(){return l(()=>Ga()!=="enforce"?!1:q.resolve().pageClass==="transit",!1)}var ja,qa,Jc,Zc,Yn=p(()=>{"use strict";S();
1Rt();y();h();it();ja="pageClassEnforcement",qa="[PageClassPolicy]",Jc={page_view:["transit"],engagement_ping:["commerce","transit"],page_leave:["commerce","transit"],click:["transit"]};Zc=Xc(Jc)});var Xn={};O(Xn,{PageViewContext:()=>J});var st,Jn,z,J,Me=p(()=>{"use strict";y();wi();Et();Yn();st={uuid:"",url:"",title:""},Jn="naviga-analytics-last-page-view",z=class z{static recordPageView(e,t){let i=ye(e!=null?e:z.readWindowUrl()),r=t!=null?t:z.readDocumentTitle();this.current&&this.current.url===i||this.rotateTo(i,r)}static rotateForRestore(){this.rotateTo(ye(z.readWindowUrl()),z.readDocumentTitle())}static correctCurrentUrl(e){if(!this.current)return;let t=ye(e!=null?e:z.readWindowUrl());this.current.url!==t&&(this.current={...this.current,url:t},this.currentIsHiddenFromTrail||z.writeStoredView(this.current),o.info("[PageViewContext] Corrected page view URL",this.current.uuid,this.current.url))}static rotateTo(e,t){this.current&&this.currentIsHiddenFromTrail?o.info("[PageViewContext] Outgoing page view hidden from trail",this.current.uuid):this.current?this.previous={...this.current}:this.previous=z.readStoredView(),this.current={uuid:xe(),url:e,title:t},this.currentIsHiddenFromTrail=Qa(),this.currentIsHiddenFromTrail||z.writeStoredView(this.current),o.info("[PageViewContext] Recorded page view",this.current.uuid,this.current.url)}static getEventFields(){this.current||(this.rotateTo(ye(z.readWindowUrl()),z.readDocumentTitle()),o.info("[PageViewContext] Lazy-initialized first page view",this.current.uuid));let e=this.current;return{page_view_uuid:e.uuid,page_view_url:e.url,page_title:e.title,previous_page_view_uuid:this.previous.uuid,previous_page_view_url:this.previous.url}}static reset(){this.current=null,this.previous=st,this.currentIsHiddenFromTrail=!1,z.clearStoredView()}static readStoredView(){try{if(typeof sessionStorage=="undefined")return st;let e=sessionStorage.getItem(Jn);if(!e)return st;let t=JSON.parse(e);return!t||typeof t.uuid!="string"||t.uuid===""?st:{uuid:t.uuid,url:typeof t.url=="string"?ye(t.url):"",title:typeof t.title=="string"?t.title:""}}catch{return st}}static writeStoredView(e){try{if(typeof sessionStorage=="undefined")return;sessionStorage.setItem(Jn,JSON.stringify(e))}catch{}}static clearStoredView(){try{if(typeof sessionStorage=="undefined")return;sessionStorage.removeItem(Jn)}catch{}}static readWindowUrl(){return typeof window!="undefined"?window.location.href:""}static readDocumentTitle(){return typeof document!="undefined"?document.title:""}};z.current=null,z.previous=st,z.currentIsHiddenFromTrail=!1;J=z});var tl,je,Zn=p(()=>{"use strict";tl=/Googlebot|Bingbot|DuckDuckBot|Slackbot|Twitterbot|facebookexternalhit|LinkedInBot|WhatsApp|Discordbot|TelegramBot|Applebot|YandexBot|Baiduspider|HeadlessChrome|PhantomJS|puppeteer|playwright|GPTBot|OAI-SearchBot|ChatGPT-User|ClaudeBot|Claude-User|Claude-SearchBot|PerplexityBot|Perplexity-User|Google-Extended|GoogleOther|CCBot|Amazonbot|meta-externalagent|Bytespider|Applebot-Extended|MistralAI-User|DuckAssistBot/i,je=class{static isSuspected(){return this.cached!==null?this.cached:(this.cached=this.compute(),this.cached)}static reset(){this.cached=null}static compute(){if(typeof navigator=="undefined")return!1;if(navigator.webdriver===!0)return!0;let e=navigator.userAgent||"";return tl.test(e)}};je.cached=null});var il,Ya,qe,Ja=p(()=>{"use strict";il=/Electron|HeadlessChrome| Atlas\/|ChatGPT-Atlas|Comet\/|Claude-User|ChatGPT-User/i,Ya=/SwiftShader|llvmpipe|software rasterizer|Mesa OffScreen|VirtualBox Graphics|VMware SVGA/i,qe=class{static isSuspected(){return this.cachedSuspected!==null?this.cachedSuspected:(this.compute(),this.cachedSuspected)}static getSignals(){return this.cachedSignals!==null?this.cachedSignals:(this.compute(),this.cachedSignals)}static reset(){this.cachedSuspected=null,this.cachedSignals=null}static compute(){let e=[];
1if(typeof navigator!="undefined"){navigator.webdriver===!0&&e.push("webdriver");let t=navigator.userAgent||"";il.test(t)&&e.push("ua_agent_marker"),Array.isArray(navigator.languages)&&navigator.languages.length===0&&e.push("no_languages")}if(typeof window!="undefined"){try{(window.__playwright__binding__!==void 0||window.__pwInitScripts!==void 0||window.cdc_adoQpoasnfa76pfcZLmcfl_Array!==void 0)&&e.push("cdp_artifact")}catch{}try{typeof window.outerWidth=="number"&&typeof window.outerHeight=="number"&&window.outerWidth===0&&window.outerHeight===0&&typeof window.innerWidth=="number"&&window.innerWidth>0&&e.push("headless_dimensions")}catch{}}if(typeof document!="undefined"&&typeof document.createElement=="function")try{let t=document.createElement("canvas");if(typeof t.getContext=="function"){let i=this.getWebGLContext(t);if(i&&typeof i.getExtension=="function"){let r=i.getExtension("WEBGL_debug_renderer_info");if(r){let a=i.getParameter(r.UNMASKED_RENDERER_WEBGL)||"",s=i.getParameter(r.UNMASKED_VENDOR_WEBGL)||"";(Ya.test(a)||Ya.test(s))&&e.push("webgl_software_renderer")}}}}catch{}this.cachedSuspected=e.length>0,this.cachedSignals=e.join(",")}static getWebGLContext(e){try{return e.getContext("webgl")||e.getContext("experimental-webgl")||e.getContext("webgl2")}catch{return null}}};qe.cachedSuspected=null,qe.cachedSignals=null});var tr,nl,Xa,er,Ai,ki,Za=p(()=>{"use strict";y();tr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],nl=["gclid","fbclid","msclkid"],Xa=[...tr,...nl],er="naviga-analytics-utm-session",Ai="naviga-analytics-utm-first",ki=class{static getAttribution(){let e=this.parseCurrentUrl();this.hasAnyKey(e)&&(this.writeSession(e),this.writeFirstTouchIfUnset(e));let t=this.readSession(),i=this.readFirstTouch();return this.toEventFields(t,i)}static reset(){try{typeof sessionStorage!="undefined"&&sessionStorage.removeItem(er),typeof localStorage!="undefined"&&localStorage.removeItem(Ai)}catch(e){o.warn("[AttributionService] reset() failed:",e)}}static parseCurrentUrl(){if(typeof window=="undefined"||typeof window.location=="undefined")return{};try{let e=new URLSearchParams(window.location.search),t={};for(let i of Xa){let r=e.get(i);r&&r.length>0&&(t[i]=r)}return t}catch{return{}}}static hasAnyKey(e){return Object.keys(e).length>0}static writeSession(e){if(typeof sessionStorage!="undefined")try{sessionStorage.setItem(er,JSON.stringify(e))}catch(t){o.warn("[AttributionService] Failed to write session attribution:",t)}}static readSession(){if(typeof sessionStorage=="undefined")return{};try{let e=sessionStorage.getItem(er);if(!e)return{};let t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}static writeFirstTouchIfUnset(e){if(typeof localStorage!="undefined")try{if(localStorage.getItem(Ai))return;let i={};for(let r of tr)e[r]&&(i[r]=e[r]);if(Object.keys(i).length===0)return;localStorage.setItem(Ai,JSON.stringify(i))}catch(t){o.warn("[AttributionService] Failed to write first-touch attribution:",t)}}static readFirstTouch(){if(typeof localStorage=="undefined")return{};try{let e=localStorage.getItem(Ai);if(!e)return{};let t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}static toEventFields(e,t){let i={};for(let r of Xa)i[r]=e[r]||"";for(let r of tr)i[`first_touch_${r}`]=t[r]||"";return i}}});var rl,ct,eo=p(()=>{"use strict";h();y();rl={"chatgpt.com":"chatgpt",chatgpt:"chatgpt",perplexity:"perplexity","perplexity.ai":"perplexity",copilot:"copilot",gemini:"gemini","claude.ai":"claude",deepseek:"deepseek"},ct=class{static resolve(e,t){let i=`${e}\0${t}`;if(this.cached!==null&&this.cached.key===i)return this.cached.value;let r=this.compute(e,t);return this.cached={key:i,value:r},o.log(`[AiSourceResolver] resolved ai_source="${r}" (referrer="${e}", utm_source="${t}")`),r}static isAiReferrer(e){return this.resolve(e,"")!==""}static reset(){this.cached=null}static compute(e,t){let i=this.classifyReferrer(e);return i!==""?i:this.classifyUtm(t)}static classifyReferrer(e){return e?_(()=>{let t=new URL(e),i=t.hostname.toLowerCase(),r=t.pathname.toLowerCase(),a=s=>i===s||i.endsWith("."+s);return a("chatgpt.com")||a("chat.openai.com")?"chatgpt":a("perplexity.ai")||a("pplx.ai")?"perplexity":a("gemini.google.com")||a("bard.google.com")?"gemini":a("claude.ai")?"claude":a("copilot.microsoft.com")||a("bing.com")&&r.startsWith("/chat")?"copilot":a("meta.ai")?"meta":a("grok.com")||a("grok.x.ai")?"grok":a("deepseek.com")?"deepseek":a("you.com")||a("huggingface.co")&&r.startsWith("/chat")||a("mistral.ai")&&r.startsWith("/chat")||a("kagi.c
1om")&&r.startsWith("/assistant")?"other_ai":""},{message:"AiSourceResolver: referrer URL parse failed",severity:"LOW",source:"AiSourceResolver.classifyReferrer"}).unwrapOr(""):""}static classifyUtm(e){var i;if(!e)return"";let t=e.toLowerCase().trim();return(i=rl[t])!=null?i:""}};ct.cached=null});var X,Ne,ir=p(()=>{"use strict";k();h();ci();St();bi();S();nt();Ha();y();Wt();Me();wi();Zn();Ja();Nn();Za();eo();ht();X=class X{static generateSessionNonce(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID().replace(/-/g,"").substring(0,12)}catch{}return(Date.now().toString(36)+Math.random().toString(36).substring(2,10)).substring(0,12)}static async getCommonEventData(){return await C(async()=>{let e=performance.now(),t=ki.getAttribution(),i=N.get();if(i){let K=await this.generateDynamicData(i.ex_timezone),P=performance.now();return N.recordHit(P-e),{...i,...K,...t}}N.recordMiss();let[r,a,s,c]=await Promise.all([Ie.getVisitorId(),Le.getSessionId(),se.getPlatformInfo(),Ci.getTimezoneData()]);if(!r.success)throw new Error("Failed to get visitor ID");if(!a.success)throw new Error("Failed to get session ID");if(!s.success)throw new Error("Failed to get platform info");let u=r.value,d=a.value,g=s.value,m=ye(document.referrer||""),v=X.getReferrerType(m).unwrapOr("unknown"),b=ct.resolve(m,t.utm_source||""),E={device_id:u,session_id:d,platform_type:g.type,platform_model:g.model.toLowerCase(),platform_name:"web",platform_version:g.version,platform_os_name:g.os||"unknown",organisation_name:f.getValue("organisation_name")||"",publication_name:f.getValue("publication_name")||"",publication_id:f.getValue("publication_id")||"",sdk_version:ie.SDK_VERSION,referrer_url:m,referrer_type:v,bot_suspected:je.isSuspected(),agent_suspected:qe.isSuspected(),agent_signals:qe.getSignals(),ai_source:b,ex_timezone:c.success?c.value.timezone:void 0,ex_timezone_offset:c.success?c.value.offset:void 0};N.set(E);let w=await this.generateDynamicData(E.ex_timezone);return{...E,...w,...t}},{message:"Failed to build common event data",severity:"high",source:"EventDataBuilder.getCommonEventData"})}static async generateDynamicData(e){let t=X.generateEventId().unwrapOr(`${Date.now().toString(36)}-${X.sessionNonce}-fb${(X.eventIdCounter++).toString(36)}`),i=new Date,r,a,s,c;if(e)try{let v=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(i),b=Object.fromEntries(v.map(E=>[E.type,E.value]));r=parseInt(b.year),a=parseInt(b.month),s=parseInt(b.day),c=Math.floor(i.getTime()/1e3).toString(),o.log("Timezone data:",e)}catch(m){o.warn("Timezone conversion failed, falling back to UTC:",m),r=i.getUTCFullYear(),a=i.getUTCMonth()+1,s=i.getUTCDate(),c=Math.floor(i.getTime()/1e3).toString()}else r=i.getUTCFullYear(),a=i.getUTCMonth()+1,s=i.getUTCDate(),c=Math.floor(i.getTime()/1e3).toString();let u=X.padStart(a,2,"0").unwrapOr(String(a).padStart(2,"0")),d=X.padStart(s,2,"0").unwrapOr(String(s).padStart(2,"0")),g=`${r}-${u}-${d}`;return{event_id:t,event_time_epoc:c,event_create_year:r.toString(),event_create_month:u,event_create_date:d,event_timestamp_utc:i.toISOString().split(".")[0].replace("T"," ")+" +0000",event_creation_date:g}}static generateEventId(){return _(()=>{let e=Date.now().toString(36),t=(X.eventIdCounter++).toString(36);return`${e}-${X.sessionNonce}-${t}`},{message:"Failed to generate event ID",severity:"low",source:"EventDataBuilder.generateEventId"})}static getPageViewContextData(){return _(()=>J.getEventFields(),{message:"Failed to read page view context",severity:"low",source:"EventDataBuilder.getPageViewContextData"})}static getArticleEventData(){let e=f.getArticleDetails();return e.success&&Object.keys(e.value).length>0&&N.updateArticleData(e.value),e}static getUserEventData(){let e=f.getUserDetails(),t=e.success?e.value:{},i=De.getUserId(),r=De.getTraits(),a={...t,...r||{}};return i?(a.user_id=i,(a.is_logged_in===void 0||a.is_logged_in==="")&&(a.is_logged_in="true")):(a.is_logged_in===void 0||a.is_logged_in==="")&&(a.is_logged_in="false"),Object.keys(a).length>0&&N.updateUserData(a),Y(a)}static getReferrerType(e){return _(()=>{if(!e||e.trim()==="")return"direct";let t=e.toLowerCase(),i=[/^https?:\/\/(www\.)?facebook\.com/i,/^https?:\/\/([a-zA-Z0-9-]+\.)?facebook\.com/i,/^https?:\/\/(www\.)?fb\.com/i,/^https?:\/\/(www\.)?m\.facebook\.com/i,/^https?:\/\/(www\.)?facebook\.com\.\w{2,3}/i,/^https?:\/\/fb\.me/i,/^fb:\/\//i,/^facebook:\/\//i,/^android-app:\/\/com\.facebook[.\w]*/i],r=[/^https?:\/\/(www\.)?twitter\.com/i,/^https?:\/\/(www\.)?x\.com/i,/^https?:\/\/(www\.)?mobile\.twitter\.com/i,/^https?:\/\/t\.co/i,/^https?:\/\/(www\.)?twitter\.com/i,/^t\.co/i,/^twitter:\/\//i,/^x:\/\//i,/^android-app:\/\/com\.twitter[.\w]*/i],a=[/^https?:\/\/(www\.)?linkedin\.com/i,/^https?:\/\/(www\.)?lnkd\.in/i,/^https?:\/\/(www\.)?business\.linkedin\.com/i,/^https?:\/\/(www\.)?learning\.linkedin\.com/i,/^linkedin:\/\//i,/^li:\/\//i,/^android-app:\/\/com\.linkedin[.\w]*/i],s=[/^https?:\/\/(www\.)?instagram\.com/i,/^https?:\/\/(www\.)?instagr\.am/i,/^https?:\/\/(www\.)?business\.instagram\.com/i];if(i.some(u=>u.test(t))||r.some(u=>u.test(t))||a.some(u=>u.test(t))||s.some(u=>u.test(t)))return"social";if(ct.isAiReferrer(e))return"ai_assistant";if([/^https?:\/\/(www\.)?google\.com/i,/^https?:\/\/(www\.)?bing\.com/i,/^https?:\/\/(www\.)?yahoo\.com/i,/^https?:\/\/(www\.)?duckduckgo\.com/i,/^https?:\/\/(www\.)?baidu\.com/i,/^https?:\/\/(www\.)?yandex\.com/i].some(u=>u.test(t)))return"organic";try{let u=window.location.hostname.toLowerCase(),g=new URL(t).hostname.toLowerCase();if(g!=u||t.includes(u)&&t.split(u+"/")[1])return"referral";if(g===u)return"direct"}catch{}return"direct"},{message:"Failed to determine referrer type",severity:"low",source:"EventDataBuilder.getReferrerType"})}static padStart(e,t,i){return _(()=>{let r=e.toString();return r.length>=t?r:i.repeat(t-r.length)+r},{message:"Failed to pad string",severity:"low",source:"EventDataBuilder.padStart"})}};X.eventIdCounter=0,X.sessionNonce=X.generateSessionNonce();Ne=X});function lt(n){if(typeof n=="boolean")return n;if(n===1)return!0;
1if(n===0)return!1;if(typeof n=="string"){let e=n.trim().toLowerCase();if(al.has(e))return!0;if(ol.has(e))return!1}return null}function io(n){return n?"true":"false"}function fl(n){let e=n.trim();if(!sl.test(e))return null;let t=e.replace(/\//g,"-");return cl.test(t)?`${t}T00:00:00Z`:(t=t.replace(ll,"$1T"),t=t.replace(ul,"$1$2:$3"),dl.test(t)||(t+="Z"),t)}function gl(n){return`${n.toISOString().split(".")[0].replace("T"," ")} +0000`}function pl(n){let e=lt(n);return e===null?null:io(!e)}function ml(n){let e=lt(n);return e===null?null:io(e)}function vl(n){var t;if(typeof n!="string")return null;let e=n.trim().toLowerCase();return(t=hl[e])!=null?t:null}function yl(n){let e=Array.isArray(n)?n:[n],t=[],i=new Set;for(let r of e){if(typeof r!="string")continue;let a=r.trim();a===""||i.has(a)||(i.add(a),t.push(a))}return t.length>0?t.join(", "):null}function bl(n){let e;if(n instanceof Date)e=n;else if(typeof n=="string"){let i=fl(n);if(i===null)return null;e=new Date(i)}else return null;let t=e.getTime();return Number.isFinite(t)?gl(e):null}function wl(n){var e;return n===void 0?to:(e=Cl[n])!=null?e:to}function Ti(n,e){return l(()=>wl(n)(e),null)}var al,ol,sl,cl,ll,ul,dl,hl,Cl,to,Lt=p(()=>{"use strict";h();al=new Set(["true","yes","1"]),ol=new Set(["false","no","0"]);sl=/^\d{4}[-/]\d{2}[-/]\d{2}/,cl=/^\d{4}-\d{2}-\d{2}$/,ll=/^(\d{4}-\d{2}-\d{2}) /,ul=/\s*([+-])(\d{2})(\d{2})$/,dl=/(Z|[+-]\d{2}:\d{2})$/;hl={free:"false",locked:"true",metered:"true"};Cl=Object.freeze({invert:pl,toBoolString:ml,tierToBool:vl,joinList:yl,isoDate:bl}),to=n=>n});function Pi(n){switch(typeof n){case"string":{if(n.length>nr)return null;let e=n.trim();return e===""?null:e}case"number":return Number.isFinite(n)?n:null;case"boolean":return n;default:return null}}function G(n){return l(()=>{let e=[];for(let t of n){if(e.length>=Z)break;let i=Pi(t);i!==null&&e.push(i)}return e.length===0?null:e.length===1?e[0]:e},null)}function Ri(n){return Array.isArray(n)?G(n):Pi(n)}var nr,Z,be=p(()=>{"use strict";h();nr=4096,Z=50});function Mt(n){if(typeof n!="string"||n==="")return null;if(n.length>no)return o.warn(`[sources] refusing oversized pattern (${n.length} chars > ${no})`),null;try{return new RegExp(n)}catch{return o.warn("[sources] refusing uncompilable pattern"),null}}function ro(n){let e=typeof n=="string"?n:String(n);return e.length>_l?null:e}function xi(n,e){let t=ro(e);if(t===null)return!1;try{return n.test(t)}catch{return!1}}function ao(n,e){let t=ro(e);if(t===null)return null;let i;try{i=n.exec(t)}catch{return null}if(i===null)return null;let r=i[1];if(typeof r!="string")return null;let a=r.trim();return a===""?null:a}var no,_l,rr=p(()=>{"use strict";y();be();no=512,_l=nr});function oo(n,e){let t=e?" i":"";return`meta[name="${n}"${t}], meta[property="${n}"${t}]`}function so(n,e=document){return l(()=>{if(typeof n!="string")return[];let t=n.trim();if(t===""||!El.test(t))return o.warn(`[MetaTagReader] refusing unsafe meta tag name: ${String(n)}`),[];let i;try{i=e.querySelectorAll(oo(t,!0))}catch{i=e.querySelectorAll(oo(t,!1))}let r=[];return i.forEach(a=>{let s=l(()=>a.getAttribute("content"),null);if(typeof s!="string")return;let c=s.trim();c!==""&&r.push(c)}),r},[])}var El,co=p(()=>{"use strict";h();y();El=/^[A-Za-z0-9_.:-]+$/});function lo(n,e=document){return l(()=>G(so(n,e)),null)}var uo=p(()=>{"use strict";co();h();be()});function Ue(n){if(typeof n!="string")return null;let e=n.trim();if(e==="")return null;let t=e.split(".");if(t.length>ar)return null;for(let i of t)if(!Sl.test(i)||Al.has(i))return null;return t}function kl(n,e){if(!(typeof n!="object"||n===null)&&Object.prototype.hasOwnProperty.call(n,e))return l(()=>n[e],void 0)}function fo(n){let e=[];for(let t of n)Array.isArray(t)?e.push(...t):e.push(t);return e}function ut(n,e,t){return l(()=>{let i=[n];for(let r of e){let a=t.fanOutArrays?fo(i):i,s=[];for(let c of a){let u=kl(c,r);u!==void 0&&s.push(u)}if(s.length===0)return[];i=s}return t.fanOutArrays?fo(i):i},[])}var ar,Sl,Al,Nt=p(()=>{"use strict";h();ar=8,Sl=/^[A-Za-z0-9_@:-]+$/,Al=new Set(["__proto__","constructor","prototype"])});function go(n){return n.trim().toLowerCase().replace(/^https?:\/\//,"").replace(/\/+$/,"")}function po(n,e){if(e===void 0)return[n];let t=go(e);return t===""?[]:l(()=>Array.from(n.querySelectorAll("[itemtype]")).filter(i=>{var a;return((a=i.getAttribute("itemtype"))!=null?a:"").split(/\s+/).some(s=>s!==""&&go(s)===t)}),[])}function mo(n,e=document){return l(()=>
1typeof n!="string"||n.trim()===""?!1:po(e,n).length>0,!1)}function Pl(n,e){if(n.nodeType===9)return!0;let t=e.parentElement;for(;t!==null;){if(t===n)return!0;if(t.hasAttribute("itemscope"))return!1;t=t.parentElement}return!1}function Rl(n,e){return l(()=>Array.from(n.querySelectorAll(`[itemprop~="${e}"]`)).filter(i=>Pl(n,i)).slice(0,Tl),[])}function Il(n){return l(()=>{if(n.hasAttribute("itemscope"))return null;let e=n.tagName.toLowerCase();if(e==="time"){let i=n.getAttribute("datetime");return i!==null?i:n.textContent}let t=xl[e];return t!==void 0?n.getAttribute(t):n.textContent},null)}function ho(n,e=void 0,t=document){return l(()=>{let i=Ue(n);if(i===null)return null;let r=[];for(let a of po(t,e)){if(r.length>=Z)break;vo(a,i,r)}return G(r)},null)}function vo(n,e,t){let[i,...r]=e;for(let a of Rl(n,i)){if(t.length>=Z)return;if(r.length===0){let s=Il(a);s!==null&&t.push(s);continue}vo(a,r,t)}}var Tl,xl,or=p(()=>{"use strict";h();be();Nt();Tl=50;xl={meta:"content",a:"href",area:"href",link:"href",audio:"src",embed:"src",iframe:"src",img:"src",source:"src",track:"src",video:"src",object:"data",data:"value",meter:"value"}});function Ll(n){return typeof n=="string"?[n]:Array.isArray(n)?n.filter(e=>typeof e=="string"):[]}function Ml(n){return Ll(n["@type"]).some(t=>Dl.has(t))}function Nl(n){if(typeof n.headline!="string"||n.headline.trim()==="")return!1;let e=n.image;if(e==null||Array.isArray(e)&&e.length===0||typeof n.datePublished!="string"||n.datePublished.trim()===""||typeof n.dateModified!="string"||n.dateModified.trim()==="")return!1;let t=n.author;if(!t)return!1;if(!(typeof t=="string"&&t.trim()!==""))if(typeof t=="object"&&!Array.isArray(t)){if(typeof t.name!="string")return!1}else if(Array.isArray(t)){if(t.length===0||!t.every(a=>typeof a=="object"&&a!==null&&typeof a.name=="string"))return!1}else return!1;let i=n.publisher;return!(!i||typeof i!="object"||Array.isArray(i)||typeof i.name!="string")}function sr(n){return n.replace(/\s+[|–—]\s+.*$/,"").toLowerCase().trim().replace(/\s+/g," ")}function Ul(n,e){if(n===e||n.includes(e)||e.includes(n))return!0;let t=n.length<=e.length?n:e,i=n.length<=e.length?e:n,r=Math.ceil(t.length*.8);return!!(r>0&&i.startsWith(t.slice(0,r)))}function Ol(n){let e=n.querySelector("h1");if(e&&e.textContent&&e.textContent.trim()!=="")return sr(e.textContent);let t=n.querySelector('meta[property="og:title"]');if(t){let i=t.getAttribute("content");if(i&&i.trim()!=="")return sr(i)}return null}function Fl(n,e){if(!e)return!0;let t=n.isAccessibleForFree;if(!(t===!1||typeof t=="string"&&t.toLowerCase()==="false"))return!1;let r=n.hasPart;return(Array.isArray(r)?r:r?[r]:[]).some(s=>{if(typeof s!="object"||s===null)return!1;let c=s;return typeof c.cssSelector=="string"&&c.cssSelector.trim()!==""})}var yo,Dl,Ae,Ii=p(()=>{"use strict";y();yo=1e5,Dl=new Set(["NewsArticle","Article","ReportageNewsArticle","AnalysisNewsArticle","BackgroundNewsArticle","OpinionNewsArticle","ReviewNewsArticle","LiveBlogPosting","BlogPosting"]);Ae=class n{static collect(e){var r;let t=Array.from(e.querySelectorAll('script[type="application/ld+json"]')),i=[];for(let a of t){let s=(r=a.textContent)!=null?r:"";if(s.length>yo){o.warn(`[JsonLdInspector] skipping oversized block (${s.length} chars > ${yo})`);continue}let c;try{c=JSON.parse(s)}catch{o.warn("[JsonLdInspector] skipping malformed JSON-LD block");continue}if(Array.isArray(c))for(let u of c)typeof u=="object"&&u!==null&&i.push(u);else if(typeof c=="object"&&c!==null){let u=c;if(Array.isArray(u["@graph"]))for(let d of u["@graph"])typeof d=="object"&&d!==null&&i.push(d);else i.push(u)}}return i}static runChecks(e,t){let i=n.collect(e),r=i.length>0,a=i.find(m=>typeof m=="object"&&m!==null&&Ml(m)),s=a!==void 0,c=s,u=s&&Nl(a),d=!1;if(s&&typeof a.headline=="string"){let m=sr(a.headline),v=Ol(e);v!==null&&(d=Ul(m,v))}let g=s?Fl(a,t):!t;return[{id:"jsonld_present",audience:"A",pass:r},{id:"jsonld_newsarticle",audience:"B",pass:c},{id:"jsonld_required_props",audience:"B",pass:u},{id:"schema_dom_consistency",audience:"B",pass:d},{id:"paywall_markup",audience:"B",pass:g}]}}});function bo(n){return n.trim().toLowerCase().replace(/^https?:\/\//,"").replace(/^schema\.org\//,"").replace(/^schema:/,"")}function Co(n,e){if(e===void 0||e.length===0)return!0;let t=n["@type"],i=Array.isArray(t)?t:[t],r=new Set(i.filter(a=>
1typeof a=="string").map(bo));return e.some(a=>typeof a=="string"&&r.has(bo(a)))}function wo(n,e=document){return l(()=>l(()=>Ae.collect(e),[]).some(i=>Co(i,n)),!1)}function _o(n,e=void 0,t=document){return l(()=>{let i=Ue(n);if(i===null)return null;let r=l(()=>Ae.collect(t),[]),a=[];for(let s of r){if(a.length>=Z)break;let c=s;Co(c,e)&&a.push(...ut(c,i,{fanOutArrays:!0}))}return G(a)},null)}var cr=p(()=>{"use strict";Ii();h();be();Nt()});function Eo(n,e,t=document){return l(()=>{if(typeof n!="string"||typeof e!="string")return null;let r=l(()=>Array.from(t.querySelectorAll(n)).slice(0,Z),[]).map(a=>l(()=>a.getAttribute(e),null));return G(r)},null)}var So=p(()=>{"use strict";h();be()});function Ao(n,e=document){return l(()=>{if(typeof n!="string")return null;let i=l(()=>Array.from(e.querySelectorAll(n)).slice(0,Z),[]).map(r=>l(()=>r.textContent,null));return G(i)},null)}var ko=p(()=>{"use strict";h();be()});function Ut(){return l(()=>typeof window!="undefined"?window:{},{})}function To(n,e=Ut()){return l(()=>{let t=Ue(n);if(t===null)return null;let i=ut(e,t,{fanOutArrays:!1});if(i.length===0)return null;let[r]=i;return Array.isArray(r)?G(r):G(i)},null)}var lr=p(()=>{"use strict";h();be();Nt()});function Po(n){let e=0,t=n.parentElement;for(;t!==null;)e++,t=t.parentElement;return e}function $l(n){return n.querySelector("article")===null}function zl(n){for(let e of Hl){let t=l(()=>Array.from(n.querySelectorAll(e)).filter($l),[]);if(t.length!==0)return t.reduce((i,r)=>Po(r)>Po(i)?r:i)}for(let e of Bl){let t=l(()=>n.querySelector(e),null);if(t!==null)return t}return null}function Kl(n){var t;let e=((t=n.textContent)!=null?t:"").trim();return e===""?0:e.split(/\s+/).length}function Ro(n=document){return l(()=>{let e=zl(n);if(e===null)return 0;let t=l(()=>e.cloneNode(!0),e);return t!==e&&l(()=>{t.querySelectorAll(Vl).forEach(i=>i.remove())},void 0),Kl(t)},0)}var Hl,Bl,Vl,xo=p(()=>{"use strict";h();Hl=['[itemprop="articleBody"]',".article-body, .entry-content","main article","article"],Bl=["main","body"],Vl=["nav","aside","footer","figcaption",'[class*="related"]','[class*="recommend"]',"[data-related]"].join(", ")});function Io(n,e=document){return l(()=>{if(n!=="wordCount")return null;let t=Ro(e);return Number.isFinite(t)&&t>0?t:null},null)}var Do=p(()=>{"use strict";xo();h()});function ql(n){if(n.length===0)return!1;for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);if(t<48||t>57)return!1}return!0}function Gl(n){if(typeof n!="object"||n===null||Array.isArray(n))return!1;for(let e of Object.keys(n))if(e===jl||ql(e))return!1;return!0}function No(n){if(typeof n!="object"||n===null||Array.isArray(n))return!1;let e=Object.getPrototypeOf(n);return e===Object.prototype||e===null}function ur(n,e,t,i){for(let r of Object.keys(e)){let a=l(()=>e[r],Mo);if(a===Mo)continue;i.remaining--;let s=n[r];i.remaining>0&&t<Wl&&No(s)&&No(a)?n[r]=ur(Yl(s,i),a,t+1,i):n[r]=a}return n}function Yl(n,e){return ur(Object.create(null),n,0,e)}function Jl(n){let e=Object.create(null),t={remaining:Ql};for(let i of n)Gl(i)&&ur(e,i,0,t);return e}function Xl(n,e){if(Object.prototype.hasOwnProperty.call(n,e))return n[e];let t=Ue(e);if(t===null)return;let i=ut(n,t,{fanOutArrays:!1});return i.length===0?void 0:i[0]}function Uo(n,e=Ut(),t=Lo){return l(()=>{let i=typeof t=="string"&&t.trim()!==""?t.trim():Lo;if(typeof e!="object"||e===null||!Object.prototype.hasOwnProperty.call(e,i))return null;let r=l(()=>e[i],void 0);if(!Array.isArray(r))return null;let a=Xl(Jl(r),n);if(Array.isArray(a)){let s=a.length>Z?a.slice(0,Z):a.slice();return Ri(Ti("joinList",s))}return Pi(a)},null)}var Lo,jl,Mo,Wl,Ql,Oo=p(()=>{"use strict";h();Lt();be();Nt();lr();Lo="dataLayer",jl="event",Mo=Symbol("unreadable");Wl=ar,Ql=2e4});function dr(){return{doc:document,globalScope:Ut()}}function Ce(n){return typeof n=="string"&&n.trim()!==""?n:null}function Zl(n,e){var g;let t=n,i=Ce(t.meta);if(i!==null)return lo(i,e.doc);let r=Ce(t.microdata);if(r!==null)return ho(r,(g=Ce(t.type))!=null?g:void 0,e.doc);let a=Ce(t.jsonld);if(a!==null){let m=Array.isArray(t.type)?t.type.filter(v=>typeof v=="string"):void 0;return _o(a,m,e.doc)}if(Array.isArray(t.attr)){let m=Ce(t.attr[0]),v=Ce(t.attr[1]);return m===null||v===null?null:Eo(m,v,e.doc)}let s=Ce(t.text);if(s!==null)return Ao(s,e.doc);let c=Ce(t.global);if(c!==null)return To(c,e.globalScope);let u=Ce(t.datalayer);if(u!==null)return Uo(u,e.globalScope,e.dataLayerName);let d=Ce(t.computed);return d!==null?Io(d,e.doc):null}function eu(n,e){let t=Array.isArray(n)?n:[n];if(e.matches!==void 0){let i=Mt(e.matches);if(i===null)return null;t=t.filter(r=>xi(i,r))}if(e.extract!==void 0){let i=Mt(e.extract);if(i===null)return null;let r=[];for(let a of t){let s=ao(i,a);s!==null&&r.push(s)}t=r}return t.length===0?null:t}function tu(n,e){return!e||n.length===1?n[0]:n}function fr(n,e=dr()){return l(()=>{if(typeof n!="object"||n===null)return null;let t=Zl(n,e);if(t===null)return null;let i=eu(t,n);if(i===null)return null;let r=tu(i,n.all===!0);return n.transform===void 0?r:Ri(Ti(n.transform,r))},null)}var Fo=p(()=>{"use strict";Lt();h();be();rr();uo();or();cr();So();ko();lr();Do();Oo()});function gr(){return{...dr(),path:l(()=>window.location.pathname,"")}}function au(n){let e=n==null?void 0:n.articleDetection;if(e==null)return"auto";if(e==="auto"||e==="paths"||e==="off")return e;let t=typeof e=="string"?`"${e}"`:`a ${typeof e}`;return o.warn(`[MetadataResolver] unrecognised autoContext.articleDetection (${t}) \u2014 falling back to 'auto'. Valid values are 'auto', 'paths', 'off'.`),"auto"}function ou(n){let e=n==null?void 0:n.articlePaths;return Array.isArray(e)?e:[]}function su(n,e){return l(()=>{var c,u;let t={verdict:Array.isArray(n==null?void 0:n.verdict)?n.verdict:[],fields:n!=null&&n.fields&&typeof n.fields=="object"?n.fields:{}},i=e==null?void 0:e.profile,r=Array.isArray(i==null?void 0:i.verdict)?i.verdict:t.verdict,a={...t.fields};if(i!=null&&i.fields&&typeof i.fields=="object")for(let[d,g]of Object.entries(i.fields))Array.isArray(g)&&(a[d]=g);let s=(c=e==null?void 0:e.dataLayerMapping)==null?void 0:c.fields;if(s&&typeof s=="object")for(let[d,g]of Object.entries(s))typeof g!="string"||g.trim()===""||(a[d]=[{datalayer:g.trim()},...(u=a[d])!=null?u:[]]);return{verdict:r,fields:a}},{verdict:[],fields:{}})}function cu(n){return(n==null?void 0:n.path)===!0}function lu(n,e,t){return l(()=>{if(typeof n!="object"||n===null)return null;let i=n;if(i.path===!0)return Ze(t)?yt(e.path,t):null;if(typeof i.meta=="string"&&i.meta.trim()!=="")return uu(i,e);let r=Ho(i.microdata);if(r!==null)return typeof r=="string"?mo(r,e.doc):null;let a=Ho(i.jsonld);if(a!==null){let s=Array.isArray(a)?a.filter(c=>typeof c=="string"&&c.trim()!==""):[];return s.length===0?null:wo(s,e.doc)}return typeof i.bodyClass=="string"&&i.bodyClass.trim()!==""?du(i.bodyClass,e.doc):null},null)}function Ho(n){if(n==null||typeof n!="object")return null;let e=n.type;return e===void 0?null:e}function uu(n,e){let t=fr({meta:n.meta,all:!0},e);if(t===null)return!1;if(!Array.isArray(n.equals))return!0;let i=n.equals.filter(a=>
1typeof a=="string");return i.length===0?!0:(Array.isArray(t)?t:[t]).some(a=>i.includes(String(a)))}function du(n,e){let t=Mt(n);if(t===null)return!1;let i=l(()=>{var r,a;return(a=(r=e.body)==null?void 0:r.getAttribute("class"))!=null?a:""},"");return i===""?!1:xi(t,i)}function fu(n,e,t){return l(()=>{let i=au(e);if(i==="off"||!Array.isArray(n)||n.length===0)return"no-opinion";let r=ou(e),a=(i==="paths"?n.filter(cu):n).slice(0,ru),s=0;for(let c of a){let u=lu(c,t,r);if(u!==null&&(s+=1,u))return"article"}return s===0?"no-opinion":"not-article"},"no-opinion")}function gu(n,e){return l(()=>{let t={};if(!n||typeof n!="object")return t;for(let[i,r]of Object.entries(n).slice(0,iu))if(Array.isArray(r))for(let a of r.slice(0,nu)){let s=l(()=>fr(a,e),null);if(s!==null){t[i]=s;break}}return t},{})}function Bo(n,e={},t=gr(),i=!1){return l(()=>{let r=su(n,e),a=fu(r.verdict,e,t),c=a==="article"||a==="no-opinion"&&i===!0?gu(r.fields,t):{};return{verdict:a,fields:c}},{verdict:"no-opinion",fields:{}})}var iu,nu,ru,Vo=p(()=>{"use strict";Fo();rr();or();cr();Jt();h();y();iu=64,nu=32,ru=32});function zo(n){if(n===null||typeof n!="object")return n;for(let e of Object.values(n))zo(e);return Object.freeze(n)}var $o,pu,Ot,Ft,Ko=p(()=>{"use strict";$o="^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$",pu="https://schema.org/NewsArticle",Ot=[];Ft=zo({verdict:[{path:!0},{meta:"og:type",equals:["article","news article"]},{microdata:{type:pu}},{jsonld:{type:["NewsArticle","Article","ReportageNewsArticle","OpinionNewsArticle","BlogPosting"]}},{meta:"article:published_time",nonEmpty:!0},{bodyClass:"\\bsingle-(post|article)\\b"}],fields:{article_title:[{meta:"parsely-title"},{microdata:"headline"},{jsonld:"headline"},{meta:"article:title"},{meta:"headline"},{meta:"og:title"},{text:'main[itemtype*="NewsArticle"] h1'},{text:"article h1"}],article_url:[{meta:"parsely-link"},{attr:["link[rel=canonical]","href"]},{jsonld:"url"},{meta:"og:url"}],article_uuid:[{meta:"parsely-post-id"},{attr:['main[itemtype*="NewsArticle"] article',"data-uuid"]},{attr:['main[itemtype*="NewsArticle"] article',"id"]},{attr:["article","data-uuid"],matches:$o},{attr:["article","id"],matches:$o},{jsonld:"identifier"},{jsonld:"@id"}],article_section:[{meta:"parsely-section"},{microdata:"articleSection"},{meta:"article:section"},{meta:"article:mainsection"},{jsonld:"articleSection"}],author_name:[{meta:"parsely-author",all:!0,transform:"joinList"},{microdata:"creator.name",all:!0,transform:"joinList"},{microdata:"author.name",all:!0,transform:"joinList"},{jsonld:"author.name",all:!0,transform:"joinList"},{jsonld:"creator",all:!0,transform:"joinList"},{meta:"article:author",all:!0,transform:"joinList"},{meta:"docauthor"},{meta:"author"}],article_publication_date:[{meta:"parsely-pub-date",transform:"isoDate"},{microdata:"datePublished",transform:"isoDate"},{jsonld:"datePublished",transform:"isoDate"},{meta:"article:published_time",transform:"isoDate"},{meta:"pubdate",transform:"isoDate"},{attr:["time[itemprop=datePublished]","datetime"],transform:"isoDate"}],article_is_premium:[{jsonld:"isAccessibleForFree",transform:"invert"},{meta:"article:content_tier",transform:"tierToBool"}],article_concept_name:[{microdata:"keywords",all:!0,transform:"joinList"},{attr:["article","data-categories"]},{meta:"article:tag",all:!0,transform:"joinList"}],total_word_count:[{computed:"wordCount"}],article_section_uuid:Ot,author_uuid:Ot,article_concept_uuid:Ot,article_publication:Ot,article_content:Ot}})});function pr(n){return l(()=>(n==null?void 0:n.enabled)!==!1,!0)}function hu(n){return l(()=>(n==null?void 0:n.wordCount)!=="off",!0)}function vu(n){return n.filter(e=>(e==null?void 0:e.computed)===void 0)}function jo(n){let e={};for(let[t,i]of Object.entries(n))e[t]=Array.isArray(i)?vu(i):i;return e}function yu(n){let e=n.profile;return!e||typeof e!="object"||!e.fields||typeof e.fields!="object"?n:{...n,profile:{...e,fields:jo(e.fields)}}}function qo(n={}){return l(()=>{if(!pr(n))return mu;let e=n&&typeof n=="object"?n:{};return hu(e)?{profile:Ft,config:e}:{profile:{verdict:Ft.verdict,fields:jo(Ft.fields)},config:yu(e)}},bu)}var mu,bu,Go=p(()=>{"use strict";Ko();h();mu=Object.freeze({profile:Object.freeze({verdict:[],fields:{}}),config:Object.freeze({articleDetection:"off"})});bu=Object.freeze({profile:Ft,config:Object.freeze({})})});function mr(){return{isArticle:!1,data:{}}}var Cu,wu,Ht,Wo,ue,hr=p(()=>{"use strict";S();y();h();Vo();Go();Lt();Cu=3e3,wu=100,Ht="article_is_premium",Wo=Object.freeze({verdict:"no-opinion",fields:Object.freeze({})}),ue=class{static async resolve(){return(await this.resolveContext()).data}
1static async resolveContext(){if(this.ensureUnloadListeners(),this.decision)return this.currentContext();if(this.pending)return await this.pending,this.currentContext();let e=this.readLive();if(Object.keys(e).length>0)return this.latch(!0,e),this.currentContext();if(!this.isMappingConfigured()||this.unloadStarted)return this.latch(!1,{}),this.currentContext();this.pending=this.waitForArticleData();try{await this.pending}finally{this.pending=null}return this.currentContext()}static reset(){this.decision=null,this.pending=null,o.log("[ArticleContext] Reset for new page session")}static isDecided(){return this.decision!==null}static currentContext(){let e=this.decision;if(!e||!e.isArticle)return mr();let t=this.readLive(),i=Object.keys(t).length>0?t:e.data,r={...e.markupFields,...i};return Object.prototype.hasOwnProperty.call(i,Ht)&&lt(i[Ht])===null&&Object.prototype.hasOwnProperty.call(e.markupFields,Ht)&&(r[Ht]=e.markupFields[Ht]),{isArticle:!0,data:r}}static latch(e,t){let i=this.resolveMarkup(e),r=e||i.verdict==="article";this.decision={isArticle:r,data:t,markupFields:i.fields},o.info(`[ArticleContext] Page session latched as ${r?"ARTICLE":"NON-ARTICLE"} (declared: ${e?"article":"not-article"}, markup: ${i.verdict})`)}static resolveMarkup(e){return l(()=>{let t=f.getAutoContextConfig();if(!pr(t))return Wo;let{profile:i,config:r}=qo(t);return Bo(i,r,this.resolverContext(r),e)},Wo)}static resolverContext(e){var r;let t=gr(),i=(r=e==null?void 0:e.dataLayerMapping)==null?void 0:r.variableName;return typeof i=="string"&&i.trim()!==""&&(t.dataLayerName=i.trim()),t}static readLive(){let e=f.getArticleDetails();return e.success&&e.value?e.value:{}}static isMappingConfigured(){let e=f.getValue("articleDetailsMapping");return!!(e&&e.variableName)}static readyTimeoutMs(){let e=f.getValue("articleDetailsMapping"),t=e&&typeof e.readyTimeoutMs=="number"?e.readyTimeoutMs:Cu;return Math.max(0,Math.min(t,3e4))}static waitForArticleData(){let e=this.readyTimeoutMs(),t=Date.now();return new Promise(i=>{let r=(s,c,u)=>{this.decision||(this.latch(s,c),s||o.warn(`[ArticleContext] Article global never appeared (${u}); declared data classifies this page as non-article`)),i(this.decision)},a=()=>{let s=this.readLive();if(Object.keys(s).length>0){r(!0,s,"found");return}if(this.unloadStarted){r(!1,{},"unload started");return}if(Date.now()-t>=e){r(!1,{},`timeout ${e}ms`);return}setTimeout(a,wu)};a()})}static ensureUnloadListeners(){if(this.listenersInstalled||typeof window=="undefined")return;this.listenersInstalled=!0;let e=()=>{this.unloadStarted=!0};window.addEventListener("beforeunload",e),window.addEventListener("pagehide",e),window.addEventListener("pageshow",()=>{this.unloadStarted=!1})}};ue.decision=null,ue.pending=null,ue.unloadStarted=!1,ue.listenersInstalled=!1});var _u,Di,vr=p(()=>{"use strict";_u={event_id:"",publication_id:"",organisation_id:"",organisation_name:"",publication_name:"",event_time_epoc:"",event_create_year:"",event_create_month:"",event_create_date:"",platform_type:"",platform_model:"",platform_name:"",platform_version:"",platform_os_name:"",referrer_url:"",referrer_type:"",event_timestamp_utc:"",sdk_version:"",event_creation_date:"",device_id:"",session_id:"",page_view_uuid:"",page_view_url:"",page_title:"",previous_page_view_uuid:"",previous_page_view_url:"",bot_suspected:!1,agent_suspected:!1,agent_signals:"",utm_source:"",utm_medium:"",utm_campaign:"",utm_content:"",utm_term:"",gclid:"",fbclid:"",msclkid:"",first_touch_utm_source:"",first_touch_utm_medium:"",first_touch_utm_campaign:"",first_touch_utm_content:"",first_touch_utm_term:"",event_name:"",ai_source:""},Di=_u});var Eu,Li,yr=p(()=>{"use strict";Eu={user_id:"",is_logged_in:"",user_subscription:""},Li=Eu});var Su,Qo,Yo=p(()=>{"use strict";Su={scroll_depth_percent:"",time_spent_seconds:"",size_category:"",engaged_reading_depth_percentage:""},Qo=Su});var Au,Jo,Xo=p(()=>{"use strict";Au={click_type:"",click_action:"",article_uuid:"",element_text:"",element_tag:"",element_url:""},Jo=Au});var ku,Zo,es=p(()=>{"use strict";ku={},Zo=ku});var Tu,ts,is=p(()=>{"use strict";Tu={page_session_id:"",ping_sequence:"",ping_type:"",ping_interval_seconds:"",total_time_seconds:"",scroll_depth_percent:"",total_hidden_time_seconds:"",interval_active_seconds:"",interval_total_seconds:"",interval_hidden_seconds:"",is_visible:"",visibility_changes_count:"",has_scrolled:"",has_clicked:"",has_typed:"",page_load_time_epoc:"",time_since_page_load_seconds:"",time_spent_seconds:"",size_category:"",engaged_reading_depth_percentage:""},ts=Tu});var Pu,ns,rs=p(()=>{"use strict";Pu={experiment_id:"",experiment_name:"",variant:"",is_control:"",variant_source:"",variant_title:"",original_title:"",target_selector:"",target_url:"",target_type:""},ns=Pu});var Ru,as,os=p(()=>{"use strict";Ru={click_target_tag:"",click_target_href:"",click_position:"",time_since_view_ms:""},as=Ru});var xu,ss,cs=p(()=>{"use strict";xu={click_id:"",original_click_at:"",qualified_at:"",active_seconds_observed:""},ss=xu});var Bt,ls=p(()=>{"use strict";k();h();y();nt();Bt=class{static calculateEngageReadingDepth(e,t,i={}){return _(()=>{if(e<0||t<0)throw new Error("Word count and time spent must be non-negative values");let r=i.avgReadingSpeedPerMinute||this.DEFAULT_READING_SPEED,a=r/60,s=t*a,c=0;return e>0&&(c=s/e*100,c=Math.min(100,Math.ceil(c))),o.info("[EngageReadingDepthCalculator] Calculation details:"),o.info("Total Word Count:",e),o.info("Time Spent (seconds):",t),o.info("Avg Reading Speed (words/min):",r),o.info("Avg Reading Speed (words/second):",a),o.info("Total Word Reading Capacity:",s),o.info("Total Engage Reading Percentage:",c),{totalReadingDepthPercentage:c,totalWordReadingCapacity:s,avgReadingSpeedPerSecond:a}},{message:"Failed to calculate engage reading depth percentage",severity:"low",source:"EngageReadingDepthCalculator.calculateScrollDepth"})}static calculateEngageReadingDepthWithCustomSpeed(e,t,i){return this.calculateEngageReadingDepth(e,t,{avgReadingSpeedPerMinute:i})}};Bt.DEFAULT_READING_SPEED=ie.ARTICLE_READING_SPEED_WPM});function br(n){return n==="click"||n.includes("_click")}var Iu,Du,Mi,us=p(()=>{"use strict";k();h();vr();Yt();yr();Yo();Xo();es();is();rs();os();cs();Rt();ls();y();Iu=Qn("page_leave"),Du=Qn("engagement_ping");Mi=class n{static toIntegerString(e){if(e==null||e==="")return"0";let t=Number(e);return isNaN(t)?"0":Math.floor(t).toString()}static toBooleanString(e){if(e==null||e==="")return"false";if(typeof e=="string"){let t=e.trim().toLowerCase();if(t==="false"||t==="0")return"false"}return(!!e).toString()}static normalize(e){return _(()=>{let t=Iu.has(e.event_name),i=Du.has(e.event_name),r=e.event_name==="article_engagement_ping",a=e.event_name.startsWith("ab_experiment_"),s=e.event_name==="ab_experiment_qualified_click",c=e.event_name==="ab_experiment_click",u=!a&&br(e.event_name),d=e.event_name==="page_view"||e.event_name==="page_leave",g={...Di,...u&&!d?Jo:{},...!u&&!a&&!d&&!i?Re:{},...!u&&!a&&d?Zo:{},...!r&&i?{page_title:""}:{},...r?Re:{},...Li,...t?Qo:{},...i?ts:{},...a?ns:{},...c?as:{},...s?ss:{}};if(e.event_name==="article_page_leave"||e.event_name==="article_engagement_ping"){let w=e.total_word_count||0,K=e.time_spent_seconds||e.total_time_seconds||0,P=Bt.calculateEngageReadingDepth(w,K);if(P.success){let M=P.value;e.engaged_reading_depth_percentage=M.totalReadingDepthPercentage.toString(),o.info("[EventNormalizer] Engage reading depth calculation completed successfully")}else o.warn("[EventNormalizer] Failed to calculate engage reading depth:",P.error.message),e.engaged_reading_depth_percentage="0";let te="",Ee=e.total_word_count;if(Ee!=null&&!isNaN(Number(Ee))){let M=Number(Ee);M<=500?te="Small":M>500&&M<=1200?te="Medium":M>1200&&(te="Large"),e.size_category=te,o.info("[EventNormalizer] Article category determined:",te,"for word count:",M),o.info("[EventNormalizer] Article Word Count:",M),o.info("[EventNormalizer] Article category:",te)}else o.warn("[EventNormalizer] Invalid or missing word count, skipping article category calculation")}e.scroll_depth_percent&&o.info("[EventNormalizer] Scroll Depth Percentage:",e.scroll_depth_percent);let v=new Set(Object.keys(g)),b={...g},E={};
1if(typeof e.additional_info=="string")try{E=JSON.parse(e.additional_info)}catch{E={}}else typeof e.additional_info=="object"&&e.additional_info!==null&&(E=e.additional_info);for(let w of Object.keys(e))if(!w.startsWith("ex_")&&w!=="additional_info"){if(w==="total_word_count"){(t||i)&&(E[w]=e[w],o.info("[EventNormalizer] Added total_word_count to additional_info:",e[w]));continue}v.has(w)?b[w]=e[w]:E[w]=e[w]}if(b.additional_info=JSON.stringify(E),i){let w=["ping_sequence","time_spent_seconds","total_time_seconds","total_hidden_time_seconds","interval_total_seconds","interval_active_seconds","interval_hidden_seconds","time_since_page_load_seconds","visibility_changes_count","scroll_depth_percent","page_load_time_epoc","ping_interval_seconds"];for(let P of w)P in b&&(b[P]=n.toIntegerString(b[P]));let K=["is_visible","has_scrolled","has_clicked","has_typed"];for(let P of K)P in b&&(b[P]=n.toBooleanString(b[P]))}return b},{message:"Failed to normalize event data",severity:"medium",source:"EventNormalizer.normalize"})}}});var It={};O(It,{EventFactory:()=>F});var F,le=p(()=>{"use strict";k();h();ir();hr();us();y();S();Rt();it();Yn();fi();F=class{static async createEvent(e,t={},i={}){return await C(async()=>{if(f.disable_get().DisableOption===!0)return o.info("[EventFactory] Event creation disabled by config; skipping",e),null;if(Wa(e,i))return null;let[r,a,s]=await Promise.all([Ne.getCommonEventData(),i.skipArticleContext?Promise.resolve(mr()):ue.resolveContext(),Ne.getUserEventData()]),c=br(e),u=!Dt.has(e),d=c?{}:a.data,g=Ne.getPageViewContextData(),m=g.success?g.value:{};if(!r.success)throw new Error("Failed to get common event data");let v=r.value,b=s.success?s.value:{},E=a.isArticle&&!u?`article_${e}`:e;(!b.user_id||b.user_id==="false")&&(b.user_id=v.device_id),o.info("[EventFactory] Event Name:",E);let w=l(()=>q.resolve(),{pageClass:"unknown",source:"default"}),K=a.isArticle?he.get():null,P=l(()=>da(),null),te={...v,...d,...b,...m,...t,event_name:E,organisation_id:f.getValue("organisation_name"),page_class:w.pageClass,page_class_source:w.source,...K!==null?{content_access:K}:{},...P!==null?{page_class_signals:P}:{}},Ee=Mi.normalize(te);if(!Ee.success)throw new Error("Failed to normalize event data");return Ee.value},{message:`Failed to create ${e} event`,severity:"medium",source:"EventFactory.createEvent"})}}});var Ui={};O(Ui,{PageViewTracker:()=>Ni});var Ni,Oi=p(()=>{"use strict";h();le();Se();k();y();Me();Ni=class{static async track(){return this.hasTrackedView?(o.info("[PageView] Already tracked for this page load"),!1):(await C(async()=>{J.recordPageView();let t=await F.createEvent("page_view");if(!t.success)throw new Error("Failed to create page view event");if(t.value===null)return!1;let r=(await ne.send(t.value)).unwrapOr(!1);return r&&(this.hasTrackedView=!0,o.info("[PageView] Successfully tracked and marked as sent")),r},{message:"Failed to track page view",severity:"medium",source:"PageViewTracker.track",eventName:"page_view"})).unwrapOr(!1)}static reset(){this.hasTrackedView=!1,o.info("[PageView] Tracking flag reset for new page")}};Ni.hasTrackedView=!1});var I,Vt=p(()=>{"use strict";y();Fi();I=class{static initialize(e={}){this.config={...this.config,...e},typeof document!="undefined"&&(this.state.isVisible=document.visibilityState==="visible",this.state.isVisible?this.state.visibleAt=Date.now():this.state.hiddenAt=Date.now()),o.info("[VisibilityTracker] Initialized with config:",this.config)}static handleVisibilityChange(e){if(typeof document=="undefined")return;e&&(this.onHiddenTimeoutCallback=e);let t=document.visibilityState==="visible";t&&!this.state.isVisible?this.handlePageVisible():!t&&this.state.isVisible&&this.handlePageHidden()}static handlePageVisible(){if(o.info("[VisibilityTracker] Page became visible"),this.hiddenTimer&&(clearTimeout(this.hiddenTimer),this.hiddenTimer=null,o.info("[VisibilityTracker] Cancelled hidden timeout timer")),this.state.hiddenAt!==null){let e=Date.now()-this.state.hiddenAt;this.state.totalHiddenTime+=e,o.info("[VisibilityTracker] Hidden duration:",e,"ms")}this.state.isVisible=!0,this.state.visibleAt=Date.now(),this.state.hiddenAt=null,wr()}static handlePageHidden(){o.info("[VisibilityTracker] Page became hidden"),Cr(),this.state.isVisible=!1,this.state.hiddenAt=Date.now(),this.state.visibleAt=null,this.hiddenTimer=setTimeout(()=>{o.info("[VisibilityTracker] Hidden timeout reached"),this.onHiddenTimeoutCallback&&this.onHiddenTimeoutCallback(),this.hiddenTimer=null},this.config.hiddenPageTimeout),o.info("[VisibilityTracker] Started hidden timeout timer:",this.config.hiddenPageTimeout,"ms")}static getState(){return{...this.state}}static isHiddenTooLong(){return this.state.hiddenAt?Date.now()-this.state.hiddenAt>=this.config.hiddenPageTimeout:!1}static reset(){o.info("[VisibilityTracker] Resetting state"),this.hiddenTimer&&(clearTimeout(this.hiddenTimer),this.hiddenTimer=null),this.state={isVisible:typeof document!="undefined"?document.visibilityState==="visible":!0,hiddenAt:null,visibleAt:null,totalHiddenTime:0},this.onHiddenTimeoutCallback=null}static getTotalHiddenTime(){let e=this.state.totalHiddenTime;return this.state.hiddenAt!==null&&(e+=Date.now()-this.state.hiddenAt),e}static getTotalHiddenTimeSeconds(){return Math.round(this.getTotalHiddenTime()/1e3)}};I.state={isVisible:typeof document!="undefined"?document.visibilityState==="visible":!0,hiddenAt:null,visibleAt:null,totalHiddenTime:0},I.hiddenTimer=null,I.config={hiddenPageTimeout:3e4},I.onHiddenTimeoutCallback=null});function ee(n,e){return t=>{try{n(t)}catch(i){try{let r=i instanceof Error?i.message:String(i);console.error(`[${e}
1] Event listener error:`,r),i instanceof Error&&i.stack&&console.error(`[${e}] Stack trace:`,i.stack)}catch{}}}}function de(n,e){return()=>{try{n()}catch(t){try{let i=t instanceof Error?t.message:String(t);console.error(`[${e}] Callback error:`,i),t instanceof Error&&t.stack&&console.error(`[${e}] Stack trace:`,t.stack)}catch{}}}}var Oe=p(()=>{"use strict"});function Hi(){let n=window.scrollY||document.documentElement.scrollTop,e=window.innerHeight||document.documentElement.clientHeight,t=document.documentElement.scrollHeight;return Math.min(Math.ceil((n+e)/t*100),100)}var Bi=p(()=>{"use strict"});function Ki(){return typeof performance!="undefined"?performance.now():Date.now()}function fs(){Ge&&(Vi+=Ki()-zi,Ge=!1)}function Mu(){Ge||(zi=Ki(),Ge=!0)}function _r(){return Ge?Vi+(Ki()-zi):Vi}function gs(){if(we.length===0)return;let n=_r();for(let e=we.length-1;e>=0;e--){let t=we[e];if(n>=t.thresholdMs){we.splice(e,1);try{t.callback()}catch(i){o.warn("[ActiveTimeMonitor] threshold callback threw:",i)}}}we.length===0&&re&&(clearInterval(re),re=null)}function Nu(){if(re||typeof setInterval=="undefined")return;re=setInterval(()=>{Ge&&gs()},Lu);let n=re;typeof(n==null?void 0:n.unref)=="function"&&n.unref()}function ps(){Mu(),ke&&clearTimeout(ke),ke=setTimeout(()=>{fs()},5e3),gs()}var Lu,Vi,zi,Ge,ke,we,re,ds,Fe,Er=p(()=>{"use strict";y();Oe();Bi();Lu=250,Vi=0,zi=typeof performance!="undefined"?performance.now():0,Ge=!0,ke=null,we=[],re=null;ds=de(ps,"ActiveTimeMonitor.onUserActivity");typeof window!="undefined"&&(["scroll","mousemove","keydown","mousedown","touchstart"].forEach(n=>window.addEventListener(n,ds,{passive:!0})),ds());Fe={pause(){fs(),ke&&(clearTimeout(ke),ke=null)},resume(){ps()},getActiveSecondsSincePageLoad(){return Math.round(_r()/1e3)},subscribeToThreshold(n,e){let t={thresholdMs:Math.max(0,n)*1e3,callback:e};if(_r()>=t.thresholdMs){try{e()}catch(i){o.warn("[ActiveTimeMonitor] immediate threshold callback threw:",i)}return()=>{}}return we.push(t),Nu(),()=>{let i=we.indexOf(t);i>=0&&we.splice(i,1),we.length===0&&re&&(clearInterval(re),re=null)}},__resetForTests(){Vi=0,zi=Ki(),Ge=!0,ke&&(clearTimeout(ke),ke=null),we.length=0,re&&(clearInterval(re),re=null)}}});var ms={};O(ms,{LeavePageTracker:()=>He,pauseEngagementTimer:()=>Cr,resumeEngagementTimer:()=>wr});function Cr(){Fe.pause()}function wr(){Fe.resume()}var ji,He,Fi=p(()=>{"use strict";k();h();le();Ke();y();Vt();Oe();Er();Bi();wi();ji=0;if(typeof window!="undefined"){let n=de(()=>{let e=Hi();e>ji&&(ji=e)},"LeavePageTracker.updateScrollDepth");window.addEventListener("scroll",n)}He=class n{static resetForNewView(){ji=0}static async track(e){return(await C(async()=>{let i={scroll_depth_percent:n.getScrollDepthPercent().toString(),time_spent_seconds:n.getTimeSpentSeconds().toString()};e&&(i.exit_reason=n.getExitReasonString(e),e.destinationUrl&&(i.destination_url=ye(e.destinationUrl)));let r=I.getState();i.total_hidden_time_seconds=I.getTotalHiddenTimeSeconds().toString(),i.was_visible_at_exit=r.isVisible.toString();let a=await F.createEvent("page_leave",i);if(!a.success)throw new Error("Failed to create page leave event");if(a.value===null)return!1;let s=await ce.send("/event",a.value);if(s.success){let c=s.value;return o.info("[LeavePageTracker] Event sent via:",c.method),c.success}return!1},{message:"Failed to track page leave",severity:"medium",source:"LeavePageTracker.track",eventName:"page_leave"})).unwrapOr(!1)}static getScrollDepthPercent(){return ji}static getTimeSpentSeconds(){let e=Fe.getActiveSecondsSincePageLoad();return o.info("Total time spent (seconds):",e),e}static getExitReasonString(e){return e.type}}});var ys={};O(ys,{ClickTracker:()=>Ar});var hs,Uu,Ou,Fu,Hu,vs,Bu,Vu,Sr,$u,zu,Ku,ju,H,Ar,bs=p(()=>{"use strict";k();h();le();Se();Ke();ir();S();bi();hs=new Set(["ad","ads","advert","advertisement","advertising","banner"]),Uu=new Set(["share","youtube","social","facebook","twitter","linkedin","instagram","whatsapp","pinterest","mail","gmail","telegram","reddit"]),Ou=new Set(["player","media","video"]),Fu=/googlesyndication|doubleclick|googleadservices/,Hu=[/twitter\.com\/intent\//i,/\bx\.com\/intent\//i,/facebook\.com\/(sharer|dialog\/(share|feed))/i,/linkedin\.com\/(shareArticle|sharing\/share-offsite)/i,/pinterest\.[a-z.]+\/pin\/create/i,/reddit\.com\/submit/i,/(api|web)\.whatsapp\.com\/send/i,/\bwa\.me\//i,/t\.me\/share/i,/tumblr\.com\/(share|widgets\/share)/i,/service\.weibo\.com\/share/i,/telegram\.me\/share/i,/^mailto:\?(subject|body)=/i],vs=200,Bu=150,Vu=/\.(pdf|zip|doc|docx|xl
1s|xlsx|ppt|pptx|csv|mp3|mp4|mov|avi|wmv|tar|gz|7z|rar|exe|dmg|apk|epub)(?:[?#]|$)/i,Sr=/^(mailto|tel|sms):/i,$u=new Set(["button","select","textarea","input","option","label","summary","details"]),zu=new Set(["button","link","checkbox","radio","switch","tab","menuitem","menuitemcheckbox","menuitemradio","option","treeitem","combobox","listbox","slider","spinbutton","searchbox","textbox"]),Ku=["onclick","aria-expanded","aria-controls","aria-haspopup"],ju=5,H=class H{static async trackClick(e,t=!1,i){let r=t||e.wasRightClicked===!0,a=H.getEventTypeFromClick(e),s=H.resolveClickAction(r,i);if(H.isSyntheticLabelClick(e)||a==="inert"&&s==="left"&&!H.shouldTrackInertClick())return!1;Le.touchSession();let c=await H.extractClickInfo(e);return(await C(async()=>{let d=await F.createEvent("click",{click_type:a,click_action:s,...c});if(!d.success)throw new Error("Failed to create click event");if(d.value===null)return!1;if(H.NAVIGATING_CLICK_TYPES.has(a)&&s==="left"){let m=await ce.send("/event",d.value);return m.success&&m.value.success}return(await ne.send(d.value)).unwrapOr(!1)},{message:"Failed to track click event",severity:"low",source:"ClickTracker.trackClick",eventName:"click"})).unwrapOr(!1)}static resolveClickAction(e,t){return e?"right":t?t.button===2?"right":t.button===1?"middle":t.ctrlKey||t.metaKey||t.shiftKey?"new_tab":"left":"left"}static isSyntheticLabelClick(e){var t;try{let i=Date.now(),r=H.lastLabelControl;if(e.tagName&&e.tagName.toLowerCase()==="label"){let a=e,s=(t=a.control)!=null?t:null;return!s&&a.htmlFor&&(s=document.getElementById(a.htmlFor)),H.lastLabelControl={control:s,at:i},!1}return r&&r.control===e&&i-r.at<=Bu?(H.lastLabelControl=null,!0):!1}catch{return!1}}static shouldTrackInertClick(){try{let e=f.getClickTrackingConfig();if(e.trackInertClicks!==!0)return!1;let t=e.inertClickSamplingRate;return t>=1?!0:t<=0?!1:Math.random()<t}catch{return!1}}static async extractClickInfo(e){var d;let[t]=await Promise.all([Ne.getArticleEventData()]),{tag:i,text:r,href:a,iframeSrc:s,imgSrc:c}=this.normalizeTargetAttributes(e),u="";return i==="img"?u=c:i==="i"||i==="a"||a?u=a:u=s!=null?s:a,{article_uuid:t.success&&(d=t.value.article_uuid)!=null?d:"",element_tag:i,element_text:r,element_url:u}}static normalizeTargetAttributes(e){let t=e.tagName.toLowerCase(),i=H.normalizeElementText(e.textContent),r=(e.className||"").toLowerCase(),a=(e.id||"").toLowerCase(),s=e.href||e.getAttribute("href")||"";if(!s){let m=e.closest("a[href]");m&&(s=m.href||m.getAttribute("href")||"")}let c=s.toLowerCase(),u=`${r} ${a}`,d=this.getIframeSrc(e),g="";if(t==="img")g=e.src||"";else{let m=e.querySelector("img");m&&(g=m.src||"")}return{tag:t,text:i,classes:r,classIdText:u,id:a,href:s,hrefLower:c,iframeSrc:d,imgSrc:g}}static normalizeElementText(e){let t=(e||"").replace(/\s+/g," ").trim();return t.length>vs?t.slice(0,vs):t}static getIframeSrc(e){if(e.tagName.toLowerCase()==="iframe")return e.src||e.getAttribute("src")||"";let i=[".plyr",".flowplayer-embed-container",".video-container",".ew-embed",".article__iframe"];for(let a of i){let s=e.closest(a);if(s){let c=s.querySelector("iframe");if(c)return c.getAttribute("src")||c.src||""}}let r=e.querySelector("iframe");return(r==null?void 0:r.getAttribute("src"))||(r==null?void 0:r.src)||""}static getEventTypeFromClick(e){let{tag:t,classIdText:i,href:r,hrefLower:a,iframeSrc:s,imgSrc:c}=this.normalizeTargetAttributes(e),u=i.split(/[\W_]+/).filter(Boolean);return this.isAd(e,u,c,s)?"ad":this.isShare(u,a)?"share":t==="img"||t==="video"||t==="audio"||t==="iframe"||s||this.matchesAnyToken(u,Ou)?"media":this.isMailtoTel(a)?"mailto_tel":this.isDownload(a)?"download":this.isOutbound(a)?"outbound":t==="a"||r?"link":this.isInteractiveClick(e)?"interactive":"inert"}static isInteractiveClick(e){try{let t=e,i=0;for(;t&&i<ju;){if(H.isInteractiveElement(t))return!0;t=t.parentElement,i++}return!1}catch{return!1}}static isInteractiveElement(e){let t=e.tagName?e.tagName.toLowerCase():"";if($u.has(t)||t==="a"&&e.hasAttribute("href"))return!0;let i=(e.getAttribute("role")||"").trim().toLowerCase();if(i&&zu.has(i))return!0;for(let a of Ku)if(e.hasAttribute(a))return!0;let r=e.getAttribute("tabindex");return r!==null&&r.trim()!==""&&Number(r)>=0||e.isContentEditable?!0:H.hasPointerCursor(e)}static hasPointerCursor(e){try{return typeof window=="undefined"||typeof window.getComputedStyle!="function"?!1:window.getComputedStyle(e).cursor==="pointer"}catch{return!1}}static isMailtoTel(e){return e?Sr.test(e):!1}static isDownload(e){return!e||Sr.test(e)?!1:Vu.test(e)}static isOutbound(e){if(!e||e.startsWith("#")||e.startsWith("?")||e.startsWith("/")&&!e.startsWith("//")||Sr.test(e))return!1;try{let t=e.startsWith("//")?"https:"+e:e,i=new URL(t);return i.protocol!=="http:"&&i.protocol!=="https:"||typeof window=="undefined"||!window.location?!1:!H.isInternalHost(i.hostname.toLowerCase(),window.location.hostname.toLowerCase())}catch{return!1}}static isInternalHost(e,t){if(!e)return!1;let i=s=>s.startsWith("www.")?s.slice(4):s,r=i(e),a=i(t);if(r===a||r.endsWith("."+a)||a.endsWith("."+r))return!0;try{for(let s of f.getClickTrackingConfig().internalHosts){let c=String(s||"").trim().toLowerCase();if(c){if(c.startsWith(".")){if(e===c.slice(1)||e.endsWith(c))return!0}else if(e===c||i(c)===r)return!0}}}catch{}return!1}static isShare(e,t){return this.matchesAnyToken(e,Uu)?!0:t?Hu.some(i=>i.test(t)):!1}static matchesAnyToken(e,t){for(let i of e)if(t.has(i))return!0;return!1}static isAd(e,t,i,r){if(this.matchesAnyToken(t,hs)||e.hasAttribute("data-ad")||e.hasAttribute("data-google-ad")||typeof e.id=="string"&&e.id.startsWith("google_ads_"))return!0;let a=`${i} ${r}`.toLowerCase();if(!a.trim())return!1;
1let s=a.split(/[\W_]+/).filter(Boolean);return this.matchesAnyToken(s,hs)?!0:Fu.test(a)}};H.NAVIGATING_CLICK_TYPES=new Set(["outbound","download","mailto_tel"]),H.lastLabelControl=null;Ar=H});var D,$t=p(()=>{"use strict";h();S();D=class{static get(e){return l(()=>{if(typeof document=="undefined"||!document.cookie)return null;let t=encodeURIComponent(e)+"=",i=document.cookie.split(";");for(let r of i){let a=r.trim();if(a.startsWith(t))return decodeURIComponent(a.substring(t.length))}return null},null)}static set(e,t,i=0,r={}){l(()=>{if(typeof document=="undefined")return;let a=r.sameSite||"Lax",s=typeof location!="undefined"&&location.protocol==="https:",c=r.secure!==void 0?r.secure:s,u=r.path||"/",d=r.domain||f.getABConfig().cookieDomain,g=`${encodeURIComponent(e)}=${encodeURIComponent(t)}; path=${u}; SameSite=${a}`;d&&(g+=`; Domain=${d}`),c&&(g+="; Secure"),i>0&&(g+=`; Max-Age=${Math.floor(i*86400)}`),document.cookie=g},void 0)}static delete(e,t="/"){l(()=>{if(typeof document=="undefined")return;let i=f.getABConfig().cookieDomain,r=i?`; Domain=${i}`:"";document.cookie=`${encodeURIComponent(e)}=; path=${t}${r}; Max-Age=0; SameSite=Lax`},void 0)}}});var kr,qu,qi,Gu,Wu,Qu,Cs,Yu,Tr,Gi,ws=p(()=>{"use strict";y();h();$t();kr="g2i_",qu=new Set(["ofrgp_id","sp_offergroupid","returnurl","naviga_jid","campaignid","campaignname","conversationid","conversationname","conversationcode","meterlevel","meterlevelid"]),qi={campaignid:"campaignId",campaignname:"campaignName",conversationid:"conversationId",conversationname:"conversationName",conversationcode:"conversationCode",meterlevel:"meterLevel",meterlevelid:"meterLevelId"},Gu=new Set(["campaignId","conversationId","meterLevelId"]),Wu=2048,Qu=24,Cs=new Set(["g2i_actionid","ofrgp_id","returnurl","naviga_jid","campaignid","conversationid","meterlevelid"]),Yu=[["anonDeviceId","aui"],["auth0_sub","auth0Id"]],Tr="naviga-analytics-journey-session",Gi=class{static getContext(){let e={...l(()=>this.getUrlParams(),{}),...l(()=>this.getCookieFields(),{})},t={};for(let[i,r]of Object.entries(e))if(Gu.has(i)&&typeof r=="string"){let a=Number(r);t[i]=isNaN(a)?r:a}else t[i]=r;if(t.ofrgp_id&&!t.sp_offerGroupId){let i=Number(t.ofrgp_id);t.sp_offerGroupId=isNaN(i)?t.ofrgp_id:i}return t}static reset(){try{typeof sessionStorage!="undefined"&&sessionStorage.removeItem(Tr)}catch(e){o.warn("[JourneyContext] reset() failed:",e)}}static getUrlParams(){let e=this.parseCurrentUrl();return Object.keys(e).length>0&&this.writeSession(e),{...e,...this.readSession()}}static getCookieFields(){let e={};for(let[t,i]of Yu){let r=D.get(t);r&&(e[i]=r)}return e}static parseCurrentUrl(){try{if(typeof window=="undefined"||typeof window.location=="undefined")return{};let e=new URLSearchParams(window.location.search),t={};return e.forEach((i,r)=>{let a=r.toLowerCase();if(!a.startsWith(kr)&&!qu.has(a)||!i||i.length>Wu||Object.keys(t).length>=Qu)return;let s=r,c=a.startsWith(kr)?a.slice(kr.length):a;qi[c]?s=qi[c]:qi[a]&&(s=qi[a]),t[s]=i}),t}catch{return{}}}static writeSession(e){try{if(typeof sessionStorage=="undefined")return;let t=this.readSession(),i=this.isNewJourney(t,e)?{}:t;sessionStorage.setItem(Tr,JSON.stringify({...i,...e}))}catch(t){o.warn("[JourneyContext] Failed to write session journey context:",t)}}static readSession(){try{if(typeof sessionStorage=="undefined")return{};let e=sessionStorage.getItem(Tr);if(!e)return{};let t=JSON.parse(e);return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{}}catch{return{}}}static isNewJourney(e,t){let i=new Map;for(let[r,a]of Object.entries(e)){let s=r.toLowerCase();Cs.has(s)&&i.set(s,a)}for(let[r,a]of Object.entries(t)){let s=r.toLowerCase();if(!Cs.has(s))continue;let c=i.get(s);if(c!==void 0&&c!==a)return!0}return!1}}});var Rr={};O(Rr,{CustomEventPayload:()=>zt});var Pr,Ju,Xu,_s,zt,Wi=p(()=>{"use strict";S();y();h();ws();pi();Yt();vr();yr();Pr=new Set(["event_id","event_name","event_time_epoc","platform_name","platform_type","device_id","session_id","organisation_id","organisation_name","publication_id","publication_name","bot_suspected","agent_suspected","event_creation_date","event_create_year","event_create_month","event_create_date","page_view_uuid","page_class","page_class_source","page_class_signals"]),Ju=new Set(Object.keys(Re).filter(n=>n!=="page_title"&&n!=="additional_info")),Xu=new Set([...Object.keys(Di),...Object.keys(Re),...Object.keys(Li)]),_s="src_",zt=class{static withoutRe
1servedKeys(e,t){let i={},r=[];for(let[a,s]of Object.entries(e)){if(Pr.has(a)){r.push(a);continue}i[a]=s}return r.length>0&&o.warn(`[CustomEventPayload] ${t} cannot set reserved fields; ignoring:`,r),i}static namespaceAutoTrackedKeys(e){return this.namespaceCollidingKeys(e,"auto-tracked payload")}static namespaceCollidingKeys(e,t){let i={},r=[];for(let[a,s]of Object.entries(e)){if(Xu.has(a)||Pr.has(a)){i[`${_s}${a}`]=s,r.push(a);continue}i[a]=s}return r.length>0&&o.warn(`[CustomEventPayload] ${t} cannot set schema fields; namespaced under "${_s}":`,r),i}static journeyFields(){return l(()=>this.namespaceCollidingKeys(Gi.getContext(),"journey context"),{})}static engageFields(){return l(()=>this.namespaceCollidingKeys(ve.getContext(),"engage context"),{})}static withCommonProperties(e){let t=this.withoutReservedKeys(e||{},"track() properties"),i={...this.engageFields(),...this.journeyFields()},r=l(()=>f.getCustomEventCommonDetails(),{}),s={...Object.keys(r).length===0?{}:this.withoutReservedKeys(r,"customEvents.commonDetailsMapping"),...t};for(let[c,u]of Object.entries(i)){let d=s[c];(d==null||d==="")&&(s[c]=u)}return s}static stripArticleFields(e){return l(()=>{let t=Object.keys(e).filter(r=>Ju.has(r));if(t.length===0)return e;let i={...e};for(let r of t)delete i[r];return i},e)}static applyExclusions(e){return l(()=>{let t=f.getCustomEventExcludeKeys();if(t.length===0)return e;let i=t.filter(a=>Pr.has(a)?(o.warn(`[CustomEventPayload] customEvents.excludeKeys cannot remove "${a}" (the pipeline needs it to file the row); ignoring`),!1):!0);if(i.length===0)return e;let r={...e};for(let a of i)delete r[a];if(typeof r.additional_info=="string"&&r.additional_info){let a=null;try{let s=JSON.parse(r.additional_info);a=s&&typeof s=="object"&&!Array.isArray(s)?s:null}catch{a=null}if(a){let s=!1;for(let c of i)c in a&&(delete a[c],s=!0);s&&(r.additional_info=JSON.stringify(a))}}return o.info("[CustomEventPayload] Excluded keys from custom event payload:",i),r},e)}}});var W,Qi=p(()=>{"use strict";S();y();Oe();h();Me();W=class{static subscribe(e,t={}){return typeof window=="undefined"||typeof history=="undefined"?(o.warn("[SPANavigationDetector] Not available in this environment"),()=>{}):(t.trackHashChanges&&!this.config.trackHashChanges&&(this.config.trackHashChanges=!0,this.isInitialized&&this.setupHashChangeListener()),this.ensureInstalled(),this.subscribers.add(e),o.info(`[SPANavigationDetector] Subscriber added (total: ${this.subscribers.size})`),()=>{this.subscribers.delete(e)})}static initialize(e,t={}){this.subscribe(e,t)}static ensureInstalled(){this.isInitialized||(this.lastUrl=window.location.href,this.wrapPushState(),this.wrapReplaceState(),this.setupPopStateListener(),this.config.trackHashChanges&&this.setupHashChangeListener(),this.isInitialized=!0,o.info("[SPANavigationDetector] Installed with config:",this.config))}static wrapPushState(){this.originalPushState=history.pushState,history.pushState=(e,t,i)=>{this.originalPushState.call(history,e,t,i),this.hasUrlChanged()&&this.handleNavigation("pushState")},o.info("[SPANavigationDetector] Wrapped history.pushState")}static wrapReplaceState(){this.originalReplaceState=history.replaceState,history.replaceState=(e,t,i)=>{this.originalReplaceState.call(history,e,t,i),this.hasUrlChanged()&&(f.getSpaNavigationConfig().treatReplaceStateAsNavigation?this.handleNavigation("replaceState"):this.handleUrlCorrection())},o.info("[SPANavigationDetector] Wrapped history.replaceState")}static handleUrlCorrection(){if(typeof window=="undefined")return;let e=window.location.href,t=this.lastUrl;this.lastUrl=e,o.info("[SPANavigationDetector] replaceState treated as URL correction, not navigation:",{from:t,to:e}),l(()=>{J.correctCurrentUrl(e)},void 0)}static setupPopStateListener(){this.popstateListener=ee(e=>{this.handlePopState(e)},"SPANavigationDetector.popstate"),window.addEventListener("popstate",this.popstateListener),o.info("[SPANavigationDetector] Set up popstate listener")}static handlePopState(e){o.info("[SPANavigationDetector] Popstate event fired"),this.hasUrlChanged()&&this.handleNavigation("popstate")}static setupHashChangeListener(){this.hashchangeListener||(this.hashchangeListener=ee(e=>{this.handleHashChange(e)},"SPANavigationDetector.hashchange"),window.addEventListener("hashchange",this.hashchangeListener),o.info("[SPANavigationDetector] Set up hashchange listener"))}static handleHashChange(e){o.info("[SPANavigationDetector] Hashc
1hange event fired"),this.hasUrlChanged()&&this.handleNavigation("hashchange")}static hasUrlChanged(){return typeof window=="undefined"?!1:window.location.href!==this.lastUrl}static handleNavigation(e){if(typeof window=="undefined")return;let t=window.location.href,i=this.lastUrl;o.info("[SPANavigationDetector] Navigation detected:",{method:e,from:i,to:t});let r={from:i,to:t,timestamp:Date.now(),method:e};this.lastUrl=t,this.subscribers.forEach(a=>{try{a(r)}catch(s){o.error("[SPANavigationDetector] Error in navigation callback:",s)}})}static cleanup(){this.isInitialized&&(o.info("[SPANavigationDetector] Cleaning up"),this.originalPushState&&(history.pushState=this.originalPushState),this.originalReplaceState&&(history.replaceState=this.originalReplaceState),this.popstateListener&&(window.removeEventListener("popstate",this.popstateListener),this.popstateListener=null),this.hashchangeListener&&(window.removeEventListener("hashchange",this.hashchangeListener),this.hashchangeListener=null),this.subscribers.clear(),this.lastUrl="",this.isInitialized=!1,o.info("[SPANavigationDetector] Cleanup complete"))}static getCurrentUrl(){return typeof window!="undefined"?window.location.href:""}static getIsInitialized(){return this.isInitialized}};W.lastUrl="",W.subscribers=new Set,W.config={trackHashChanges:!1},W.isInitialized=!1,W.popstateListener=null,W.hashchangeListener=null});var fe,Yi=p(()=>{"use strict";y();Oe();fe=class{static subscribe(e){return typeof window=="undefined"?(o.warn("[BfcacheRestoreDetector] Not available in this environment"),()=>{}):(this.ensureInstalled(),this.subscribers.add(e),o.info(`[BfcacheRestoreDetector] Subscriber added (total: ${this.subscribers.size})`),()=>{this.subscribers.delete(e)})}static ensureInstalled(){this.isInitialized||(this.pageshowListener=ee(e=>{this.handlePageShow(e)},"BfcacheRestoreDetector.pageshow"),window.addEventListener("pageshow",this.pageshowListener),this.isInitialized=!0,o.info("[BfcacheRestoreDetector] Set up pageshow listener"))}static handlePageShow(e){e.persisted&&(o.info("[BfcacheRestoreDetector] Page restored from bfcache, notifying subscribers:",this.subscribers.size),this.subscribers.forEach(t=>{try{t()}catch(i){o.error("[BfcacheRestoreDetector] Error in bfcache restore callback:",i)}}))}static cleanup(){this.isInitialized&&(o.info("[BfcacheRestoreDetector] Cleaning up"),this.pageshowListener&&(window.removeEventListener("pageshow",this.pageshowListener),this.pageshowListener=null),this.subscribers.clear(),this.isInitialized=!1,o.info("[BfcacheRestoreDetector] Cleanup complete"))}static getIsInitialized(){return this.isInitialized}static getSubscriberCount(){return this.subscribers.size}};fe.subscribers=new Set,fe.isInitialized=!1,fe.pageshowListener=null});var Es={};O(Es,{PageLeaveCoordinator:()=>ae});var ae,Ss=p(()=>{"use strict";y();Vt();Qi();Yi();Fi();h();k();St();Oe();ae=class{static initialize(e){if(this.isInitialized){o.info("[PageLeaveCoordinator] Already initialized");return}if(typeof window=="undefined"){o.warn("[PageLeaveCoordinator] Not available in this environment");return}this.config={...this.config,...e},o.info("[PageLeaveCoordinator] Initializing with config:",this.config),this.state.lastUrl=window.location.href,this.config.enableVisibilityTracking&&I.initialize({hiddenPageTimeout:this.config.hiddenPageTimeout}),this.config.enableSPATracking&&(this.spaUnsubscribe=W.subscribe(t=>this.handleSPANavigation(t),{trackHashChanges:this.config.trackHashChanges})),this.setupEventListeners(),this.isInitialized=!0,o.info("[PageLeaveCoordinator] Initialization complete")}static setupEventListeners(){this.beforeUnloadListener=ee(e=>{this.handleBeforeUnload(e)},"PageLeaveCoordinator.beforeunload"),window.addEventListener("beforeunload",this.beforeUnloadListener),o.info("[PageLeaveCoordinator] Set up beforeunload listener"),this.pageHideListener=ee(e=>{this.handlePageHide(e)},"PageLeaveCoordinator.pagehide"),window.addEventListener("pagehide",this.pageHideListener),o.info("[PageLeaveCoordinator] Set up pagehide listener"),this.bfcacheUnsubscribe=fe.subscribe(()=>{this.handleBfcacheRestore()}),o.info("[PageLeaveCoordinator] Subscribed to bfcache restores"),this.config.enableVisibilityTracking&&(this.visibilityChangeListener=ee(e=>{this.handleVisibilityChange()},"PageLeaveCoordinator.visibilitychange"),document.addEventListener("visibilitychange",this.visibilityChangeListener),o.info("[PageLeaveCoordinator] Set up visibilitychange listener"))}static handleBeforeUnload(e){o.info("[PageLeaveCoordinator] beforeunload event fired");let t={type:"navigation",timestamp:Date.now()};this.triggerPageLeave(t,"beforeunload")}static handlePageHide(e){o.info("[PageLeaveCoordinator] pagehide event fired, persisted:",e.persisted);let t="browser_close";this.config.enableVisibilityTracking&&typeof document!="undefined"&&document.visibilityState==="hidden"&&(t="tab_switch");let i={type:t,timestamp:Date.now()};this.triggerPageLeave(i,"pagehide")}static handleBfcacheRestore(){o.info("[PageLeaveCoordinator] Page restored from bfcache, resetting state"),this.reset(),He.resetForNewView(),this.state.isRestoredFromCac
1he=!0,(async()=>{try{let[e,t]=await Promise.all([Promise.resolve().then(()=>(Me(),Xn)),Promise.resolve().then(()=>(Oi(),Ui))]);e.PageViewContext.rotateForRestore(),t.PageViewTracker.reset(),await t.PageViewTracker.track()}catch(e){o.error("[PageLeaveCoordinator] Failed to rotate page view on bfcache restore:",e)}})()}static handleVisibilityChange(){typeof document!="undefined"&&(o.info("[PageLeaveCoordinator] visibilitychange event fired, state:",document.visibilityState),this.config.enableVisibilityTracking&&I.handleVisibilityChange(()=>{o.info("[PageLeaveCoordinator] Hidden timeout reached");let e={type:"timeout",timestamp:Date.now()};this.triggerPageLeave(e,"visibilitychange-timeout")}),document.visibilityState==="hidden"?o.info("[PageLeaveCoordinator] Page hidden, waiting for navigation events or timeout"):o.info("[PageLeaveCoordinator] Page visible again"))}static async handleSPANavigation(e){o.info("[PageLeaveCoordinator] SPA navigation detected:",e);let t={type:"spa_navigation",timestamp:e.timestamp,destinationUrl:e.to};if(this.shouldSendPageLeave("spa_navigation")){this.currentExitReason=t,this.markAsLeft();try{await He.track(t)}catch(i){o.error("[PageLeaveCoordinator] SPA leave failed:",i)}}this.reset(),He.resetForNewView(),this.state.lastUrl=e.to;try{let[i,r]=await Promise.all([Promise.resolve().then(()=>(Me(),Xn)),Promise.resolve().then(()=>(Oi(),Ui))]);i.PageViewContext.recordPageView(e.to),r.PageViewTracker.reset(),await r.PageViewTracker.track()}catch(i){o.error("[PageLeaveCoordinator] Failed to rotate page view on SPA nav:",i)}}static shouldProcessEvent(e){if(this.state.eventsFired.add(e),se.isIOSSafari()){if(this.state.eventsFired.has("pagehide")){let t=e==="pagehide";return t||o.info(`[PageLeaveCoordinator] iOS Safari: Ignoring ${e}, pagehide already fired`),t}return!0}if(se.isDesktop()){if(this.state.eventsFired.has("visibilitychange-timeout")){let t=e==="visibilitychange-timeout";return t||o.info(`[PageLeaveCoordinator] Desktop: Ignoring ${e}, visibility timeout already fired`),t}return!0}return!0}static shouldSendPageLeave(e){return this.shouldProcessEvent(e)?this.state.hasLeft?(o.info("[PageLeaveCoordinator] Event already sent for this session"),!1):this.state.leaveEventSentAt!==null&&Date.now()-this.state.leaveEventSentAt<100?(o.info("[PageLeaveCoordinator] Within debounce window, skipping"),!1):!0:!1}static markAsLeft(){this.state.hasLeft=!0,this.state.leaveEventSentAt=Date.now(),o.info("[PageLeaveCoordinator] Marked session as left")}static getExitReason(){return this.currentExitReason}static reset(){o.info("[PageLeaveCoordinator] Resetting state"),this.state.hasLeft=!1,this.state.leaveEventSentAt=null,this.state.isRestoredFromCache=!1,this.state.eventsFired.clear(),this.currentExitReason=null,this.config.enableVisibilityTracking&&I.reset()}static triggerPageLeave(e,t){C(async()=>{this.shouldSendPageLeave(t)&&(o.info("[PageLeaveCoordinator] Triggering page leave event, reason:",e.type,"event:",t),this.currentExitReason=e,this.markAsLeft(),await He.track(e),o.info("[PageLeaveCoordinator] Page leave event sent successfully"))},{message:"Failed to trigger page leave event",severity:"medium",source:"PageLeaveCoordinator.triggerPageLeave",eventName:"page_leave"})}static cleanup(){this.isInitialized&&(o.info("[PageLeaveCoordinator] Cleaning up"),this.beforeUnloadListener&&(window.removeEventListener("beforeunload",this.beforeUnloadListener),this.beforeUnloadListener=null),this.pageHideListener&&(window.removeEventListener("pagehide",this.pageHideListener),this.pageHideListener=null),this.visibilityChangeListener&&(document.removeEventListener("visibilitychange",this.visibilityChangeListener),this.visibilityChangeListener=null),this.spaUnsubscribe&&(this.spaUnsubscribe(),this.spaUnsubscribe=null),this.bfcacheUnsubscribe&&(this.bfcacheUnsubscribe(),this.bfcacheUnsubscribe=null),this.reset(),this.isInitialized=!1,o.info("[PageLeaveCoordinator] Cleanup complete"))}static getState(){return{...this.state}}static getIsInitialized(){return this.isInitialized}};ae.state={hasLeft:!1,leaveEventSentAt:null,currentSessionId:"",lastUrl:typeof window!="undefined"?window.location.href:"",isRestoredFromCac
1he:!1,eventsFired:new Set},ae.config={hiddenPageTimeout:3e4,enableSPATracking:!1,enableVisibilityTracking:!0,trackHashChanges:!1},ae.isInitialized=!1,ae.currentExitReason=null,ae.beforeUnloadListener=null,ae.pageHideListener=null,ae.visibilityChangeListener=null,ae.spaUnsubscribe=null,ae.bfcacheUnsubscribe=null});function Be(){return typeof performance!="undefined"&&performance.now?performance.now():(As||(o.info("performance.now() not available, using Date.now() fallback for time calculations"),As=!0),Date.now())}var As,R,xr=p(()=>{"use strict";Vt();Oe();y();Bi();As=!1;R=class{static initialize(){if(this.isInitialized||typeof window=="undefined")return;this.state.pageStartTime=Be(),this.state.lastActiveTime=Be(),I.getState().isVisible||(this.state.isActive=!1),this.setupActivityListeners(),this.setupScrollDepthTracking(),this.setupActiveTimeTracking(),this.isInitialized=!0}static setupActivityListeners(){this.scrollListener=de(()=>{this.state.hasScrolled=!0},"EngagementMetrics.onScroll"),window.addEventListener("scroll",this.scrollListener,{passive:!0}),this.clickListener=de(()=>{this.state.hasClicked=!0},"EngagementMetrics.onClick"),window.addEventListener("click",this.clickListener,{passive:!0}),this.mousedownListener=de(()=>{this.state.hasClicked=!0},"EngagementMetrics.onMousedown"),window.addEventListener("mousedown",this.mousedownListener,{passive:!0}),this.keydownListener=de(()=>{this.state.hasTyped=!0},"EngagementMetrics.onKeydown"),window.addEventListener("keydown",this.keydownListener,{passive:!0})}static setupScrollDepthTracking(){this.scrollDepthListener=de(()=>{let e=Hi();e>this.state.maxScrollDepth&&(this.state.maxScrollDepth=e)},"EngagementMetrics.updateScrollDepth"),window.addEventListener("scroll",this.scrollDepthListener,{passive:!0}),this.scrollDepthListener(new Event("scroll"))}static setupActiveTimeTracking(){let t=de(()=>{this.resumeActiveTimer(),this.state.inactivityTimeout&&clearTimeout(this.state.inactivityTimeout),this.state.inactivityTimeout=setTimeout(()=>{this.pauseActiveTimer()},5e3)},"EngagementMetrics.onUserActivity");["scroll","mousemove","keydown","mousedown","touchstart"].forEach(r=>{let a=t;window.addEventListener(r,a,{passive:!0}),this.activityListeners.push({event:r,listener:a})}),t()}static pauseActiveTimer(){this.state.isActive&&(this.state.accumulatedActiveTime+=Be()-this.state.lastActiveTime,this.state.isActive=!1)}static resumeActiveTimer(){this.state.isActive||(this.state.lastActiveTime=Be(),this.state.isActive=!0)}static peekActiveTimeSeconds(){try{return this.isInitialized?this.getActiveTimeSeconds():0}catch{return 0}}static getActiveTimeSeconds(){let e=this.state.accumulatedActiveTime;return this.state.isActive&&(e+=Be()-this.state.lastActiveTime),Math.round(e/1e3)}static getTotalTimeSeconds(){let e=Be()-this.state.pageStartTime;return Math.round(e/1e3)}static getScrollDepthPercent(){return this.state.maxScrollDepth}static getTotalHiddenTimeSeconds(){return I.getTotalHiddenTimeSeconds()}static getVisibilityChangesCount(){return this.state.visibilityChangesCount}static isVisible(){return I.getState().isVisible}static calculateIntervalMetrics(e,t,i){let r=Math.max(0,e-this.state.previousActiveTime),a=Math.max(0,t-this.state.previousTotalTime),s=Math.max(0,i-this.state.previousHiddenTime);return{active:r,total:a,hidden:s}}static resetActivitySignals(){this.state.hasScrolled=!1,this.state.hasClicked=!1,this.state.hasTyped=!1}static getSnapshot(){try{this.isInitialized||this.initialize();let e=this.getActiveTimeSeconds(),t=this.getTotalTimeSeconds(),i=this.getScrollDepthPercent(),r=this.getTotalHiddenTimeSeconds(),a=this.getVisibilityChangesCount(),s=this.isVisible(),c=this.calculateIntervalMetrics(e,t,r),u=this.state.hasScrolled,d=this.state.hasClicked,g=this.state.hasTyped,m={time_spent_seconds:e,total_time_seconds:t,scroll_depth_percent:i,total_hidden_time_seconds:r,visibility_changes_count:a,is_visible:s,interval_active_seconds:c.active,interval_total_seconds:c.total,interval_hidden_seconds:c.hidden,has_scrolled:u,has_clicked:d,has_typed:g};return this.state.previousActiveTime=e,this.state.previousTotalTime=t,this.state.previousHiddenTime=r,this.resetActivitySignals(),m}catch(e){throw new Error(`Failed to generate engagement snapshot: ${e instanceof Error?e.message:String(e)}`)}}static incrementVisibilityChanges(){this.state.visibilityChangesCount++}static pause(){this.pauseActiveTimer(),this.state.inactivityTimeout&&(clearTimeout(this.state.inactivityTimeout),this.state.inactivityTimeout=null)}static resume(){this.resumeActiveTimer(),this.state.inactivityTimeout&&clearTimeout(this.state.inactivityTimeout),this.state.inactivityTimeout=setTimeout(()=>{this.pauseActiveTimer()},5e3)}static reset(){this.state.inactivityTimeout&&clearTimeout(this.state.inactivityTimeout);let e=0;try{e=I.getTotalHiddenTimeSeconds()}catch{e=0}this.state={hasScrolled:!1,hasClicked:!1,hasTyped:!1,previousActiveTime:0,previousTotalTime:0,previousHiddenTime:e,visibilityChangesCount:0,accumulatedActiveTime:0,lastActiveTime:Be(),isActive:!0,inactivityTimeout:null,maxScrollDepth:0,pageStartTime:Be()},this.isInitialized&&(this.removeActivityListeners(),this.setupActiveTimeTracking())}static removeActivityListeners(){typeof window!="undefined"&&(this.activityListeners.forEac
1h(({event:e,listener:t})=>{window.removeEventListener(e,t)}),this.activityListeners=[])}static cleanup(){typeof window!="undefined"&&(this.state.inactivityTimeout&&(clearTimeout(this.state.inactivityTimeout),this.state.inactivityTimeout=null),this.scrollListener&&(window.removeEventListener("scroll",this.scrollListener),this.scrollListener=null),this.clickListener&&(window.removeEventListener("click",this.clickListener),this.clickListener=null),this.mousedownListener&&(window.removeEventListener("mousedown",this.mousedownListener),this.mousedownListener=null),this.keydownListener&&(window.removeEventListener("keydown",this.keydownListener),this.keydownListener=null),this.scrollDepthListener&&(window.removeEventListener("scroll",this.scrollDepthListener),this.scrollDepthListener=null),this.removeActivityListeners(),this.isInitialized=!1)}};R.isInitialized=!1,R.state={hasScrolled:!1,hasClicked:!1,hasTyped:!1,previousActiveTime:0,previousTotalTime:0,previousHiddenTime:0,visibilityChangesCount:0,accumulatedActiveTime:0,lastActiveTime:0,isActive:!0,inactivityTimeout:null,maxScrollDepth:0,pageStartTime:0},R.scrollListener=null,R.clickListener=null,R.mousedownListener=null,R.keydownListener=null,R.activityListeners=[],R.scrollDepthListener=null});function Ts(){return typeof performance!="undefined"&&performance.now?performance.now():(ks||(o.info("performance.now() not available, using Date.now() fallback for elapsed-time calculations"),ks=!0),Date.now())}var ks,B,Ir=p(()=>{"use strict";y();Et();ks=!1;B=class{static generateNewSession(){return this.currentPageSessionId=xe(),this.pageLoadTime=Math.floor(Date.now()/1e3),this.elapsedBaseline=Ts(),this.currentPageSessionId}static getCurrentPageSessionId(){return this.currentPageSessionId?this.currentPageSessionId:this.generateNewSession()}static getPageLoadTimeEpoc(){return this.pageLoadTime}static getTimeSincePageLoad(){if(this.pageLoadTime===0)return 0;let e=Ts()-this.elapsedBaseline;return Math.max(0,Math.floor(e/1e3))}static reset(){this.currentPageSessionId=null,this.pageLoadTime=0,this.elapsedBaseline=0}};B.currentPageSessionId=null,B.pageLoadTime=0,B.elapsedBaseline=0});var L,Ps=p(()=>{"use strict";xr();Ir();le();Ke();y();bi();L=class{static initialize(e){if(this.isInitialized){o.warn("[HeartbeatPingTracker] Already initialized");return}if(typeof window=="undefined"){o.warn("[HeartbeatPingTracker] Not in browser environment");return}this.config=this.validateConfig(e||{}),o.info("[HeartbeatPingTracker] Initialized with config:",this.config),this.isInitialized=!0}static validateConfig(e){let t={enabled:e.enabled!==void 0?e.enabled:!0,firstPingDelaySeconds:2,pingIntervalSeconds:15,minEngagementThreshold:2,sendOnVisibilityChange:e.sendOnVisibilityChange!==void 0?e.sendOnVisibilityChange:!0,minActiveTimeForVisibilityPing:e.minActiveTimeForVisibilityPing!==void 0?e.minActiveTimeForVisibilityPing:3,visibilityDebounceMs:e.visibilityDebounceMs!==void 0?e.visibilityDebounceMs:1e3,sendClosingPing:e.sendClosingPing!==void 0?e.sendClosingPing:!0,minActiveTimeForClosingPing:e.minActiveTimeForClosingPing!==void 0?e.minActiveTimeForClosingPing:2,pingDecaySchedule:Array.isArray(e.pingDecaySchedule)?e.pingDecaySchedule:[],pingSamplingRate:e.pingSamplingRate!==void 0&&Number.isFinite(e.pingSamplingRate)&&e.pingSamplingRate>=0&&e.pingSamplingRate<=1?e.pingSamplingRate:1};return e.firstPingDelaySeconds!==void 0&&(e.firstPingDelaySeconds<2||e.firstPingDelaySeconds>60?(o.warn(`[HeartbeatPingTracker] Invalid first ping delay: ${e.firstPingDelaySeconds}. Must be between 2 and 60 seconds. Using default: 2`),t.firstPingDelaySeconds=2):t.firstPingDelaySeconds=e.firstPingDelaySeconds),e.pingIntervalSeconds!==void 0&&(e.pingIntervalSeconds<5||e.pingIntervalSeconds>60?(o.warn(`[HeartbeatPingTracker] Invalid ping interval: ${e.pingIntervalSeconds}. Must be between 5 and 60 seconds. Using default: 15`),t.pingIntervalSeconds=15):t.pingIntervalSeconds=e.pingIntervalSeconds),e.minEngagementThreshold!==void 0&&(e.minEngagementThreshold<0||e.minEngagementThreshold>60?(o.warn(`[HeartbeatPingTracker] Invalid min engagement threshold: ${e.minEngagementThreshold}. Must be between 0 and 60 seconds. Using default: 2`),t.minEngagementThreshold=2):t.minEngagementThreshold=e.minEngagementThreshold),e.minActiveTimeForClosingPing!==void 0&&(e.minActiveTimeForClosingPing<0||e.minActiveTimeForClosingPing>60?(o.warn(`[HeartbeatPingTracker] Invalid min active time for closing ping: ${e.minActiveTimeForClosingPing}. Must be between 0 and 60 seconds. Using default: 2`),t.minActiveTimeForClosingPing=2):t.minActiveTimeForClosingPing=e.minActiveTimeForClosingPing),t}
1static start(){if(!this.isInitialized){o.error("[HeartbeatPingTracker] Cannot start: not initialized");return}if(!this.config.enabled){o.info("[HeartbeatPingTracker] Heartbeat disabled in config");return}if(this.state.isRunning){o.warn("[HeartbeatPingTracker] Already running");return}if(this.state.sampledOut=this.config.pingSamplingRate<1&&Math.random()>=this.config.pingSamplingRate,this.state.sampledOut){o.info(`[HeartbeatPingTracker] Page session sampled out of pings (rate: ${this.config.pingSamplingRate})`);return}this.state.isRunning=!0;let e=this.config.firstPingDelaySeconds*1e3;this.state.firstPingTimerId=setTimeout(()=>{this.sendFirstPing().catch(t=>{o.error("[HeartbeatPingTracker] Error in first ping callback:",t)})},e),o.info(`[HeartbeatPingTracker] Started - First ping in ${this.config.firstPingDelaySeconds}s, then every ${this.config.pingIntervalSeconds}s`)}static async sendFirstPing(){try{if(this.state.pageLeaveInitiated){o.log("[HeartbeatPingTracker] Skipping first ping - page leave initiated"),this.startRegularInterval();return}let e=R.peekActiveTimeSeconds();e>=this.config.minEngagementThreshold?(await this.sendPing("timer"),this.state.firstPingSent=!0,o.info(`[HeartbeatPingTracker] First ping sent (time spent: ${e}s >= threshold: ${this.config.minEngagementThreshold}s)`)):o.log(`[HeartbeatPingTracker] First ping skipped (time spent: ${e}s < threshold: ${this.config.minEngagementThreshold}s)`),this.startRegularInterval()}catch(e){o.error("[HeartbeatPingTracker] Error in sendFirstPing:",e),this.startRegularInterval()}}static currentIntervalSeconds(){let e=this.config.pingDecaySchedule,t=this.config.pingIntervalSeconds;if(e&&e.length>0){let i=B.getTimeSincePageLoad();for(let r of e)if(i>=r.afterSeconds)t=r.intervalSeconds;else break}return t}static startRegularInterval(){this.state.isRunning&&(this.state.timerId&&(clearTimeout(this.state.timerId),this.state.timerId=null),this.scheduleNextPing(),this.state.lastPingTime=Date.now(),o.log(`[HeartbeatPingTracker] Regular pings started (${this.currentIntervalSeconds()}s)`))}static scheduleNextPing(){if(!this.state.isRunning)return;let e=this.currentIntervalSeconds()*1e3;this.state.timerId=setTimeout(()=>{if(this.state.pageLeaveInitiated){o.log("[HeartbeatPingTracker] Skipping timer ping - page leave initiated"),this.scheduleNextPing();return}this.sendPing("timer").catch(t=>{o.error("[HeartbeatPingTracker] Error in timer callback:",t)}).finally(()=>{this.scheduleNextPing()})},e)}static stop(){this.state.isRunning&&(this.state.firstPingTimerId&&(clearTimeout(this.state.firstPingTimerId),this.state.firstPingTimerId=null),this.state.timerId&&(clearTimeout(this.state.timerId),this.state.timerId=null),this.state.isRunning=!1,o.info("[HeartbeatPingTracker] Stopped"))}static pause(){this.state.isRunning&&(this.state.firstPingTimerId&&(clearTimeout(this.state.firstPingTimerId),this.state.firstPingTimerId=null),this.state.timerId&&(clearTimeout(this.state.timerId),this.state.timerId=null),o.log("[HeartbeatPingTracker] Paused"))}static resume(){if(!(!this.isInitialized||!this.config.enabled)&&this.state.isRunning)if(this.state.firstPingTimerId&&(clearTimeout(this.state.firstPingTimerId),this.state.firstPingTimerId=null),this.state.timerId&&(clearTimeout(this.state.timerId),this.state.timerId=null),this.state.firstPingSent)this.scheduleNextPing(),o.log("[HeartbeatPingTracker] Resumed - regular pings");else{let e=this.config.firstPingDelaySeconds*1e3;this.state.firstPingTimerId=setTimeout(()=>{this.sendFirstPing().catch(t=>{o.error("[HeartbeatPingTracker] Error in first ping callback:",t)})},e),o.log("[HeartbeatPingTracker] Resumed - rescheduling first ping")}}static handleVisibilityChange(){if(!(!this.isInitialized||!this.config.enabled)){if(this.state.pageLeaveInitiated){o.log("[HeartbeatPingTracker] Skipping visibility change ping - page leave initiated");return}this.state.sampledOut||this.config.sendOnVisibilityChange&&this.shouldSendVisibilityPing()&&(this.state.lastVisibilityChangeTime=Date.now(),this.sendPing("visibility_change").catch(e=>{o.error("[HeartbeatPingTracker] Error sending visibility change ping:",e)}))}}
1static shouldSendVisibilityPing(){return Date.now()-this.state.lastVisibilityChangeTime<this.config.visibilityDebounceMs?(o.log("[HeartbeatPingTracker] Visibility change debounced"),!1):R.peekActiveTimeSeconds()<this.config.minActiveTimeForVisibilityPing?(o.log("[HeartbeatPingTracker] Time spent below minimum threshold for visibility ping"),!1):!0}static async sendPing(e){try{if(this.state.pageLeaveInitiated&&e!=="page_leave"){o.log(`[HeartbeatPingTracker] Skipping ${e} ping - page leave initiated`);return}e!=="page_leave"&&this.state.pingSequence++,o.log(`[HeartbeatPingTracker] Sending ping #${this.state.pingSequence} (${e})`);let t;try{t=R.getSnapshot()}catch(g){o.error("[HeartbeatPingTracker] Failed to get engagement snapshot:",g),t={time_spent_seconds:0,total_time_seconds:0,scroll_depth_percent:0,total_hidden_time_seconds:0,visibility_changes_count:0,is_visible:!0,interval_active_seconds:0,interval_total_seconds:0,interval_hidden_seconds:0,has_scrolled:!1,has_clicked:!1,has_typed:!1}}(t.interval_active_seconds>0||t.has_scrolled||t.has_clicked||t.has_typed)&&Le.touchSession();let i,r,a;try{i=B.getCurrentPageSessionId(),r=B.getPageLoadTimeEpoc(),a=B.getTimeSincePageLoad()}catch(g){o.error("[HeartbeatPingTracker] Failed to get page session data:",g);return}let s={page_session_id:i,ping_sequence:this.state.pingSequence,ping_type:e,ping_interval_seconds:this.currentIntervalSeconds(),ping_sample_rate:this.config.pingSamplingRate,time_spent_seconds:t.time_spent_seconds,total_time_seconds:t.total_time_seconds,scroll_depth_percent:t.scroll_depth_percent,total_hidden_time_seconds:t.total_hidden_time_seconds,interval_active_seconds:t.interval_active_seconds,interval_total_seconds:t.interval_total_seconds,interval_hidden_seconds:t.interval_hidden_seconds,is_visible:t.is_visible,visibility_changes_count:t.visibility_changes_count,has_scrolled:t.has_scrolled,has_clicked:t.has_clicked,has_typed:t.has_typed,page_load_time_epoc:r,time_since_page_load_seconds:a},c;try{c=await F.createEvent("engagement_ping",s)}catch(g){o.error("[HeartbeatPingTracker] EventFactory threw exception:",g);return}if(!c.success){o.error("[HeartbeatPingTracker] Failed to create event:",c.error);return}let u=c.value;if(u===null){o.log("[HeartbeatPingTracker] Event tracking disabled, skipping ping");return}let d;try{d=await ce.send("/event",u)}catch(g){o.error("[HeartbeatPingTracker] Network transmission threw exception:",g);return}if(!d.success){o.error("[HeartbeatPingTracker] Failed to send ping:",d.error);return}this.state.lastPingTime=Date.now(),o.info(`[HeartbeatPingTracker] Ping #${this.state.pingSequence} sent successfully via ${d.value.method}`)}catch(t){o.error("[HeartbeatPingTracker] Unexpected error sending ping:",t)}}static reset(){this.stop(),this.state={pingSequence:0,isRunning:!1,timerId:null,firstPingTimerId:null,lastVisibilityChangeTime:0,lastPingTime:0,firstPingSent:!1,pageLeaveInitiated:!1,sampledOut:!1},o.log("[HeartbeatPingTracker] Reset")}static cleanup(){this.stop(),this.isInitialized=!1,o.log("[HeartbeatPingTracker] Cleaned up")}static getPingSequence(){return this.state.pingSequence}static getConfig(){return{...this.config}}static isTrackerInitialized(){return this.isInitialized}static isTrackerRunning(){return this.state.isRunning}static async sendClosingPing(){if(!(!this.isInitialized||!this.config.enabled)&&(this.state.pageLeaveInitiated=!0,!this.state.sampledOut)){if(!this.config.sendClosingPing){o.log("[HeartbeatPingTracker] Closing ping disabled in config");return}if(this.shouldSendClosingPing()){o.info("[HeartbeatPingTracker] Sending closing ping before page leave");try{await this.sendPing("page_leave"),o.info("[HeartbeatPingTracker] Page leave engagement ping sent successfully")}catch(e){o.error("[HeartbeatPingTracker] Error sending page leave engagement ping:",e)}}}}static shouldSendClosingPing(){try{return R.peekActiveTimeSeconds()<this.config.minActiveTimeForClosingPing?(o.log("[HeartbeatPingTracker] Time spent below minimum threshold for closing ping"),!1):!0}catch(e){return o.error("[HeartbeatPingTracker] Error checking closing ping conditions:",e),!1}}};L.state={pingSequence:0,isRunning:!1,timerId:null,firstPingTimerId:null,lastVisibilityChangeTime:0,lastPingTime:0,firstPingSent:!1,pageLeaveInitiated:!1,sampledOut:!1},L.config={enabled:!0,firstPingDelaySeconds:2,pingIntervalSeconds:15,minEngagementThreshold:2,sendOnVisibilityChange:!0,minActiveTimeForVisibilityPing:3,visibilityDebounceMs:1e3,sendClosingPing:!0,minActiveTimeForClosingPing:2,pingDecaySchedule:[],pingSamplingRate:1},L.isInitialized=!1});var Rs={};O(Rs,{HeartbeatPingCoordinator:()=>ge});var ge,xs=p(()=>{"use strict";Ps();xr();Ir();Qi();Yi();Vt();y();Oe();ge=class{static initialize(e){if(this.isInitialized){o.info("[HeartbeatPingCoordinator] Already initialized");return}if(typeof window=="undefined"){o.warn("[HeartbeatPingCoordinator] Not available in this environment");return}if(this.config=this.validateConfig(e||{}),!this.config.enabled){o.info("[HeartbeatPingCoordinator] Heartbeat disabled in config");return}o.info("[HeartbeatPingCoordinator] Initializing with config:",this.config),B.generateNewSession(),o.info("[HeartbeatPingCoordinator] PageSessionManager initialized"),R.initialize(),o.info("[HeartbeatPingCoordinator] EngagementMetrics initialized");let t={enabled:this.config.enabled,pingIntervalSeconds:this.config.pingIntervalSeconds,sendOnVisibilityChange:this.config.sendOnVisibilityChange,minActiveTimeForVisibilityPing:this.config.minActiveTimeForVisibilityPing,visibilityDebounceMs:this.config.visibilityDebounceMs,pingDecaySchedule:this.config.pingDecaySchedule,pingSamplingRate:this.config.pingSamplingRate};L.initialize(t),o.info("[HeartbeatPingCoordinator] HeartbeatPingTracker initialized"),this.setupEventListeners(),this.config.enableSPATracking&&this.setupSPATracking(),this.isInitialized=!0,o.info("[HeartbeatPingCoordinator] Initialization complete")}static validateConfig(e){return{enabled:e.enabled!==void 0?e.enabled:!0,pingIntervalSeconds:e.pingIntervalSeconds!==void 0?e.pingIntervalSeconds:15,sendOnVisibilityChange:e.sendOnVisibilityChange!==void 0?e.sendOnVisibilityChange:!0,minActiveTimeForVisibilityPing:e.minActiveTimeForVisibilityPing!==void 0?e.minActiveTimeForVisibilityPing:3,visibilityDebounceMs:e.visibilityDebounceMs!==void 0?e.visibilityDebounceMs:1e3,enableSPATracking:e.enableSPATracking!==void 0?e.enableSPATracking:!1,pingDecaySchedule:Array.isArray(e.pingDecaySchedule)?e.pingDecaySchedule:[],pingSamplingRate:e.pingSamplingRate!==void 0?e.pingSamplingRate:1}}static setupEventListeners(){this.visibilityChangeListener=ee(e=>{this.handleVisibilityChange()},"HeartbeatPingCoordinator.visibilitychange"),document.addEventListener("visibilitychange",this.visibilityChangeListener),o.info("[HeartbeatPingCoordinator] Set up visibilitychange listener"),this.bfcacheUnsubscribe=fe.subscribe(()=>{this.handleBfcacheRestore()}),o.info("[HeartbeatPingCoordinator] Subscribed to bfcache restores"),this.beforeUnloadListener=ee(e=>{this.handlePageLeave()},"HeartbeatPingCoordinator.beforeunload"),window.addEventListener("beforeunload",this.beforeUnloadListener),this.pageHideListener=ee(e=>{this.handlePageLeave()},"HeartbeatPingCoordinator.pagehide"),window.addEventListener("pagehide",this.pageHideListener),o.info("[HeartbeatPingCoordinator] Set up page leave listeners")}static setupSPATracking(){this.spaUnsubscribe=W.subscribe(e=>{this.handleSPANavigation(e)},{trackHashChanges:!1}),o.info("[HeartbeatPingCoordinator] SPA navigation tracking enabled")}static handleVisibilityChange(){o.log("[HeartbeatPingCoordinator] Visibility changed:",document.visibilityState),I.handleVisibilityChange(),R.incrementVisibilityChanges(),document.visibilityState==="hidden"?(o.log("[HeartbeatPingCoordinator] Page hidden"),R.pause(),L.handleVisibilityChange(),L.pause()):(o.log("[HeartbeatPingCoordinator] Page visible"),R.resume(),L.resume())}static handleBfcacheRestore(){o.info("[HeartbeatPingCoordinator] Page restored from bfcache, resetting state"),this.resetForBfcache()}static handleSPANavigation(e){o.info("[HeartbeatPingCoordinator] SPA navigation detected:",e),this.resetForNavigation()}static handlePageLeave(){this.pageLeaveTriggered||(o.info("[HeartbeatPingCoordinator] Page leave detected, stopping heartbeat"),this.pageLeaveTriggered=!0,L.sendClosingPing().catch(e=>{o.error("[HeartbeatPingCoordinator] Error sending closing ping:",e)}),L.stop())}
1static start(){if(!this.isInitialized){o.error("[HeartbeatPingCoordinator] Cannot start: not initialized");return}if(!this.config.enabled){o.info("[HeartbeatPingCoordinator] Heartbeat disabled in config");return}o.info("[HeartbeatPingCoordinator] Starting heartbeat system"),L.start()}static stop(){this.isInitialized&&(o.info("[HeartbeatPingCoordinator] Stopping heartbeat system"),L.stop())}static resetForNavigation(){o.info("[HeartbeatPingCoordinator] Resetting for SPA navigation"),L.stop(),B.reset(),B.generateNewSession(),o.info("[HeartbeatPingCoordinator] New page session ID generated"),R.reset(),o.info("[HeartbeatPingCoordinator] EngagementMetrics reset"),L.reset(),o.info("[HeartbeatPingCoordinator] HeartbeatPingTracker reset"),L.start(),o.info("[HeartbeatPingCoordinator] New ping timer started")}static resetForBfcache(){o.info("[HeartbeatPingCoordinator] Resetting for bfcache restoration"),B.reset(),B.generateNewSession(),o.info("[HeartbeatPingCoordinator] New page session ID generated"),R.reset(),o.info("[HeartbeatPingCoordinator] EngagementMetrics reset"),L.reset(),o.info("[HeartbeatPingCoordinator] HeartbeatPingTracker reset"),this.pageLeaveTriggered=!1,L.start(),o.info("[HeartbeatPingCoordinator] New ping timer started")}static cleanup(){this.isInitialized&&(o.info("[HeartbeatPingCoordinator] Cleaning up"),this.visibilityChangeListener&&(document.removeEventListener("visibilitychange",this.visibilityChangeListener),this.visibilityChangeListener=null),this.beforeUnloadListener&&(window.removeEventListener("beforeunload",this.beforeUnloadListener),this.beforeUnloadListener=null),this.pageHideListener&&(window.removeEventListener("pagehide",this.pageHideListener),this.pageHideListener=null),this.spaUnsubscribe&&(this.spaUnsubscribe(),this.spaUnsubscribe=null),this.bfcacheUnsubscribe&&(this.bfcacheUnsubscribe(),this.bfcacheUnsubscribe=null),L.cleanup(),R.cleanup(),B.reset(),this.isInitialized=!1,this.pageLeaveTriggered=!1,o.info("[HeartbeatPingCoordinator] Cleanup complete"))}static isEnabled(){return this.isInitialized&&this.config.enabled}static getConfig(){return{...this.config}}};ge.config={enabled:!0,pingIntervalSeconds:15,sendOnVisibilityChange:!0,minActiveTimeForVisibilityPing:3,visibilityDebounceMs:1e3,enableSPATracking:!1,pingDecaySchedule:[],pingSamplingRate:1},ge.isInitialized=!1,ge.visibilityChangeListener=null,ge.beforeUnloadListener=null,ge.pageHideListener=null,ge.pageLeaveTriggered=!1,ge.spaUnsubscribe=null,ge.bfcacheUnsubscribe=null});var Kt,Is=p(()=>{"use strict";h();Kt=class{static extract(e){return l(()=>{if(typeof window=="undefined"||!window.location)return null;let i=new URL(window.location.href).searchParams.get(e);return i&&i.length>0?i:null},null)}static stripFromURL(e){l(()=>{if(typeof window=="undefined"||!window.history||!window.location)return;let t=new URL(window.location.href);if(!t.searchParams.has(e))return;t.searchParams.delete(e);let i=t.pathname+(t.search?t.search:"")+(t.hash?t.hash:"");window.history.replaceState(window.history.state,"",i)},void 0)}}});function Zu(){try{localStorage.setItem(Ji,"true")}catch{}}function Ds(){try{localStorage.removeItem(Ji)}catch{}}var Ji,Te,Ls=p(()=>{"use strict";Ji="naviga_ab_admin";Te=class{static onUnauthorised(){Ds()}static clearAdminFlag(){Ds()}static markAdminFlagFromCookie(){Zu()}}});function jt(n){if(!n)return null;let e=n.split(".");if(e.length!==3)return null;try{let t=decodeURIComponent(atob(e[1].replace(/-/g,"+").replace(/_/g,"/")).split("").map(s=>"%"+("00"+s.charCodeAt(0).toString(16)).slice(-2)).join("")),i=JSON.parse(t),r=typeof i.exp=="number"?i.exp:void 0,a=Array.isArray(i.permissions)?i.permissions:void 0;return{exp:r,permissions:a}}catch{return null}}function Ms(n){let e=jt(n);if(!(e!=null&&e.permissions))return!1;let t=e.permissions.find(i=>(i==null?void 0:i.id)===4);return(t==null?void 0:t.write)===!0}var Ns=p(()=>{"use strict"});var We,qt,Us=p(()=>{"use strict";At();S();$t();We="/ab",qt=class{static async get(e,t){return $.get(We+e,this.buildHeaders(t),"bff")}static async post(e,t,i){return $.post(We+e,t,this.buildHeaders(i),"bff")}static async patchExperiment(e,t,i){let r=f.get(),a={org_name:r.organisation_name,publication_name:r.publication_name,...t};return $.patch(`${We}/experiments/${encodeURIComponent(e)}`,a,this.buildHeaders(i),"bff")}static async getExperiments(){let e=this.buildOrgPubQueryString();return $.get(`${We}/experiments${e}`,this.publicHeaders())}static async getTests(){let e=this.buildOrgPubQueryString();return $.get(`${We}/test${e}`,this.publicHeaders())}static async getExperimentMetrics(e,t){let i=this.buildOrgPubQueryString();return $.get(`${We}/experiments/${encodeURIComponent(e)}/metrics${i}`,this.buildHeaders(t),"bff")}static async getConcludedExperiments(e){let t=this.buildOrgPubQueryString();return $.get(`${We}/experiments${t}&status=concluded`,this.buildHeaders(e),"bff")}static buildOrgPubQueryString(){let e=f.getValue("organisation_name"),t=f.getValue("publication_name");return`?org_name=${encodeURIComponent(e||"")}&publication_name=${encodeURIComponent(t||"")}`}static publicHeaders(){}static buildHeaders(e){let t=f.getABConfig().cookieName||"naviga_ab_session",i=e||D.get(t);if(i)return{Authorization:`Bearer ${i}`}}}});var Dr,Lr,Mr,Os,Xi=p(()=>{"use strict";Dr="ab_experiment_view",Lr="ab_experiment_click",Mr="ab_experiment_qualified_click",Os="session"});var td,Ve,Nr=p(()=>{"use strict";h();k();S();Us();y();Xi();td=15e3,Ve=class{static async loadActive(){return C(async()=>{var s,c;let t=((s=f.getABConfig().experimentTTLSeconds)!=null?s:60)*1e3,i=Date.now();if(this.cache&&i-this.cache.at<t)return this.cache.experiments;if(this.failure&&i-this.failure.at<td)throw new Error(this.failure.message);let[r]=await Promise.all([qt.getExperiments()]);if(!r.success)throw this.failure={at:i,message:r.error.message},new Error(r.error.message);let a=Array.isArray((c=r.value)==null?void 0:c.experiments)?r.value.experiments:[];return this.cache={at:i,experiments:a},this.failure=null,o.info(`[AB] Loaded ${a.length} experiments`),a}
1,{message:"Failed to load experiments",severity:"medium",source:"ExperimentLoader.loadActive"})}static invalidate(){this.cache=null,this.failure=null}static async loadConcluded(){return C(async()=>{var i;let e=await qt.getConcludedExperiments();if(!e.success)throw new Error(e.error.message);let t=Array.isArray((i=e.value)==null?void 0:i.experiments)?e.value.experiments:[];return o.info(`[AB] Loaded ${t.length} concluded experiments`),t},{message:"Failed to load concluded experiments",severity:"low",source:"ExperimentLoader.loadConcluded"})}};Ve.cache=null,Ve.failure=null});var Zi,Fs=p(()=>{"use strict";h();S();Zi=class{static match(e){return l(()=>{var u,d;if(typeof document=="undefined"||!e||e.length===0)return[];let t=typeof window!="undefined"?window.location.pathname:"/",i=f.getABConfig().headlineSelectors||["h1","h2","h3"],a=[...e.filter(g=>this.isWithinSchedule(g))].sort((g,m)=>{var K,P;let v=(K=g.priority)!=null?K:0,b=(P=m.priority)!=null?P:0;if(b!==v)return b-v;let E=Date.parse(g.updatedAt||"")||0;return(Date.parse(m.updatedAt||"")||0)-E}),s=new WeakSet,c=[];for(let g of a){if(!g.target)continue;let m=[],v="path",b=((d=(u=g.variants)==null?void 0:u[0])==null?void 0:d.name)||"";if(g.target.type==="selector")m=this.querySelectorAll(g.target.value),v="selector";else if(g.target.type==="path"){if(!this.pathMatches(t,g.target.value))continue;let w=g.target.elementSelector||i.join(", ");m=this.queryAndFilterByText(w,b),v="path"}else if(g.target.type==="headline"){let w=g.target.elementSelector||i.join(", ");m=this.queryAndFilterByText(w,g.target.value),v="headline"}if(m.length===0)continue;let E=m.filter(w=>!s.has(w));E.length!==0&&(E.forEach(w=>s.add(w)),c.push({experiment:g,elements:E,matchedBy:v}))}return c},[])}static isWithinSchedule(e){return l(()=>{let t=Date.now();if(e.startAt){let i=Date.parse(e.startAt);if(!isNaN(i)&&i>t)return!1}if(e.endAt){let i=Date.parse(e.endAt);if(!isNaN(i)&&i<t)return!1}return!0},!0)}static querySelectorAll(e){return l(()=>{let t=document.querySelectorAll(e),i=[];return t.forEach(r=>{r instanceof HTMLElement&&i.push(r)}),i},[])}static queryAndFilterByText(e,t){let i=this.querySelectorAll(e);return t?i.filter(r=>this.isSimilar(r.textContent||"",t)):i}static pathMatches(e,t){return t==="*"||t==="/*"?!0:t.endsWith("*")?e.startsWith(t.slice(0,-1)):e===t}static isSimilar(e,t){let i=m=>m.toLowerCase().replace(/[^\p{L}\p{N}\s]/gu," ").replace(/\s+/g," ").trim(),r=i(e),a=i(t);if(!r||!a)return!1;if(r===a)return!0;let s=r.split(" "),c=a.split(" "),u=(m,v)=>v.length>=3&&m.length>=15;if(r.includes(a)&&u(a,c)||a.includes(r)&&u(r,s))return!0;if(s.length<3||c.length<3)return!1;let d=new Set(s);return c.filter(m=>d.has(m)).length/Math.max(d.size,c.length)>=.7}}});function nd(n,e=0){let t=3735928559^e,i=1103547991^e;for(let r=0;r<n.length;r++){let a=n.charCodeAt(r);t=Math.imul(t^a,2654435761),i=Math.imul(i^a,1597334677)}return t=Math.imul(t^t>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),4294967296*(2097151&i)+(t>>>0)}function rd(n){return nd(n)/9007199254740992}var en,Hs=p(()=>{"use strict";h();S();$t();Xi();ci();en=class{static assign(e){var m;let t=e.variants||[];if(t.length===0)return{variantKey:"",source:"pinned"};if(e.activeVariant!=="RANDOM"){let v=t.find(b=>b.key===e.activeVariant);if(v)return{variantKey:v.key,source:"pinned"}}let i=f.getABConfig(),a=(i.variantCookiePrefix||"naviga_ab_variant_")+e.id,s=D.get(a);if(s&&t.some(v=>v.key===s))return{variantKey:s,source:"random-cookie"};let c=Ie.getCurrentDeviceId(),u=this.rollByWeight(t,c?`${c}:${e.id}`:null),g=(i.stickinessMode||Os)==="persistent"?(m=i.variantCookieDays)!=null?m:30:0;return D.set(a,u,g),{variantKey:u,source:"random-assigned"}}static rollByWeight(e,t){var i;return l(()=>{let r=e.map(d=>typeof d.weight=="number"&&d.weight>0?d.weight:d.weight===void 0?1:0),a=r.reduce((d,g)=>d+g,0),s=t!=null?rd(t):Math.random();if(a<=0){let d=Math.floor(s*e.length);return e[Math.min(d,e.length-1)].key}let c=s*a,u=0;for(let d=0;d<e.length;d++)if(u+=r[d],c<u)return e[d].key;return e[e.length-1].key},((i=e[0])==null?void 0:i.key)||"")}}});var Ur,tn,Bs=p(()=>{"use strict";h();Ur="navigaAbExperimentId",tn=class n{static setHeadlineText(e,t){let i=n.findTextHost(e),r=!1;for(let a of Array.from(i.childNodes))a.nodeType===Node.TEXT_NODE&&(!r&&(a.textContent||"").trim().length>0?(a.textContent=t,r=!0):a.textContent="");r||i.insertBefore(document.createTextNode(t),i.firstChild)}static findTextHost(e){let t=e;for(let i=0;i<10;i++){let r=(t.textContent||"").trim(),a=t.children;if(a.length!==1||r.length===0)return t;let s=a[0];if((s.textContent||"").trim()!==r)return t;t=s}return t}static apply(e,t,i){var g;let r=e.variants||[],a=r[0],s=r.find(m=>m.key===i)||a,c=!!s&&!!a&&s.key===a.key,u=(a==null?void 0:a.name)||(((g=t[0])==null?void 0:g.textContent)||"").trim(),d=(s==null?void 0:s.name)||u;for(let m of t)l(()=>{m.dataset.navigaAbOriginal||(m.dataset.navigaAbOriginal=u),m.dataset.navigaAbExperimentId=e.id,m.dataset.navigaAbVariant=i,m.dataset.navigaAbVariantText=d,!c&&typeof d=="str
1ing"&&d.length>0&&n.setHeadlineText(m,d)},void 0);return{variantTitle:d,originalTitle:u}}static restoreAllOriginals(){typeof document!="undefined"&&l(()=>{document.querySelectorAll("[data-naviga-ab-original]").forEach(t=>{if(t instanceof HTMLElement){let i=t.dataset.navigaAbOriginal;i&&n.setHeadlineText(t,i)}})},void 0)}static reapplyAllVariants(){typeof document!="undefined"&&l(()=>{document.querySelectorAll("[data-naviga-ab-variant-text]").forEach(t=>{if(t instanceof HTMLElement){let i=t.dataset.navigaAbVariantText,r=t.dataset.navigaAbVariant;r&&r!=="control"&&i&&n.setHeadlineText(t,i)}})},void 0)}}});function rn(n){if(!n)return"";try{let e=new URL(n),t=e.protocol.toLowerCase(),i=e.hostname.toLowerCase(),r=e.port;(t==="http:"&&r==="80"||t==="https:"&&r==="443")&&(r="");let a=e.pathname||"/";a.length>1&&a.endsWith("/")&&(a=a.slice(0,-1));let s=r?`:${r}`:"";return`${t}//${i}${s}${a}`}catch{return n}}function Or(){return l(()=>{if(typeof sessionStorage=="undefined")return[];let n=sessionStorage.getItem(nn);if(!n)return[];let e=JSON.parse(n);return Array.isArray(e)?e.filter(ad):[]},[])}function Fr(n){l(()=>{if(typeof sessionStorage!="undefined"){if(n.length===0){sessionStorage.removeItem(nn);return}sessionStorage.setItem(nn,JSON.stringify(n))}},void 0)}function ad(n){return!!n&&typeof n.experimentId=="string"&&typeof n.variantKey=="string"&&typeof n.clickId=="string"&&typeof n.clickAt=="number"&&typeof n.targetHref=="string"&&typeof n.qualityActiveSeconds=="number"}var nn,Vs,dt,Hr=p(()=>{"use strict";h();y();nn="naviga_ab_qualified_click_queue",Vs=24*60*60*1e3;dt=class{static enqueue(e){l(()=>{let t={...e,targetHref:rn(e.targetHref)},i=this.purgeStale(Vs,Or());i.push(t),Fr(i),o.info("[AB] qualified-click enqueued",{experimentId:t.experimentId,targetHref:t.targetHref})},void 0)}static dequeueMatching(e){return l(()=>{let t=rn(e);if(!t)return[];let i=this.purgeStale(Vs,Or()),r=[],a=[];for(let s of i)s.targetHref===t?r.push(s):a.push(s);return Fr(a),r},[])}static purgeStale(e,t){return l(()=>{let i=t!=null?t:Or(),r=Date.now()-e,a=i.filter(s=>s.clickAt>=r);return t||Fr(a),a},t!=null?t:[])}static __clearForTests(){l(()=>{typeof sessionStorage!="undefined"&&sessionStorage.removeItem(nn)},void 0)}}});var pe,an=p(()=>{"use strict";h();k();le();Se();Ke();y();Xi();Hr();pe=class n{static async trackView(e){if(e.source==="preview"){o.info("[AB] preview mode \u2014 view event suppressed for",e.experiment.id);return}await C(async()=>{let t={experiment_id:e.experiment.id,experiment_name:e.experiment.name,variant:e.variantKey,is_control:String(this.isControl(e)),variant_source:e.source,variant_title:e.variantTitle,original_title:e.originalTitle,target_selector:this.elementSelector(e.match.elements[0]),target_url:this.currentUrl(),target_type:e.match.matchedBy};console.warn("[AB EVENT] ab_experiment_view",t);let i=await F.createEvent(Dr,t);if(!i.success)throw new Error("Failed to create ab_experiment_view event");if(i.value===null)return;let r=await ne.send(i.value);r.success||o.warn("[AB] Failed to send view event:",r.error.message)},{message:"Failed to track ab_experiment_view",severity:"medium",source:"ABEventTracker.trackView",eventName:Dr})}static async trackClick(e,t,i){if(e.source==="preview"){o.info("[AB] preview mode \u2014 click event suppressed for",e.experiment.id);return}await C(async()=>{var d,g;let r=t instanceof HTMLAnchorElement?t.href:(d=t.closest("a"))==null?void 0:d.href,a=n.makeClickId();r&&dt.enqueue({experimentId:e.experiment.id,experimentName:e.experiment.name,variantKey:e.variantKey,isControl:this.isControl(e),clickId:a,clickAt:Date.now(),targetHref:rn(r),qualityActiveSeconds:(g=e.experiment.qualityActiveSeconds)!=null?g:15});let s={experiment_id:e.experiment.id,experiment_name:e.experiment.name,variant:e.variantKey,is_control:String(this.isControl(e)),variant_title:e.variantTitle,original_title:e.originalTitle,target_selector:this.elementSelector(t),target_url:this.currentUrl(),click_target_tag:t.tagName,click_target_href:r||null,click_position:{x:i.clientX,y:i.clientY},click_id:a,time_since_view_ms:Math.max(0,Date.now()-e.viewedAt)};
1console.warn("[AB EVENT] ab_experiment_click",s);let c=await F.createEvent(Lr,s);if(!c.success)throw new Error("Failed to create ab_experiment_click event");if(c.value===null)return;let u=await ce.send("/event",c.value);(!u.success||!u.value.success)&&o.warn("[AB] Failed to send click event")},{message:"Failed to track ab_experiment_click",severity:"low",source:"ABEventTracker.trackClick",eventName:Lr})}static async trackQualifiedClick(e){await C(async()=>{let t={experiment_id:e.experimentId,experiment_name:e.experimentName,variant:e.variantKey,is_control:e.isControl,click_id:e.clickId,original_click_at:Math.floor(e.originalClickAt/1e3),qualified_at:Math.floor(e.qualifiedAt/1e3),active_seconds_observed:e.activeSecondsObserved,target_url:this.currentUrl()};console.warn("[AB EVENT] ab_experiment_qualified_click",t);let i=await F.createEvent(Mr,t);if(!i.success)throw new Error("Failed to create ab_experiment_qualified_click event");if(i.value===null)return;let r=await ne.send(i.value);r.success||o.warn("[AB] Failed to send qualified-click event:",r.error.message)},{message:"Failed to track ab_experiment_qualified_click",severity:"low",source:"ABEventTracker.trackQualifiedClick",eventName:Mr})}static makeClickId(){try{let t=globalThis.crypto;if(t&&typeof t.randomUUID=="function")return t.randomUUID()}catch{}let e=()=>Math.floor(Math.random()*4294967295).toString(16).padStart(8,"0");return`${e()}${e()}-${e()}-${e()}`}static isControl(e){var i,r;let t=(r=(i=e.experiment.variants)==null?void 0:i[0])==null?void 0:r.key;return!!t&&t===e.variantKey}static elementSelector(e){if(!e)return"";let t=e.id?`#${e.id}`:"",i=e.className&&typeof e.className=="string"?"."+e.className.trim().split(/\s+/).join("."):"";return`${e.tagName.toLowerCase()}${t}${i}`}static currentUrl(){try{return window.location.href}catch{return""}}}});var on,$s=p(()=>{"use strict";h();S();an();on=class{static track(e){l(()=>{let t=f.getABConfig().exposureGating!==!1,i=typeof window!="undefined"&&typeof window.IntersectionObserver!="undefined";if(!t||!i){pe.trackView(e);return}let r=e.match.elements[0];if(!r){pe.trackView(e);return}if(this.isMostlyVisible(r)){pe.trackView(e);return}let a=new IntersectionObserver(s=>{for(let c of s)if(c.isIntersecting&&c.intersectionRatio>=.5){pe.trackView(e),a.disconnect();return}},{threshold:.5});a.observe(r)},void 0)}static isMostlyVisible(e){try{let t=e.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight||0,r=window.innerWidth||document.documentElement.clientWidth||0;if(t.width===0||t.height===0)return!1;let a=Math.max(0,Math.min(t.bottom,i)-Math.max(t.top,0)),s=Math.max(0,Math.min(t.right,r)-Math.max(t.left,0)),c=a*s,u=t.width*t.height;return c/u>=.5}catch{return!1}}}});var zs,sn,Ks=p(()=>{"use strict";h();zs="naviga_visitor_seen",sn=class{static classify(){return l(()=>{if(typeof window=="undefined"||!window.localStorage||window.localStorage.getItem(zs))return"returning";try{window.localStorage.setItem(zs,new Date().toISOString())}catch{}return"new"},"returning")}}});var ft,js=p(()=>{"use strict";St();Ks();ft=class{static async matches(e){if(!e)return!0;if(e.devices&&e.devices.length>0){let t=await this.getDeviceType();if(!t||!e.devices.includes(t))return!1}return!(e.visitorType&&this.getVisitorType()!==e.visitorType||e.urlPattern&&!this.urlMatches(e.urlPattern))}static async getDeviceType(){if(this.cachedDeviceType)return this.cachedDeviceType;try{let e=await se.getPlatformInfo();if(!e.success)return null;let t=e.value.type;return t==="mobile"||t==="tablet"||t==="desktop"?(this.cachedDeviceType=t,t):null}catch{return null}}static getVisitorType(){return this.cachedVisitorType?this.cachedVisitorType:(this.cachedVisitorType=sn.classify(),this.cachedVisitorType)}static urlMatches(e){if(typeof window=="undefined")return!1;try{return new RegExp(e).test(window.location.pathname||"")}catch{return!1}}};ft.cachedDeviceType=null,ft.cachedVisitorType=null});var cn,qs=p(()=>{"use strict";h();S();cn=class{static read(){return l(()=>{if(typeof window=="undefined")return new Map;let e=f.getABConfig().previewQueryParam||"naviga_ab_preview",t=window.location.search||"";if(!t)return new Map;let r=new URLSearchParams(t).get(e);return r?this.parse(r):new Map},new Map)}static parse(e){let t=new Map;if(!e||typeof e!="string")return t;let i=e.split(",");for(let r of i){let a=r.trim();if(!a)continue;let s=a.indexOf(":");if(s<=0||s===a.length-1)continue;let c=a.slice(0,s).trim(),u=a.slice(s+1).trim();!c||!u||t.set(c,u)}return t}}});var gt,Gs=p(()=>{"use strict";h();y();Er();an();Hr();gt=class{static start(){this.started||l(()=>{this.started=!0;let e=this.getCurrentUrl();if(!e)return;let t=dt.dequeueMatching(e);if(t.length===0){o.info("[AB] qualified-click watcher: no pending entr
1ies for",e);return}o.info(`[AB] qualified-click watcher: ${t.length} pending entries for`,e);for(let i of t)this.armSubscription(i)},void 0)}static armSubscription(e){let t=Fe.getActiveSecondsSincePageLoad();Fe.subscribeToThreshold(e.qualityActiveSeconds,()=>{let i=Fe.getActiveSecondsSincePageLoad()-t;pe.trackQualifiedClick({experimentId:e.experimentId,experimentName:e.experimentName,variantKey:e.variantKey,isControl:e.isControl,clickId:e.clickId,originalClickAt:e.clickAt,qualifiedAt:Date.now(),activeSecondsObserved:i})})}static getCurrentUrl(){try{return typeof window!="undefined"&&window.location?window.location.href:""}catch{return""}}static __resetForTests(){this.started=!1}};gt.started=!1});var $e,Ws=p(()=>{"use strict";h();k();y();Nr();Fs();Hs();Bs();an();$s();js();qs();Gs();$e=class{static async runQualifiedClickWatcher(){this.qualifiedClickStarted||(this.qualifiedClickStarted=!0,gt.start())}static async run(){this.started||(this.started=!0,typeof document!="undefined"&&document.readyState==="loading"&&await new Promise(e=>{document.addEventListener("DOMContentLoaded",()=>e(),{once:!0})}),await C(async()=>{gt.start();let e=await Ve.loadActive();if(!e.success)return;let t=Zi.match(e.value);if(t.length===0){o.info("[AB] No experiments match this page");return}let i=cn.read();for(let r of t){if(!await ft.matches(r.experiment.audience)){o.info("[AB] Skipping \u2014 audience filter:",r.experiment.id);continue}let s=this.resolveAssignment(r.experiment,i);if(!s.variantKey)continue;let{variantTitle:c,originalTitle:u}=tn.apply(r.experiment,r.elements,s.variantKey),d={experiment:r.experiment,match:r,variantKey:s.variantKey,source:s.source,variantTitle:c,originalTitle:u,viewedAt:Date.now()};this.contexts.set(r.experiment.id,d),await on.track(d)}this.attachClickListener()},{message:"Failed to run variant orchestrator",severity:"medium",source:"VariantOrchestrator.run"}))}static resolveAssignment(e,t){let i=t.get(e.id);return i&&e.variants.some(r=>r.key===i)?{variantKey:i,source:"preview"}:en.assign(e)}static attachClickListener(){typeof document!="undefined"&&document.addEventListener("click",e=>{var c;let t=e.target;if(!t||!t.closest)return;let i=`[data-${this.kebab(Ur)}]`,r=t.closest(i);if(!r){console.warn("[AB CLICK DEBUG] Click not on AB element. target:",t.tagName,(c=t.textContent)==null?void 0:c.slice(0,50),"| selector:",i);return}let a=r.dataset[Ur];if(!a){console.warn("[AB CLICK DEBUG] No experimentId in dataset");return}let s=this.contexts.get(a);if(!s){console.warn("[AB CLICK DEBUG] No context for experimentId:",a,"| contexts keys:",[...this.contexts.keys()]);return}console.warn("[AB CLICK DEBUG] Click matched! Calling trackClick for",a),pe.trackClick(s,r,e)},{capture:!0})}static kebab(e){return e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}};$e.started=!1,$e.qualifiedClickStarted=!1,$e.contexts=new Map});var Qs,Ys=p(()=>{"use strict";Qs="__navigaAbAdminEditor"});function ln(n,e){V.report({message:`Admin A/B editor failed to load from ${e||"(no url could be resolved)"}: ${n}. Reader-side A/B is unaffected; only the editor is unavailable.`,severity:"medium",source:"AdminEditorLoader.remote",data:{url:e,reason:n,filename:oi,capturedBase:Aa()}}),o.error("[AB] Admin editor failed to load:",n)}function Xs(){let n=window[Qs];return n||null}function Br(){let n=Xs();if(n)return Promise.resolve(n);if(Qe)return Qe;let e=ka(oi);return e?(Qe=new Promise((t,i)=>{let r=document.createElement("script");r.src=e,r.async=!0;let a=!1,s=u=>{a||(a=!0,window.clearTimeout(c),u())},c=window.setTimeout(()=>{s(()=>{Qe=null,ln(`timed out after ${Js}ms`,e),i(new Error("admin editor load timed out"))})},Js);r.onload=()=>{let u=Xs();s(u?()=>t(u):()=>{Qe=null,ln("script loaded but registered no editor global",e),i(new Error("admin editor did not register"))})},r.onerror=()=>{s(()=>{Qe=null,ln("network or CSP error fetching the script",e),i(new Error("admin editor script failed to load"))})},document.head.appendChild(r),o.info("[AB] Fetching admin editor from",e)}),Qe):(ln(oi?"no base URL could be resolved (currentScript unavailable and no baked fallback)":"this build has no editor artifact",""),Promise.reject(new Error("admin editor URL could not be resolved")))}var Js,Qe,Zs=p(()=>{Ys();y();Xe();k();si();Un();Js=1e4,Qe=null});var _e,ec=p(()=>{"use strict";h();k();y();S();$t();Is();Ls();Ns();Ws();Zs();_e=class{static async start(){this.started||(this.started=!0,await C(async()=>{var t;let e=f.getABConfig();if(!e.enabled){o.info("[AB] Disabled in config; coordinator exiting.");return}if(await $e.runQualifiedClickWatcher(),(t=e.excludedPathPrefixes)!=null&&t.length&&typeof window!="undefined"){let i=window.location.pathname;if(e.excludedPathPrefixes.some(a=>i.startsWith(a))){o.info(`[AB] Page excluded by path prefix: ${i}`);return}}if(await $e.run(),await this.evaluateToken(),this.checkAdminFlag()){this.initializeHUD();let i=f.getABConfig().cookieName||"naviga_ab_session";this.watchSessionExpiry(i)}}
1,{message:"Failed to start AB coordinator",severity:"medium",source:"ABTestingCoordinator.start"}))}static expiryKey(e){return`${e}_exp`}static async evaluateToken(){let e=f.getABConfig(),t=e.tokenQueryParam||"naviga_ab_token",i=e.cookieName||"naviga_ab_session",r=Kt.extract(t);if(r){Kt.stripFromURL(t);let u=jt(r);u&&typeof u.exp=="number"?(this.persistSession(i,{session:r,expiresAt:u.exp}),Te.markAdminFlagFromCookie(),o.info("[AB] JWT token stored \u2014 admin session active")):o.warn("[AB] URL token is not a usable JWT \u2014 ignoring");return}let a=D.get(i);if(!a){Te.clearAdminFlag();return}let s=jt(a),c=Math.floor(Date.now()/1e3);s&&typeof s.exp=="number"&&s.exp>c?(Te.markAdminFlagFromCookie(),o.info("[AB] Session JWT still valid \u2014 admin flag refreshed")):(D.delete(i),D.delete(this.expiryKey(i)),Te.clearAdminFlag(),o.info("[AB] Session JWT expired or invalid \u2014 admin flag cleared"))}static persistSession(e,t){D.set(e,t.session,0),D.set(this.expiryKey(e),String(t.expiresAt),0)}static checkAdminFlag(){try{if(localStorage.getItem(Ji)!=="true")return!1;let e=f.getABConfig().cookieName||"naviga_ab_session";return D.get(e)?!0:(Te.clearAdminFlag(),!1)}catch{return!1}}static canWrite(){try{let e=f.getABConfig().cookieName||"naviga_ab_session",t=D.get(e);return Ms(t)}catch{return!1}}static initializeHUD(){this.hudInitialized||(this.hudInitialized=!0,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>this.openHeadlineSelector()):this.openHeadlineSelector())}static async openHeadlineSelector(){try{o.info("[AB] Opening headline selector"),(await Br()).initialize(!0)}catch(e){o.error("[AB] Failed to load headline selector:",e)}}static watchSessionExpiry(e){this.expiryInterval||(this.expiryInterval=setInterval(()=>{this.checkSessionValid(e)},this.EXPIRY_POLL_MS),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.checkSessionValid(e)}),this.logoutListenerAttached||(this.logoutListenerAttached=!0,window.addEventListener("message",t=>{var i;((i=t.data)==null?void 0:i.type)==="naviga_ab_logout"&&(o.info("[AB] Received logout signal from dashboard \u2014 clearing HUD session"),this.handleSessionExpired(e))})))}static checkSessionValid(e){let t=D.get(e);if(!t){this.handleSessionExpired(e);return}let i=jt(t),r=Math.floor(Date.now()/1e3);(!i||typeof i.exp!="number"||i.exp<=r)&&this.handleSessionExpired(e)}static handleSessionExpired(e){this.expiryInterval&&(clearInterval(this.expiryInterval),this.expiryInterval=null),D.delete(e),D.delete(this.expiryKey(e)),Te.clearAdminFlag(),this.hudInitialized=!1,o.info("[AB] HUD session expired \u2014 tearing down HUD"),Br().then(t=>{t.teardown(),t.notify("A/B HUD session expired \u2014 relaunch from the dashboard to continue.")}).catch(()=>{})}};_e.started=!1,_e.hudInitialized=!1,_e.expiryInterval=null,_e.logoutListenerAttached=!1,_e.EXPIRY_POLL_MS=3e4});function tc(n){try{window[sd]=n}catch{}}var sd,ic=p(()=>{"use strict";sd="__navigaAnalyticsCoreInternals"});var nc={};O(nc,{ABTesting:()=>cd});var cd,rc=p(()=>{"use strict";ec();S();Xe();Nr();ic();cd={start:()=>(tc({ConfigManager:f,ErrorReporter:V,ABTestingCoordinator:_e,ExperimentLoader:Ve}),_e.start())}});function Vr(n){var e,t;return(t=(e=n.querySelector("article"))!=null?e:n.querySelector("main"))!=null?t:n.body}function ld(n){return Array.from(n.querySelectorAll("h1,h2,h3,h4,h5,h6"))}function ud(n){var t;let e=((t=n.textContent)!=null?t:"").trim();return e?e.split(/\s+/).length:0}function dd(n){var i;let e=!!((i=n.querySelector("article"))!=null?i:n.querySelector("main")),t=n.querySelectorAll("h1").length;return{id:"semantic_structure",audience:"A",pass:e&&t===1}}function fd(n){var r;let e=n.querySelector('link[rel="canonical"]'),t=(r=e==null?void 0:e.getAttribute("href"))!=null?r:"";return{id:"canonical_present",audience:"B",pass:/^https?:\/\//i.test(t)}}function gd(n){return{id:"robots_not_noindex",audience:"B",pass:!Array.from(n.querySelectorAll('meta[name="robots" i], meta[name="googlebot" i]')).some(i=>{var r;return/\bnoindex\b/i.test((r=i.getAttribute("content"))!=null?r:"")})}}function pd(n){return{id:"og_tags_complete",audience:"B",pass:["og:title","og:description","og:image"].every(i=>{var a;let r=n.querySelector(`meta[property="${i}"]`);return!!((a=r==null?void 0:r.getAttribute("content"))!=null&&a.trim())})}}function md(n){var r,a;let e=n.querySelector('meta[name="description"]'),t=(a=(r=e==null?void 0:e.getAttribute("content"))==null?void 0:r.trim())!=null?a:"";
1return{id:"meta_description",audience:"B",pass:t.length>0&&t.length<=350}}function hd(n){if(n.querySelectorAll("h1").length!==1)return{id:"headline_hierarchy",audience:"B",pass:!1};let t=Vr(n),i=ld(t);if(i.length===0)return{id:"headline_hierarchy",audience:"B",pass:!0};let r=parseInt(i[0].tagName[1],10);for(let a=1;a<i.length;a++){let s=parseInt(i[a].tagName[1],10);if(s>r+1)return{id:"headline_hierarchy",audience:"B",pass:!1};r=s}return{id:"headline_hierarchy",audience:"B",pass:!0}}function vd(n){let e=Vr(n),i=Array.from(e.querySelectorAll("img")).filter(s=>!(s.getAttribute("role")==="presentation"||s.getAttribute("aria-hidden")==="true"));return i.length===0?{id:"image_alt_coverage",audience:"C",pass:!0}:{id:"image_alt_coverage",audience:"C",pass:i.filter(s=>{var c;return((c=s.getAttribute("alt"))!=null?c:"").trim()!==""}).length/i.length>=.9}}function yd(n){var i;let e=n.querySelector('meta[name="viewport"]');return{id:"viewport_meta",audience:"C",pass:!!((i=e==null?void 0:e.getAttribute("content"))!=null&&i.trim())}}function bd(n){let e=Vr(n);return{id:"word_count_sane",audience:"C",pass:ud(e)>50}}var Cd,un,wd,ac=p(()=>{"use strict";y();Cd=[{id:"semantic_structure",fn:dd},{id:"canonical_present",fn:fd},{id:"robots_not_noindex",fn:gd},{id:"og_tags_complete",fn:pd},{id:"meta_description",fn:md},{id:"headline_hierarchy",fn:hd},{id:"image_alt_coverage",fn:vd},{id:"viewport_meta",fn:yd},{id:"word_count_sane",fn:bd}],un=class{static runChecks(e){return Cd.map(({id:t,fn:i})=>{var r;try{return i(e)}catch(a){o.warn(`[DomChecks] check "${t}" threw \u2014 recording as fail`,a);let s=(r=wd[t])!=null?r:"C";return{id:t,audience:s,pass:!1}}})}},wd={semantic_structure:"A",canonical_present:"B",robots_not_noindex:"B",og_tags_complete:"B",meta_description:"B",headline_hierarchy:"B",image_alt_coverage:"C",viewport_meta:"C",word_count_sane:"C"}});var _d,x,Ye,$r=p(()=>{"use strict";_d=2500,x=class x{static start(){if(x.observer===null)try{x.observer=new PerformanceObserver(e=>{let t=e.getEntries();t.length>0&&(x.latestLcpMs=t[t.length-1].startTime)}),x.observer.observe({type:"largest-contentful-paint",buffered:!0}),x.supported=!0}
1catch{x.observer=null,x.supported=!1}}static getProvisionalLcpMs(){return x.latestLcpMs}static toCheckResult(){return!x.supported||x.latestLcpMs===null?null:{id:"cwv_lcp",audience:"C",pass:x.latestLcpMs<_d}}static reset(){if(x.observer)try{x.observer.disconnect()}catch{}x.observer=null,x.latestLcpMs=null,x.supported=!1}};x.latestLcpMs=null,x.observer=null,x.supported=!1;Ye=x});function Ad(n){return!(n.origin!==window.location.origin||n.protocol!=="http:"&&n.protocol!=="https:")}function oc(n){return n.toLowerCase().replace(/\s+/g," ").trim()}function kd(n){var i,r,a;let e=(r=(i=n.querySelector("article"))!=null?i:n.querySelector("main"))!=null?r:n.body,t=((a=e==null?void 0:e.textContent)!=null?a:"").trim();return t?t.split(/\s+/).length:0}var zr,Ed,Sd,dn,sc=p(()=>{"use strict";S();y();Ii();zr=2e6,Ed=5e3,Sd=150;dn=class{static async run(e){var m,v;let t={result:null,checked:!1},i=f.getContentReadinessConfig();if(!i.rawHtmlCheck||Math.random()>=i.rawHtmlCheckSamplingRate)return t;let r=navigator.connection;if(r&&(r.saveData===!0||typeof r.effectiveType=="string"&&r.effectiveType.includes("2g")))return t;let a;try{a=new URL(window.location.href)}catch{return o.warn("[RawHtmlCheck] failed to parse window.location.href as URL \u2014 skipping"),t}if(!Ad(a))return o.warn("[RawHtmlCheck] same-origin/protocol assertion failed for",a.toString(),"\u2014 skipping fetch (security invariant)"),t;let s=new AbortController,c=setTimeout(()=>s.abort(),Ed),u;try{let b=await fetch(a.toString(),{credentials:"omit",redirect:"follow",signal:s.signal});if(!b.ok)return o.warn("[RawHtmlCheck] non-OK response:",b.status,"\u2014 skipping check"),t;u=await b.text()}catch(b){return o.warn("[RawHtmlCheck] fetch failed or aborted \u2014 skipping check",b),t}finally{clearTimeout(c)}u.length>zr&&(o.warn(`[RawHtmlCheck] raw HTML exceeds ${zr} chars (${u.length}) \u2014 truncating for parse`),u=u.slice(0,zr));let d=new DOMParser().parseFromString(u,"text/html"),g;if(e.isPremium){let E=Ae.runChecks(d,!0).find(w=>w.id==="paywall_markup");g=(E==null?void 0:E.pass)===!0}else{let{headlineText:b}=e;if(b===null)g=!1;else{d.querySelectorAll("script, style, noscript, template").forEach(te=>te.remove());let E=oc(b),w=oc((v=(m=d.body)==null?void 0:m.textContent)!=null?v:""),K=E.length>0&&w.includes(E),P=kd(d);g=K&&P>=Sd}}return{result:{id:"ssr_article_body",audience:"A",pass:g},checked:!0}}}});function Rd(n){var i,r,a;let e=(r=(i=n.querySelector("article"))!=null?i:n.querySelector("main"))!=null?r:n.body,t=((a=e==null?void 0:e.textContent)!=null?a:"").trim();return t?t.split(/\s+/).length:0}var Td,Pd,Gt,cc=p(()=>{"use strict";Ii();ac();$r();sc();S();y();Lt();Td=.2,Pd=5;Gt=class{async run(){var c,u;let e=[],t=!1,i=null;try{let d=f.getArticleDetails();if(d.success){let g=d.value;t=lt(g.article_is_premium)===!0;let m=g.total_word_count;if(typeof m=="number"&&m>0)i=m;else if(typeof m=="string"){let v=parseInt(m,10);!isNaN(v)&&v>0&&(i=v)}}}catch(d){o.warn("[DefaultCheckRunner] failed to read article details from ConfigManager",d)}try{let d=Ae.runChecks(document,t);e.push(...d)}catch(d){o.warn("[DefaultCheckRunner] JsonLdInspector threw",d)}try{let d=un.runChecks(document);e.push(...d)}catch(d){o.warn("[DefaultCheckRunner] DomChecks threw",d)}if(i!==null)try{let d=Rd(document),g=i*Td,m=i*Pd,v=d>=g&&d<=m;
1e.push({id:"word_count_sane_mapped",audience:"C",pass:v})}catch(d){o.warn("[DefaultCheckRunner] word_count_sane_mapped check threw",d)}let r=!1;try{let d=document.querySelector("h1"),g=(u=(c=d==null?void 0:d.textContent)==null?void 0:c.trim())!=null?u:null,m=await dn.run({isPremium:t,headlineText:g});r=m.checked,m.result!==null&&e.push(m.result)}catch(d){o.warn("[DefaultCheckRunner] RawHtmlCheck threw",d)}let a=Ye.toCheckResult();a!==null&&e.push(a);let s=Ye.getProvisionalLcpMs();return{results:e,rawHtmlChecked:r,lcpMs:s}}}});function uc(n){let e={A:{weightPassed:0,weightRun:0},B:{weightPassed:0,weightRun:0},C:{weightPassed:0,weightRun:0}};for(let i of n){let r=xd[i.id];if(!r)continue;let a=e[r.audience];a.weightRun+=r.weight,i.pass&&(a.weightPassed+=r.weight)}let t=i=>i.weightRun===0?-1:Math.round(100*i.weightPassed/i.weightRun);return{abc_agent_score:t(e.A),abc_bot_score:t(e.B),abc_consumer_score:t(e.C)}}var lc,xd,dc=p(()=>{"use strict";lc="1",xd={jsonld_present:{audience:"A",weight:1},jsonld_newsarticle:{audience:"B",weight:2},jsonld_required_props:{audience:"B",weight:2},schema_dom_consistency:{audience:"B",weight:1},paywall_markup:{audience:"B",weight:2},semantic_structure:{audience:"A",weight:1},canonical_present:{audience:"B",weight:1},robots_not_noindex:{audience:"B",weight:1},og_tags_complete:{audience:"B",weight:1},meta_description:{audience:"B",weight:1},headline_hierarchy:{audience:"B",weight:1},image_alt_coverage:{audience:"C",weight:1},viewport_meta:{audience:"C",weight:1},word_count_sane:{audience:"C",weight:1},cwv_lcp:{audience:"C",weight:1},word_count_sane_mapped:{audience:"C",weight:1},ssr_article_body:{audience:"A",weight:2}}});var gc={};O(gc,{ContentReadinessAuditor:()=>Kr});var fc,Id,Dd,U,Kr,pc=p(()=>{"use strict";y();Zn();Me();S();le();Se();cc();$r();dc();fc="naviga-cr-audit:",Id="naviga-cr-lock:",Dd=60,U=class U{static initialize(e){var s;if(!e||e.enabled!==!0){o.info("[ContentReadiness] skipping \u2014 disabled by config");return}if(typeof window=="undefined"||typeof document=="undefined"){o.info("[ContentReadiness] skipping \u2014 not a browser environment");return}if(this.initialized){o.info("[ContentReadiness] skipping \u2014 already initialized");return}try{if(window.self!==window.top){o.info("[ContentReadiness] skipping \u2014 running inside an iframe");return}}catch{o.info("[ContentReadiness] skipping \u2014 cross-origin iframe detected");return}if(je.isSuspected()){o.info("[ContentReadiness] skipping \u2014 bot or automation detected");return}let t=(s=e.samplingRate)!=null?s:1;if(Math.random()>=t){o.info("[ContentReadiness] skipping \u2014 outside sampling window");return}let i=U.resolveArticleKey(),r=U.todayString();try{let c=fc+i;if(localStorage.getItem(c)===r){o.info("[ContentReadiness] skipping \u2014 already audited today",i);return}}catch{o.info("[ContentReadiness] dedup check failed (storage restricted) \u2014 running audit anyway")}let a=Id+i;try{let c=localStorage.getItem(a);if(c){let u=parseInt(c,10),d=(Date.now()-u)/1e3;if(d<Dd){o.info("[ContentReadiness] skipping \u2014 another tab is auditing (lock age:",d,"s)");return}o.info("[ContentReadiness] stale lock found (age:",d,"s) \u2014 proceeding")}localStorage.setItem(a,String(Date.now()))}catch{o.info("[ContentReadiness] lock write failed (storage restricted) \u2014 proceeding without lock")}this.initialized=!0,this.config=e,Ye.start(),U.scheduleRun(i,r,a)}static setCheckRunner(e){U.runner=e}static reset(){U.initialized=!1,U.runner=new Gt,U.config=null}static scheduleRun(e,t,i){let r=()=>U.run(e,t,i),a=()=>{typeof window.requestIdleCallback=="function"?window.requestIdleCallback(r,{timeout:1e4}):setTimeout(r,3e3)};document.readyState==="complete"?a():window.addEventListener("load",a,{once:!0})}static async run(e,t,i){var g,m;let r=U.config;if(!r)return;let s=(g=J.getEventFields().page_view_uuid)!=null?g:"",c=[],u=!1,d=null;try{let v=await U.runner.run();c=v.results,u=v.rawHtmlChecked,d=(m=v.lcpMs)!=null?m:null}catch(v){o.error("[ContentReadiness] check runner threw:",v),U.releaseLock(i);return}try{localStorage.setItem(fc+e,t)}catch{}if(U.releaseLock(i),c.length===0){o.info("[ContentReadiness] no checks ran \u2014 skipping event emit");return}await U.emit(c,s,r,u,d)}static async emit(e,t,i,r=!1,a=null){let{abc_agent_score:s,abc_bot_score:c,abc_consumer_score:u}=uc(e),d=e.filter(b=>!b.pass).map(b=>b.id),g=d;if(JSON.stringify(d).length>i.maxChecksPayloadBytes){let b=[];for(let E of d){if(JSON.stringify([...b,E,"truncated"]).length>i.maxChecksPayloadBytes)break;b.push(E)}b.push("truncated"),g=b}let v={abc_agent_score:s,abc_bot_score:c,abc_consumer_score:u,abc_failed_checks:g,abc_checks_run:e.length,abc_validator_version:lc,abc_lcp_ms:a,abc_raw_html_checked:r,page_view_uuid:t};try{let b=await F.createEvent("content_readiness",v);if(!b.success||b.value===null){o.info("[ContentReadiness] event creation skipped (disabled or error)");return}await ne.send(b.value)}catch(b){o.error("[ContentReadiness] failed to emit event:",b)}}static resolveArticleKey(){var e;try{let t=f.getArticleDetails();if(t.success){let i=(e=t.value)==null?void 0:e.article_uuid;if(i&&typeof i=="string"&&i.trim()!=="")return i.trim()}}catch{}try{return window.location.pathname.replace(/\/+$/,"")||"/"}catch{return"unknown"}}static todayString(){let e=new Date,t=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${i}-${r}`}static releaseLock(e){try{localStorage.removeItem(e)}catch{}}};U.initialized=!1,U.runner=new Gt,U.config=null;Kr=U});var jr={};O(jr,{CustomEventTracker:()=>fn});var fn,qr=p(()=>{"use strict";S();y();h();Wi();fn=class{static bindingKey(e){return`${e.sourceType}|${e.sourceEventName}|${e.targetEventName}`}static dispatch(e,t,i,r){try{let a=e.payloadMapper?e.payloadMapper(t):i();a!=null&&r(e.targetEventName,zt.namespaceAutoTrackedKeys(a))}catch(a){o.warn(`[CustomEventTracker] Binding ${e.sourceEventName} -> ${e.targetEventName} failed; event dropped:`,a)}}static initBindings(e,t){let i=t!=null?t:f.getCustomEventBindings();if(!i||i.length===0)return;let r=[];for(let c of i){let u=this.bindingKey(c);this.boundKeys.has(u)||(this.boundKeys.add(u),r.push(c))}if(r.length===0)return;o.info(`[CustomEventTracker] Initializing ${r.length} custom event bindings`);let a=r.filter(c=>c.sourceType==="dom"),s=r.filter(c=>c.sourceType==="knockout");a.length>0&&this.initDomBindings(a,e),s.length>0&&this.initKnockoutBindings(s,e)}static initDomBindings(e,t){e.forEach(i=>
1{l(()=>{document.addEventListener(i.sourceEventName,r=>{this.dispatch(i,r,()=>{let a=r.detail;return a==null?{}:typeof a=="object"?{...a}:{value:a}},t)}),o.info(`[CustomEventTracker] Bound DOM event: ${i.sourceEventName} -> ${i.targetEventName}`)},void 0)})}static initKnockoutBindings(e,t){l(()=>{let i=window;if(i.ko&&i.ko.postbox&&typeof i.ko.postbox.subscribe=="function"){this.subscribeKnockoutEvents(e,t);return}let r=0,a=100,s=setInterval(()=>{r++,i.ko&&i.ko.postbox&&typeof i.ko.postbox.subscribe=="function"?(clearInterval(s),this.subscribeKnockoutEvents(e,t)):r>=a&&(clearInterval(s),o.warn("[CustomEventTracker] Timeout waiting for window.ko.postbox; falling back to DOM events"),this.subscribeKnockoutEventsAsDomEvents(e,t))},100)},void 0)}static subscribeKnockoutEventsAsDomEvents(e,t){e.forEach(i=>{l(()=>{document.addEventListener(i.sourceEventName,r=>{let a=r.detail;this.dispatch(i,a,()=>typeof a=="object"&&a!==null?{...a}:{value:a},t)}),o.info(`[CustomEventTracker] Bound Knockout event via DOM fallback: ${i.sourceEventName} -> ${i.targetEventName}`)},void 0)})}static subscribeKnockoutEvents(e,t){let i=window;e.forEach(r=>{l(()=>{i.ko.postbox.subscribe(r.sourceEventName,a=>{this.dispatch(r,a,()=>typeof a=="object"&&a!==null?{...a}:{value:a},t)}),o.info(`[CustomEventTracker] Bound Knockout event: ${r.sourceEventName} -> ${r.targetEventName}`)},void 0)})}};fn.boundKeys=new Set});var Wr={};O(Wr,{CrossDomainLinker:()=>gn,LINKER_PARAM:()=>Gr});var Gr,Ld,gn,Qr=p(()=>{"use strict";S();En();y();h();Me();pi();Gr="naviga_jid",Ld=["campaignId","campaignName","conversationId","conversationName","conversationCode","meterLevel","meterLevelId"],gn=class{static install(){l(()=>{this.installed||typeof document!="undefined"&&this.linkerHosts().length!==0&&(document.addEventListener("click",e=>this.onClick(e),!0),this.installed=!0,o.info("[CrossDomainLinker] Cross-domain linking enabled"))},void 0)}static reset(){this.installed=!1}static onClick(e){l(()=>{let t=this.anchorFor(e.target);if(!t)return;let i=t.getAttribute("href");if(!i)return;let r=this.decorate(i);r&&r!==i&&t.setAttribute("href",r)},void 0)}static decorate(e){return l(()=>{if(typeof window=="undefined")return null;let t=new URL(e,window.location.href);if(!this.isLinkerHost(t.hostname))return null;let i=this.journeyId();i&&!t.searchParams.has(Gr)&&t.searchParams.set(Gr,i);let r=ve.getContext();for(let a of Ld){let s=r[a];s!=null&&s!==""&&!t.searchParams.has(a)&&t.searchParams.set(a,String(s))}return t.toString()},null)}static journeyId(){let e=J.getEventFields(),t=e&&e.page_view_uuid;return typeof t=="string"&&t!==""?t:null}static anchorFor(e){let t=e;for(;t&&t!==document.body;){if(t.tagName&&t.tagName.toLowerCase()==="a")return t;t=t.parentElement}return null}static isLinkerHost(e){return Xt(e,this.linkerHosts())}static linkerHosts(){return l(()=>f.getCrossDomainLinkerHosts(),[])}};gn.installed=!1});var mc={};O(mc,{CacheInvalidationManager:()=>pt});var pt,hc=p(()=>{"use strict";y();Wt();hr();it();fi();Qi();Yi();pt=class{static initialize(){if(this.isInitialized){o.info("[CacheInvalidationManager] Already initialized");return}if(typeof window=="undefined"){o.warn("[CacheInvalidationManager] Not available in this environment");return}o.info("[CacheInvalidationManager] Initializing cache invalidation listeners"),this.setupSPANavigationListener(),this.setupBFCacheListener(),this.isInitialized=!0,o.info("[CacheInvalidationManager] Initialization complete")}static setupSPANavigationListener(){try{this.spaUnsubscribe=W.subscribe(e=>{o.info("[CacheInvalidationManager] SPA navigation detected, clearing cache",{from:e.from,to:e.to,method:e.method}),N.clear(),ue.reset(),q.reset(),he.reset()},{trackHashChanges:!1}),o.info("[CacheInvalidationManager] SPA navigation listener set up")}catch(e){o.warn("[CacheInvalidationManager] Failed to set up SPA navigation listener:",e)}}static setupBFCacheListener(){try{this.bfcacheUnsubscribe=fe.subscribe(()=>{o.info("[CacheInvalidationManager] BFCache restore detected, clearing cache"),N.clear(),ue.reset(),q.reset(),he.reset()}),o.info("[CacheInvalidationManager] BFCache listener set up")}catch(e){o.warn("[CacheInvalidationManager] Failed to set up BFCache listener:",e)}}static cleanup(){if(this.isInitialized){o.info("[CacheInvalidationManager] Cleaning up");try{this.spaUnsubscribe&&(this.spaUnsubscribe(),this.spaUnsubscribe=null),this.bfcacheUnsubscribe&&(this.bfcacheUnsubscribe(),this.bfcacheUnsubscribe=null),this.isInitialized=!1,o.info("[CacheInvalidationManager] Cleanup complete")}catch(e){o.warn("[CacheInvalidationManager] Error during cleanup:",e)}}}static getIsInitialized(){return this.isInitialized}};pt.isInitialized=!1,pt.bfcacheUnsubscribe=null,pt.spaUnsubscribe=null});k();S();S();y();h();Yt();Jt();it();var fa=new Set([...Object.keys(Re),"total_word_count"]),Dc=2048,Lc=["email","phone","mobile","msisdn","ipaddress","latitude","longitude","geolocation","postcode","postalcode","zipcode","address","city","firstname","lastname","fullname","username","birth","gender","ssn","password","creditcard","subscriber","subscription","household"],Mc=["ip","lat","lng","lon","zip","dob","gps"],ni=class{static validate(e){l(()=>{let t=f.get();this.checkRoutingKeys(t),this.checkDeprecatedApiKey(e),this.checkMappingVariableName("articleDetailsMapping",t.articleDetailsMapping),this.checkMappingVariableName("userDetailsMapping",t.userDetailsMapping),this.checkArticleMappingContents(t.articleDetailsMapping),this.checkAutoContextArticlePaths(e),this.checkPageClass(e),this.checkPageClassEnforcement(e),this.checkPageClassPatternRules(e),this.checkSpaNavigationConfig(e)},void 0)}static checkRoutingKeys(e){l(()=>{let t=[];this.isNonEmptyString(e.organisation_name)||t.push("organisation_name"),this.isNonEmptyString(e.publication_name)||t.push("publication_name"),t.length!==0&&o.warnAlways(`[ConfigValidator] Missing required config: ${t.join(" and ")}. Every event from this page will be unroutable and will NOT reach the warehouse \u2014 ingestion routes on organisation_name#publication_name#event_name. Set these in Analytics.init().`)},void 0)}static checkDeprecatedApiKey(e){l(()=>{!e||typeof e!="object"||"api_key"in e&&o.warn("[ConfigValidator] api_key is deprecated and ignored \u2014 it is not sent on any request. It can be removed from Analytics.init().")},void 0)}static checkMappingVariableName(e,t){l(()=>{let i=t&&t.variableName;this.isNonEmptyString(i)&&i.includes(".")&&o.warnAlways(`[ConfigValidator] ${e}.variableName "${i}" will never resolve \u2014 the SDK looks the name up directly on window, it does not walk a dotted path. Use { ${this.suggestMappingFix(i)} } instead.`)},void 0)}static checkArticleMappingContents(e){l(()=>{if(!e||!this.isNonEmptyString(e.variableName)||typeof window=="undefined")return;let t=f.resolveMappedGlobal(e);if(!t||typeof t!="object"||Array.isArray(t))return;let i=Object.keys(t);if(i.length===0)return;let r=i.filter(g=>!fa.has(g)),a=i.length-r.length;a===0&&o.warnAlways(`[ConfigValidator] articleDetailsMapping resolved "${e.variableName}" but none of its ${i.length} keys are article fields the SDK recognises \u2014 every value is being swept into additional_info instead of its own column. Expected keys include ${this.sampleRecognisedKeys().join(", ")}. Check the mapping points at the right object, or rename the keys to match.`);let s=this.serialisedSize(t,r),c=r.filter(g=>this.looksPersonal(g)).length,u=s>Dc,d=a===0&&c>0;!u&&!d||o.warn(`[ConfigValidator] articleDetailsMapping resolved "${e.variableName}" to an object that looks like a personal-data blob rather than article context: ${r.length} unrecognised keys (${c} matching personal-data field names) serialising to ~${s} characters, all of which is attached to every event in additional_info. Map a dedicated article object instead. (Key names and values are withheld from this warning on purpose.)`)},void 0)}static checkAutoContextArticlePaths(e){l(()=>{var r;let t=e==null?void 0:e.autoContext;if(!t)return;let i=(r=t.articleDetection)!=null?r:"auto";i!=="paths"&&!this.verdictIsPathsOnly(t)||Ze(t.articlePaths)||o.warnAlways(`[ConfigValidator] autoContext has no usable articlePaths, and the only article test configured is the URL path one (articleDetection: '${i}'). No page's markup will ever classify it as an article, so article context will only be attached where your own declared article data supplies it \u2014 pages relying on the markup get none. List the URL path prefixes that identify articles, e.g. articlePaths: ['/news/', '/sport/'].`)},void 0)}static verdictIsPathsOnly(e){return l(()=>{var i;let t=(i=e==null?void 0:e.profile)==null?void 0:i.verdict;return!Array.isArray(t)||t.length===0?!1:t.every(r=>(r==null?void 0:r.path)===!0)},!1)}static checkPageClass(e){l(()=>{let t=e==null?void 0:e.pageClass;t!==void 0&&(tt.includes(t)||o.warn(`[ConfigValidator] pageClass ${JSON.stringify(t)} must be one of ${tt.join("/")}; ignoring \u2014 falls through to autoContext.pageClasses, then unknown.`))},void 0)}static checkPageClassEnforcement(e){l(()=>{let t=e==null?void 0:e.pageClassEnforcement;t!==void 0&&(t==="observe"||t==="enforce"||o.warn(`[ConfigValidator] pageClassEnforcement ${JSON.stringify(t)} must be 'observe' or 'enforce'; staying in observe mode.`))},void 0)}static checkPageClassPatternRules(e){l(()=>{var i;let t=(i=e==null?void 0:e.autoContext)==null?void 0:i.pageClasses;if(!(!t||typeof t!="object"))for(let r of tt)r in t&&(sa(t[r])||o.warn(`[ConfigValidator] autoContext.pageClasses.${r} can never be matched from config \u2014 no usable hosts or paths entries.`))},void 0)}static checkSpaNavigationConfig(e){l(()=>{var i;let t=(i=e==null?void 0:e.spaNavigation)==null?void 0:i.treatReplaceStateAsNavigation;t===void 0||typeof t=="boolean"||o.warn(`[ConfigValidator] spaNavigation.treatReplaceStateAsNavigation ${JSON.stringify(t)} must be a boolean; ignoring \u2014 replaceState stays a URL correction, not a navigation.`)},void 0)}static suggestMappingFix(e){return l(()=>{let t=e.replace(/^window\./,""),i=t.indexOf(".");return i===-1||i===t.length-1?`variableName: '${t.replace(/\.$/,"")}'`:`variableName: '${t.slice(0,i)}', path: '${t.slice(i+1)}'`},`variableName: '${e}'`)}static sampleRecognisedKeys(){return l(()=>Array.from(fa).filter(e=>e!=="additional_info"&&!e.endsWith("_uuid")).slice(0,4),[])}static serialisedSize(e,t){return l(()=>{let i={};for(let r of t)i[r]=e[r];return JSON.stringify(i).length},0)}static looksPersonal(e){return l(()=>{let t=e.toLowerCase().replace(/[^a-z0-9]/g,"");return t===""?!1:Mc.includes(t)?!0:Lc.some(i=>t.includes(i))},!1)}static isNonEmptyString(e){return typeof e=="string"&&e.trim()!==""}};h();function Nc(n){return l(()=>
1{if(typeof n!="string")return null;let e=n.trim().split("/");if(e.length!==2)return null;let t=e[0].trim(),i=e[1].trim();return t===""||i===""?null:{organisation_name:t,publication_name:i}},null)}function pa(n){return l(()=>{let e={notices:[]};if(!n||typeof n!="object"||n.site===void 0)return e;let t=Nc(n.site);return t?(ga(n,e,"organisation_name",t.organisation_name),ga(n,e,"publication_name",t.publication_name),e):(e.notices.push(`[SiteShorthand] site: ${JSON.stringify(n.site)} is not of the form 'organisation/publication' (exactly one '/', neither half blank). It has been ignored \u2014 organisation_name and publication_name are left exactly as passed.`),e)},{notices:[]})}function ga(n,e,t,i){let r=n[t];if(typeof r=="string"&&r.trim()!==""){r!==i&&e.notices.push(`[SiteShorthand] ${t} '${r}' disagrees with site '${n.site}', which expands to '${i}'. The explicit ${t} wins. One of the two is wrong \u2014 events will be filed under the explicit value.`);return}e[t]=i}nt();y();Xe();h();function ma(n){return new Proxy(n,{get(e,t){let i=Reflect.get(e,t);return typeof i=="function"?Oc(i.bind(e)):i}})}function Oc(n){return(...e)=>{try{let t=n(...e);return t instanceof Promise?t.catch(()=>{}):t}catch{return}}}ri();ci();St();Nn();ti();Un();it();fi();y();ti();var Ta=50,gi=[],Fn=!1,Pa=!1;function Ra(n){return(e,t)=>{if(ei()){n(e,t);return}if(gi.length>=Ta){Pa||(Pa=!0,o.warn(`[PreInitEventBuffer] More than ${Ta} custom events fired before the SDK was ready; dropping the excess. The earliest events are kept.`));return}gi.push({eventName:e,properties:t}),Fn||(Fn=!0,Zt(()=>{let i=gi;gi=[],Fn=!1;for(let r of i)try{n(r.eventName,r.properties)}catch(a){o.error("[PreInitEventBuffer] Replaying a buffered event failed:",a)}}))}}S();pi();function mi(n){var r,a,s;ve.merge(n);let e=window,t=(s=(a=(r=f.get())==null?void 0:r.customEvents)==null?void 0:a.commonDetailsMapping)==null?void 0:s.variableName,i=typeof t=="string"&&t.trim()!==""?t.trim():"navigaEngageDetails";e[i]=e[i]||{},Object.assign(e[i],n)}function Hn(n){var i,r,a,s,c,u,d,g,m,v,b;let e=(a=(r=(i=n.OfferId)!=null?i:n.offerId)!=null?r:n.Id)!=null?a:n.id,t=(s=n.Type)!=null?s:n.type;return{id:e!=null?String(e):"",planName:(g=(d=(u=(c=n.Name)!=null?c:n.name)!=null?u:n.PlanName)!=null?d:n.planName)!=null?g:"",price:(b=(v=(m=n.TotalPrice)!=null?m:n.totalPrice)!=null?v:n.Amount)!=null?b:n.Price,type:n.IsPrint&&n.IsDigital?"Both":n.IsDigital?"Digital":n.IsPrint?"Print":t!=null?t:""}}function xa(n){let e=Array.prototype.map.call(n,t=>t&&t.pid).filter(Boolean);return e.length>0?e.join(","):void 0}function $c(n){let e={};if(n.promotionsList){let t=xa(n.promotionsList);t!==void 0&&(e.sp_pid=t)}if(n.params&&n.params.presentationName&&(e.sp_presentationName=n.params.presentationName),n.offer){let{id:t,planName:i,price:r,type:a}=Hn(n.offer);e.sp_offerId=t,e.sp_offerPlanName=i,r!==void 0&&(e.sp_offerPrice=r),e.sp_offerType=a}return n.internalSessionId&&(e.internalSessionId=n.internalSessionId),e}function Bn(n){let e={};return n.offerGroupId!=null&&(e.sp_offerGroupId=n.offerGroupId),n.siteCode&&(e.sp_siteCode=n.siteCode),n.clientCode&&(e.sp_clientCode=n.clientCode),n.zipCode&&(e.sp_zipCode=n.zipCode),n.url&&(e.sp_url=n.url),n.MG2Fingerprint&&(e.sp_mg2Fingerprint=n.MG2Fingerprint),e}function rt(n){return{...$c(n),...Bn(n)}}var hi=[{sourceType:"dom",sourceEventName:"onMeterLevelSet",targetEventName:"ignored",payloadMapper:n=>{let e=n.detail||{},t={};return e.MeterLevelId!=null&&(t.meterLevelId=e.MeterLevelId),e.MeterLevel!=null&&(t.meterLevel=e.MeterLevel),e.CampaignId!=null&&(t.campaignId=e.CampaignId),e.CampaignName!=null&&(t.campaignName=e.CampaignName),mi(t),null}},{sourceType:"dom",sourceEventName:"onConversationDetermined",targetEventName:"ignored",payloadMapper:n=>{let e=n.detail||{},t={},i=e.Conversation||{},r=i.Props||i.Properties||{};return e.CampaignId!=null&&(t.campaignId=e.CampaignId),i.Id!=null&&(t.conversationId=i.Id),i.Code!=null&&(t.conversationCode=i.Code),i.Name!=null&&(t.conversationName=i.Name),r.Views!=null&&(t.conversationViews=r.Views),r.ArticleLeft!=null&&(t.conversationArticleLeft=r.ArticleLeft),r.Date&&(r.Date.Started!=null&&(t.conversationDateStarted=r.Date.Started),r.Date.Ended!=null&&(t.conversationDateEnded=r.Date.Ended),r.Date.Expiration!=null&&(t.conversationDateExpiry=r.Date.Expiration)),mi(t),null}},{sourceType:"dom",sourceEventName:"onFinish",targetEventName:"on_finish",payloadMapper:n=>{let e=n.detail||{};if(e.MG2AccountData&&typeof e.MG2AccountData=="object"){let t=e.MG2AccountData,i={};Array.isArray(t.OwnedSubscriptions)&&t.OwnedSubscriptions.length>0&&(i.engage_subscriptions=t.OwnedSubscriptions),t.MasterId&&(i.engage_master_id=t.MasterId),t.DigitalAccess&&typeof t.DigitalAccess=="object"&&t.DigitalAccess.AccessLevel&&(i.engage_access_level=t.DigitalAccess.AccessLevel),Object.keys(i).length>0&&mi(i)}return{...e||{},_sdk_auto_tracked:!0}}},{sourceType:"dom",sourceEventName:"RegistrationSuccess",targetEventName:"user_registered",payloadMapper:n=>{let e=n&&n.detail!==void 0?n.detail:n||{},i=(e.EventData||{}).RegistrationContext||e.RegistrationContext||{},r={_sdk_auto_tracked:!0},a=new Set(["email","emailaddress","useremail","e-mail"]);if(typeof i=="object"&&i!==null)for(let[g,m]of Object.entries(i))a.has(g.toLowerCase())||m!=null&&m!==""&&(r[g]=m);let s=e.auth0Id||e.auth0_id||i.auth0Id||i.auth0_id;s&&(r.auth0Id=s,r.auth0_id=s);let c=e.siteCode||i.siteCode;c&&(r.siteCode=c);let u=e.clientCode||i.clientCode;u&&(r.clientCode=u);let d=e.source||i.source;return d&&(r.source=d),r}},{sourceType:"dom",sourceEventName:"onActionShown",targetEventName:"action_shown",payloadMapper:n=>{let t=(n.detail||{}).EventData||{},i={1:"Paywall",2:"Newsletter",3:"Registration",4:"Redirect",5:"InArticle",6:"Custom"},r=null;try{t.UserDefinedData&&(r=JSON.parse(t.UserDefinedData))}catch{r=t.UserDefinedData}return(t.Id||t.Name)&&mi({actionId:t.Id,actionName:t.Name,ActionId:t.Id,ActionName:t.Name}),{actionId:t.Id,actionName:t.Name,actionDescription:t.Description,actionType:t.ActionType||i[t.ActionTypeId]||"",userDefinedData:JSON.stringify(r),_sdk_auto_tracked:!0}}},{sourceType:"dom",sourceEventName:"click",targetEventName:"click_action",payloadMapper:n=>{let e=n.target;if(!e)return null;let t=e,i=null;for(;t&&t!==document.body;){if(t.hasAttribute("data-mg2-action")){i=t.getAttribute("data-mg2-action");break}t=t.parentElement}if(!i||["login","activation","register","logout","subscribe","click"].indexOf(i.toLowerCase())===-1)return null;let s={login:"Login",activation:"Activate",register:"Register",logout:"Logout",subscribe:"Subscribe",click:"CheckoutStart"}[i.toLowerCase()]||i,c=null,u=null,d=null,g=t;for(;g&&g!==document.body;){let M=g.getAttribute&&g.getAttribute("href");if(M&&M!=="#"){c=M;try{let mn=new URL(M,window.location.href).searchParams;u=mn.get("G2I_ActionId"),d=mn.get("ofrgp_id")}catch{}break}g=g.parentElement}let m=null,v=null,b=window,E=b.CnnXt||b.Connext;if(E){if(E.GetCurrentConversation){let M=E.GetCurrentConversation();M&&(m=M.Name)}if(E.GetCurrentConversationViewCount){let M=E.GetCurrentConversationViewCount();M!==null&&(v=M+"")}}let w=ve.getContext(),K=m||w.conversationName||null,P=v||(w.conversationViews!=null?String(w.conversationViews):null),te=w.actionName||w.ActionName||null,Ee=u||w.actionId||w.ActionId||null;return{ClickAction:s,ActionName:te,ActionId:Ee,ButtonText:(e.textContent||e.innerText||"").replace(/\s+/g," ").trim(),ConversationName:K,ArticleViews:P,ClickDestination:c,DestinationActionId:u,DestinationOfferGroupId:d,_sdk_auto_tracked:!0}}},{sourceType:"knockout",sourceEventName:"presentation_loaded_e",targetEventName:"checkout_started",payloadMapper:n=>{let e={...Bn(n||{}),_sdk_auto_tracked:!0};if(n&&n.promotionsList){let t=xa(n.promotionsList);t!==void 0&&(e.sp_pid=t)}return n&&n.params&&n.params.presentationName&&(e.sp_presentationName=n.params.presentationName),n&&n.internalSessionId&&(e.internalSessionId=n.internalSessionId),e}},{sourceType:"knockout",sourceEventName:"offers_presented_e",targetEventName:"offers_presented",payloadMapper:n=>{let e={...Bn(n||{}),_sdk_auto_tracked:!0},t=n&&n.offers?n.offers:[],i=[],r=[],a=[];return t.forEach(s=>{let{id:c,planName:u}=Hn(s);i.push(c),r.push(u),a.push(c+":"+u)}),e.sp_offerIds=i.toString(),e.sp_offerPlanNames=r.toString(),e.sp_offerPlanConcat=a.toString(),n&&n.params&&n.params.presentationName&&(e.sp_presentationName=n.params.presentationName),n&&n.internalSessionId&&(e.internalSessionId=n.internalSessionId),e}},{sourceType:"knockout",sourceEventName:"offer_selected_e",targetEventName:"offer_selected",payloadMapper:n=>({...rt(n||{}),_sdk_auto_tracked:!0})},{sourceType:"knockout",sourceEventName:"created_new_user_e",targetEventName:"new_registration",payloadMapper:n=>({...rt(n||{}),_sdk_auto_tracked:!0})},{sourceType:"knockout",sourceEventName:"user_info_completed_e",targetEventName:"user_info_completed",payloadMapper:n=>({...rt(n||{}),_sdk_auto_tracked:!0})},{sourceType:"knockout",sourceEventName:"delivery_address_completed_e",targetEventName:"delivery_address_completed",payloadMapper:n=>({...rt(n||{}),_sdk_auto_tracked:!0})},{sourceType:"knockout",sourceEventName:"billing_address_completed_e",targetEventName:"billing_address_completed",payloadMapper:n=>({...rt(n||{}),_sdk_auto_tracked:!0})},{sourceType:"knockout",sourceEventName:"add_subscription_success_e",targetEventName:"subscription_success",payloadMapper:n=>{let e=n||{},t=e.offer||{},i=e.subscription||{},{id:r,planName:a,price:s,type:c}=Hn(t),u={sp_offerId:r,sp_offerPlanName:a,sp_offerType:c,_sdk_auto_tracked:!0};return s!==void 0&&(u.sp_offerPrice=s),i.EventId&&(u.sp_subEventId=i.EventId),i.AccountNumber&&(u.sp_accountNumber=i.AccountNumber),i.PaymentAuthorizationCode&&(u.sp_paymentAuthorizationCode=i.PaymentAuthorizationCode),i.SubscriptionID&&(u.sp_subSubscriptionId=i.SubscriptionID),i.SubscriberID&&(u.sp_subSubscriberId=i.SubscriberID),i.RedirectUrl&&(u.sp_redirectUrl=i.RedirectUrl),e.params&&e.params.presentationName&&(u.sp_presentationName=e.params.presentationName),e.internalSessionId&&(u.internalSessionId=e.internalSessionId),u}},...["credit_card","bank_account","bill_me","apple_pay","paypal"].map(n=>({sourceType:"knockout",sourceEventName:`${n}_completed_e`,targetEventName:"payment_completed",payloadMapper:e=>{let t={credit_card:"Credit Card",bank_account:"Bank Account",bill_me:"Bill Me",apple_pay:"Apple Pay",paypal:"Paypal"},i=rt(e||{});return i.sp_paymentType=t[n]||"",i._sdk_auto_tracked=!0,i}}))];y();var Ia={"naviga-relay":hi},Da=new Set;
1function Vn(n){try{if(typeof n!="string")return[];let e=n.trim();if(e===""||e.toLowerCase()==="none"||e.toLowerCase()==="off")return[];let t=Ia[e];return t||(Da.has(e)||(Da.add(e),o.warnAlways(`[Analytics] Unknown custom-event preset '${e}' \u2014 no auto-tracking bindings were registered. Known presets: ${Object.keys(Ia).join(", ")}.`)),[])}catch{return[]}}var zc=",",Ma="naviga-data-attributes";function Kc(n){if(n===null)return null;try{let e=JSON.parse(n);return!e||typeof e!="object"||Array.isArray(e)?null:e}catch{return null}}function jc(n){return n.split(zc).map(e=>e.trim()).filter(e=>e!=="")}function qc(n){try{if(!n||typeof n.getAttribute!="function")return null;let e={},t=n.getAttribute("data-site");t!==null&&(e.site=t);let i=n.getAttribute("data-api-base-url");i!==null&&(e.api_base_url=i);let r=n.getAttribute("data-preset");r!==null&&(e.preset=r);let a=Kc(n.getAttribute("data-auto-context")),s=n.getAttribute("data-article-paths");if(s!==null){let v=a!=null?a:{};v.articlePaths=jc(s),e.autoContext=v}else a&&(e.autoContext=a);let c=n.getAttribute("data-publication-id");c!==null&&(e.publication_id=c);let u=n.getAttribute("data-organisation-name");u!==null&&(e.organisation_name=u);let d=n.getAttribute("data-publication-name");d!==null&&(e.publication_name=d);let g=n.getAttribute("data-organisation-id");g!==null&&(e.organisation_id=g);let m=n.getAttribute("data-page-class");return m!==null&&(e.pageClass=m),Object.keys(e).length>0?e:null}catch{return null}}var vi=null,La=!1;function Na(){if(!La){La=!0;try{vi=qc(document.currentScript)}catch{vi=null}}}function $n(){return vi}function Ua(n){let e=vi;if(!e)return n;let t=n&&typeof n=="object"?{...n}:{};for(let i of Object.keys(e))t[i]===void 0&&(t[i]=e[i]);return t}var Q=typeof window!="undefined"&&typeof document!="undefined";Q&&(Sa(),ua());var vc=new me(()=>Promise.resolve().then(()=>(Oi(),Ui)),{message:"Failed to load PageViewTracker module",severity:"medium",source:"LazyLoad.PageViewTracker"}),Md=new me(()=>Promise.resolve().then(()=>(Fi(),ms)),{message:"Failed to load LeavePageTracker module",severity:"medium",source:"LazyLoad.LeavePageTracker"}),pn=new me(()=>Promise.resolve().then(()=>(bs(),ys)),{message:"Failed to load ClickTracker module",severity:"low",source:"LazyLoad.ClickTracker"}),Yr=!1;function W_(){Yr=!1}var yc=typeof ie.API_BASE_URL=="string"?ie.API_BASE_URL.trim():"";function Nd(n){return l(()=>{var c,u;let e={...n},t=[],i=pa(n);t.push(...i.notices),i.organisation_name!==void 0&&(e.organisation_name=i.organisation_name),i.publication_name!==void 0&&(e.publication_name=i.publication_name),n.publication_id===void 0&&typeof e.publication_name=="string"&&e.publication_name.trim()!==""&&(e.publication_id=e.publication_name),(typeof n.api_base_url=="string"?n.api_base_url.trim():"")===""&&yc!==""&&(e.api_base_url=yc),Ud(e.api_base_url,t);let a=e.customEvents?{...e.customEvents}:{};if(!(e.preset==="none"||e.preset==="off"||a.preset==="none"||a.preset==="off"||a.enabled===!1)){let d=(u=(c=e.preset)!=null?c:a.preset)!=null?u:"naviga-relay",g=Vn(d);if(g.length>0){let m=Array.isArray(a.bindings)?a.bindings:[];a.bindings=[...m,...g]}a.commonDetailsMapping===void 0&&(a.commonDetailsMapping={variableName:"navigaEngageDetails"}),a.linkerHosts===void 0&&(a.linkerHosts=[".subscriberconcierge.com"]),e.customEvents=a}return{config:e,notices:t}},{config:n,notices:[]})}function Ud(n,e){l(()=>{if(typeof n!="string"||n.trim()==="")return;let t=null;try{t=new URL(n)}catch{t=null}if(!t){e.push(`[Analytics] api_base_url '${n}' is not an absolute URL \u2014 every request the SDK makes will fail. Expected e.g. 'https://ingest.example.com'.`);return}t.protocol!=="https:"&&e.push(`[Analytics] api_base_url '${n}' is not https. Using it as given (http is expected for local development), but production traffic should be https.`)},void 0)}var Je={init:n=>{_(()=>{let e=Ua(n.initOptions),t=Nd(e);f.set(t.config),t.notices.forEach(r=>o.warn(r)),o.info("Analytics initialized with config:",f.get()),o.info("Ingestion base URL:",f.getValue("api_base_url")||"(not configured)"),o.info("SDK health telemetry enabled:",f.isSdkHealthEnabled());let i=e.pageLeaveTracking||e.pageLeaveConfig;i&&(f.setPageLeaveConfig(i),o.info("Page leave tracking config:",f.getPageLeaveConfig())),e.heartbeatConfig&&(f.setHeartbeatConfig(e.heartbeatConfig),o.info("Heartbeat config:",f.getHeartbeatConfig())),e.abTesting&&(f.setABConfig(e.abTesting),o.info("A/B testing config:",f.getABConfig())),e.contentReadiness&&(f.setContentReadinessConfig(e.contentReadiness),o.info("Content readiness config:",f.getContentReadinessConfig())),e.eventQueue&&(f.
1setEventQueueConfig(e.eventQueue),o.info("Event queue config:",f.getEventQueueConfig())),e.clickTracking&&(f.setClickTrackingConfig(e.clickTracking),o.info("Click tracking config:",f.getClickTrackingConfig())),e.autoContext&&(f.setAutoContextConfig(e.autoContext),o.info("Auto context config:",f.getAutoContextConfig())),e.spaNavigation&&(f.setSpaNavigationConfig(e.spaNavigation),o.info("SPA navigation config:",f.getSpaNavigationConfig())),e.telemetry&&(f.setTelemetryConfig(e.telemetry),o.info("Telemetry config:",f.getTelemetryConfig())),e.articleDetailsMapping&&o.info("Article details will be read from:",e.articleDetailsMapping.variableName,e.articleDetailsMapping.path||"(root)"),e.userDetailsMapping&&o.info("User details will be read from:",e.userDetailsMapping.variableName,e.userDetailsMapping.path||"(root)"),ni.validate(e),Q&&e.preload!==!1&&setTimeout(()=>{Ie.preload(),se.preload(),vc.preload(),Md.preload(),pn.preload()},1e3),Q&&Promise.resolve().then(()=>(Ei(),za)).then(r=>r.EventQueue.init()).catch(r=>o.error("[Analytics] Failed to load EventQueue:",r)),Je.initializeHeartbeatTracking(),Je.initializeABTesting(),Je.initializeContentReadiness(),Je.initializeCustomEventBindings(),Je.initializeCrossDomainLinker(),In("init() completed")},{message:"Failed to initialize analytics",severity:"high",source:"Analytics.init"})},disableEvents:n=>{_(()=>{f.disable_set({DisableOption:n.DisableOption}),o.info(" Disable flag:",f.disable_get())},{message:"Failed to disable analytics",severity:"high",source:"Analytics.disableEvents"})},track:(n,e={})=>{if(Q){if(typeof n!="string"||n.trim()===""){o.warn("[Analytics] track() called without a valid event name; ignoring");return}C(async()=>{let[{EventFactory:t},{EventSender:i},{CustomEventPayload:r}]=await Promise.all([Promise.resolve().then(()=>(le(),It)),Promise.resolve().then(()=>(Se(),xt)),Promise.resolve().then(()=>(Wi(),Rr))]),a=r.withCommonProperties(e||{}),s=await t.createEvent(n.trim(),a,{skipArticleContext:!0});if(!s.success)throw new Error(`Failed to create custom event ${n}`);if(s.value===null)return!1;let c=r.stripArticleFields(s.value);return await i.send(r.applyExclusions(c)),!0},{message:`Failed to track custom event ${n}`,severity:"low",source:"Analytics.track"})}},identify:(n,e={})=>{if(Q){if(typeof n!="string"||n.trim()===""){o.warn("[Analytics] identify() called without a valid userId; ignoring");return}l(()=>De.set(n,e||{}),void 0),C(async()=>{let[{EventFactory:t},{EventSender:i},{CustomEventPayload:r}]=await Promise.all([Promise.resolve().then(()=>(le(),It)),Promise.resolve().then(()=>(Se(),xt)),Promise.resolve().then(()=>(Wi(),Rr))]),a=await t.createEvent("identify",e||{},{skipArticleContext:!0});if(!a.success)throw new Error("Failed to create identify event");return a.value===null?!1:(await i.send(r.stripArticleFields(a.value)),!0)},{message:"Failed to identify user",severity:"low",source:"Analytics.identify"})}},reset:()=>{l(()=>De.clear(),void 0)},setPageClass:n=>{l(()=>q.setPageClass(n),void 0)},setContentAccess:n=>{l(()=>he.set(n),void 0)},getConfig:()=>l(()=>f.get(),{organisation_name:"",publication_name:"",publication_id:"",api_base_url:"",api_key:""}),trackPageView:()=>{if(!Q)return;let n=()=>{C(async()=>{let e=await vc.get();if(!e.success)throw new Error("Failed to load PageViewTracker module");return await e.value.PageViewTracker.track()},{message:"Failed to track page view",severity:"medium",source:"Analytics.trackPageView"})};document.readyState==="complete"?n():window.addEventListener("load",n)},initializeLeavePageTracking:()=>{Q&&_(()=>{let n=f.getPageLeaveConfig();o.info("[Analytics] Initializing page leave tracking with config:",n),Promise.resolve().then(()=>(Ss(),Es)).then(e=>{e.PageLeaveCoordinator.initialize({hiddenPageTimeout:n.hiddenPageTimeout,enableSPATracking:n.enableSPATracking,enableVisibilityTracking:n.enableVisibilityTracking,trackHashChanges:n.trackHashChanges}),o.info("[Analytics] PageLeaveCoordinator initialized successfully")}).catch(e=>{o.error("[Analytics] Failed to load PageLeaveCoordinator:",e)})},{message:"Failed to initialize page leave tracking",severity:"medium",s
1ource:"Analytics.initializeLeavePageTracking"})},initializeHeartbeatTracking:()=>{Q&&_(()=>{let n=f.getHeartbeatConfig();o.info("[Analytics] Initializing heartbeat tracking with config:",n),Promise.resolve().then(()=>(xs(),Rs)).then(e=>{e.HeartbeatPingCoordinator.initialize({enabled:n.enabled,pingIntervalSeconds:n.ping_interval_seconds,sendOnVisibilityChange:n.send_on_visibility_change,minActiveTimeForVisibilityPing:n.min_active_time_for_visibility_ping,visibilityDebounceMs:n.visibility_debounce_ms,enableSPATracking:n.enable_spa_tracking,pingDecaySchedule:(n.ping_decay_schedule||[]).map(t=>({afterSeconds:t.after_seconds,intervalSeconds:t.interval_seconds})),pingSamplingRate:n.ping_sampling_rate}),n.enabled?(e.HeartbeatPingCoordinator.start(),o.info("[Analytics] HeartbeatPingCoordinator started successfully")):o.info("[Analytics] HeartbeatPingCoordinator initialized but disabled")}).catch(e=>{o.error("[Analytics] Failed to load HeartbeatPingCoordinator:",e)})},{message:"Failed to initialize heartbeat tracking",severity:"medium",source:"Analytics.initializeHeartbeatTracking"})},trackClickEvents:()=>{if(!Q)return;let n=()=>{Yr||(Yr=!0,document.addEventListener("click",e=>{let t=e.target;if(!t||e.button===1)return;let i={button:e.button,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey};C(async()=>{let r=await pn.get();if(!r.success)throw new Error("Failed to load ClickTracker module");return await r.value.ClickTracker.trackClick(t,!1,i)},{message:"Failed to handle click event",severity:"low",source:"Analytics.handleClick"})}),document.addEventListener("auxclick",e=>{let t=e.target;if(!t||e.button!==1)return;let i={button:e.button,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey};C(async()=>{let r=await pn.get();if(!r.success)throw new Error("Failed to load ClickTracker module");return await r.value.ClickTracker.trackClick(t,!1,i)},{message:"Failed to handle middle-click event",severity:"low",source:"Analytics.handleMiddleClick"})}),document.addEventListener("contextmenu",e=>{let t=e.target;t&&C(async()=>{let i=await pn.get();if(!i.success)throw new Error("Failed to load ClickTracker module");return await i.value.ClickTracker.trackClick(t,!0)},{message:"Failed to handle right-click event",severity:"low",source:"Analytics.handleRightClick"})}))};document.readyState==="complete"?n():window.addEventListener("load",n)},initializeABTesting:()=>{Q&&f.getABConfig().enabled&&_(()=>{Promise.resolve().then(()=>(rc(),nc)).then(n=>n.ABTesting.start()).catch(n=>o.error("[Analytics] Failed to load ab-testing chunk:",n))},{message:"Failed to initialize A/B testing",severity:"low",source:"Analytics.initializeABTesting"})},initializeContentReadiness:()=>{Q&&f.getContentReadinessConfig().enabled&&_(()=>{let n=f.getContentReadinessConfig();Promise.resolve().then(()=>(pc(),gc)).then(e=>e.ContentReadinessAuditor.initialize(n)).catch(e=>o.error("[Analytics] Failed to load ContentReadinessAuditor:",e))},{message:"Failed to initialize content readiness auditor",severity:"low",source:"Analytics.initializeContentReadiness"})},initializeCustomEventBindings:()=>{Q&&_(()=>{let n=f.getCustomEventBindings();n&&n.length>0&&Promise.resolve().then(()=>(qr(),jr)).then(e=>{e.CustomEventTracker.initBindings(bc)}).catch(e=>o.error("[Analytics] Failed to load CustomEventTracker:",e))},{message:"Failed to initialize custom event bindings",severity:"low",source:"Analytics.initializeCustomEventBindings"})},initializeCrossDomainLinker:()=>{Q&&_(()=>{f.getCrossDomainLinkerHosts().length!==0&&Promise.resolve().then(()=>(Qr(),Wr)).then(n=>n.CrossDomainLinker.install()).catch(n=>o.error("[Analytics] Failed to load CrossDomainLinker:",n))},{message:"Failed to initialize cross-domain linker",severity:"low",source:"Analytics.initializeCrossDomainLinker"})},getErrorLogs:()=>l(()=>V.getErrors(),[]),clearErrorLogs:()=>{l(()=>V.clearErrors(),void 0)}},mt=ma(Je),bc=Ra(Je.track);function Od(){$n()&&(o.info("[Analytics] No init() call; applying data-* configuration from the script tag"),mt.init({name:Ma,initOptions:{}}))}Q&&ra()&&(_(()=>{Na()},{message:"Failed to read data-* configuration from the script tag",severity:"low",source:"Analytics.captureScriptData"}),_(()=>{var i;let n=(i=$n())==null?void 0:i.preset;if(n==="none"||n==="off")return;let t=Vn(n||"naviga-relay");t.length!==0&&Promise.resolve().then(()=>(qr(),jr)).then(r=>r.CustomEventTracker.initBindings(bc,t)).catch(r=>o.error("[Analytics] Failed to load CustomEventTracker:",r))},{message:"Failed to register default custom event bindings",severity:"low",source:"Analytics.presetBindings"}),_(()=>{typeof document!="undefined"&&Promise.resolve().then(()=>(Qr(),Wr)).then(n=>
1n.CrossDomainLinker.install()).catch(n=>o.error("[Analytics] Failed to load CrossDomainLinker at module load:",n))},{message:"Failed to pre-install cross-domain linker",severity:"low",source:"Analytics.preInstallLinker"}),_(()=>{Promise.resolve().then(()=>(hc(),mc)).then(n=>{n.CacheInvalidationManager.initialize(),o.info("[Analytics] CacheInvalidationManager initialized successfully")}).catch(n=>{o.error("[Analytics] Failed to load CacheInvalidationManager:",n)})},{message:"Failed to initialize cache invalidation",severity:"low",source:"Analytics.initCacheInvalidation"}),_(()=>{Zt(()=>{mt.trackPageView(),mt.initializeLeavePageTracking(),mt.trackClickEvents()}),aa(Rn,Od)},{message:"Failed to initialize automatic tracking",severity:"medium",source:"Analytics.autoInit"}),_(()=>{window.NavigaAnalytics=mt,mt.NavigaRelayPreset=hi},{message:"Failed to expose Analytics globally",severity:"low",source:"global.expose"}));})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.