(function () { const STORAGE_KEY = "csa_cookie_preferences_v3"; const CONSENT_VERSION = "2026-03-26"; function gtag() { window.dataLayer = window.dataLayer || []; window.dataLayer.push(arguments); } function defaultConsent() { return { version: CONSENT_VERSION, updated_at: null, categories: { necessary: true, measurement: false, preferences: false } }; } function loadSavedConsent() { try { const raw = localStorage.getItem(STORAGE_KEY); if (!raw) { return defaultConsent(); } const parsed = JSON.parse(raw); return { version: parsed.version || CONSENT_VERSION, updated_at: parsed.updated_at || null, categories: { necessary: true, measurement: !!(parsed.categories && parsed.categories.measurement), preferences: !!(parsed.categories && parsed.categories.preferences) } }; } catch (err) { return defaultConsent(); } } function saveConsent(consent) { const payload = { version: CONSENT_VERSION, updated_at: new Date().toISOString(), categories: { necessary: true, measurement: !!consent.categories.measurement, preferences: !!consent.categories.preferences } }; localStorage.setItem(STORAGE_KEY, JSON.stringify(payload)); return payload; } function applyConsent(consent) { gtag("consent", "update", { ad_storage: "denied", ad_user_data: "denied", ad_personalization: "denied", analytics_storage: consent.categories.measurement ? "granted" : "denied", functionality_storage: consent.categories.preferences ? "granted" : "denied", security_storage: "granted" }); maybeLoadGtm(consent); } function maybeLoadGtm(consent) { const cfg = window.CSA_SITE_CONFIG || {}; if (!consent.categories.measurement) { return; } if (!cfg.gtmId || cfg.gtmId === "GTM-PLACEHOLDER") { return; } if (document.getElementById("csa-gtm-script")) { return; } const script = document.createElement("script"); script.id = "csa-gtm-script"; script.async = true; script.src = "https://www.googletagmanager.com/gtm.js?id=" + encodeURIComponent(cfg.gtmId); document.head.appendChild(script); } function bannerHtml() { return ( '
' + 'Necessary cookies stay enabled for security and session integrity. Measurement and preference cookies stay off until you choose otherwise. You can review this choice at any time from the footer or the legal page.' + '
' + '