{"version":3,"file":"ConsentGate.B1TbFDlL.mjs","names":["React.useState","React.useCallback","React.forwardRef","__esmMin","init_ssg_sandbox_shims","te","ne","init_npm_react_18_3_1","window","init_jsx_runtime","J","ce","_e","init_framer_DDfsYcI0","RenderTarget","isGrantedSignal","value","toConsentModeSignal","readConsentRecordFromStorage","rawValue","win","CONSENT_STORAGE_KEY","parsed","readConsentStateFromStorage","record","hasEmbedConsent","state","readConsentGranted","useConsent","granted","setGranted","refreshConsent","nextGranted","previousValue","onStorage","event","intervalId","grantEmbedConsent","didPersistGrant","persistedRecord","nextRecord","CONSENT_DISMISSED_STORAGE_KEY","confirmedState","confirmedDismissed","consentUpdatePayload","winRecord","dataLayer","consentArgs","options","withConsentGate","hasConsent","Component","props","withConsentRequired","withGrantEmbedConsent","handleClick","handleKeyDown","withGrantEmbedConsentInPlace","init_ConsentGate"],"sources":["https:/framerusercontent.com/modules/MsGDfiRNBLmiaWSEvCIk/i4WM8QZU3P0igQD81WWe/ConsentGate.js"],"sourcesContent":["/**\n * User request:\n * Create Utility/ConsentGate.tsx overrides:\n * - withConsentGate: show placeholder only when consent is missing\n * - withConsentRequired: show embed only when consent is granted\n * - withGrantEmbedConsent: grant embed-required consent from an in-page control\n *\n * Consent detection policy (strict / fail-closed):\n * This file reads consent only from localStorage key `framerCookiesConsentMode`.\n * The previous heuristic scan of globals, cookies, and dataLayer was removed because\n * it could report consent that was never explicitly granted.\n *\n * If the banner's key name or value shape changes, update this file and\n * Utility/ConsentCookieManager.tsx together. Verify with ConsentCookieManager Audit Mode\n * and a decline-everything test.\n *\n * Observed regional-default behavior from Framer's Cookie Banner:\n * EU visitors default to analytics/marketing denied, while rest-of-world visitors\n * default to all categories granted. These gates therefore block by default only in\n * regions where the banner defaults to denied.\n */import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{RenderTarget}from\"framer\";const CONSENT_STORAGE_KEY=\"framerCookiesConsentMode\";const CONSENT_DISMISSED_STORAGE_KEY=\"framerCookiesDismissed\";function isGrantedSignal(value){if(value===true)return true;if(typeof value!==\"string\")return false;return value.trim().toLowerCase()===\"granted\";}function toConsentModeSignal(value){return value?\"granted\":\"denied\";}function readConsentRecordFromStorage(win){try{const rawValue=win.localStorage.getItem(CONSENT_STORAGE_KEY);if(!rawValue)return{};const parsed=JSON.parse(rawValue);if(!parsed||typeof parsed!==\"object\"||Array.isArray(parsed)){return{};}return parsed;}catch{return{};}}function readConsentStateFromStorage(win){const record=readConsentRecordFromStorage(win);return{analytics:isGrantedSignal(record.analytics),marketing:isGrantedSignal(record.marketing),preferences:isGrantedSignal(record.preferences)};}function hasEmbedConsent(state){return state.analytics&&state.marketing;}function readConsentGranted(win){const state=readConsentStateFromStorage(win);return hasEmbedConsent(state);}function useConsent(){const[granted,setGranted]=React.useState(false);const refreshConsent=React.useCallback(()=>{if(typeof window===\"undefined\")return;let nextGranted=false;try{nextGranted=readConsentGranted(window);}catch{nextGranted=false;}React.startTransition(()=>{setGranted(previousValue=>previousValue===nextGranted?previousValue:nextGranted);});},[]);React.useEffect(()=>{if(typeof window===\"undefined\")return;refreshConsent();const onStorage=event=>{if(event.key!==CONSENT_STORAGE_KEY)return;refreshConsent();};window.addEventListener(\"storage\",onStorage);const intervalId=window.setInterval(()=>{refreshConsent();},500);return()=>{window.removeEventListener(\"storage\",onStorage);window.clearInterval(intervalId);};},[refreshConsent]);return granted;}function grantEmbedConsent(options){if(typeof window===\"undefined\")return;let didPersistGrant=false;let persistedRecord=null;// Persist consent first. If this fails, do not reload: reloading without a stored\n// grant would immediately redisplay the notice and look broken.\ntry{const existingRecord=readConsentRecordFromStorage(window);const nextRecord={...existingRecord,// Deliberately preserve existing `preferences` as-is. The visitor asked to view\n// an embed, not to opt into all optional categories.\nanalytics:true,marketing:true};if(!(\"necessary\"in nextRecord)){nextRecord.necessary=true;}window.localStorage.setItem(CONSENT_STORAGE_KEY,JSON.stringify(nextRecord));// Observed Framer banner storage contract:\n// - `framerCookiesConsentMode` stores category choices\n// - `framerCookiesDismissed` must be \"true\" once a visitor has answered\n//\n// If `framerCookiesDismissed` is absent, the banner treats the visitor as undecided\n// and rewrites consent mode to all-false on next load. This pair is undocumented and\n// discovered by observation; if Framer changes it, embed consent will silently revert.\nwindow.localStorage.setItem(CONSENT_DISMISSED_STORAGE_KEY,\"true\");persistedRecord=nextRecord;const confirmedState=readConsentStateFromStorage(window);const confirmedDismissed=window.localStorage.getItem(CONSENT_DISMISSED_STORAGE_KEY)===\"true\";didPersistGrant=hasEmbedConsent(confirmedState)&&confirmedDismissed;}catch{didPersistGrant=false;persistedRecord=null;}if(!didPersistGrant||!persistedRecord)return;try{// Deliberate behavior: this grants embed-required consent site-wide, not per embed.\n// The cookie banner is bypassed here, so we must explicitly push a Consent Mode\n// update to GTM now; otherwise consent-gated tags can stay blocked until reload.\nconst consentUpdatePayload={analytics_storage:toConsentModeSignal(isGrantedSignal(persistedRecord.analytics)),ad_storage:toConsentModeSignal(isGrantedSignal(persistedRecord.marketing)),ad_user_data:toConsentModeSignal(isGrantedSignal(persistedRecord.marketing)),ad_personalization:toConsentModeSignal(isGrantedSignal(persistedRecord.marketing)),functionality_storage:toConsentModeSignal(isGrantedSignal(persistedRecord.preferences)),personalization_storage:toConsentModeSignal(isGrantedSignal(persistedRecord.preferences))};const winRecord=window;if(!Array.isArray(winRecord.dataLayer)){winRecord.dataLayer=[];}const dataLayer=winRecord.dataLayer;const buildGtagStyleArguments=function(scope,action,payload){return arguments;};const consentArgs=buildGtagStyleArguments(\"consent\",\"update\",consentUpdatePayload);dataLayer.push(consentArgs);dataLayer.push({event:\"cpi_consent_update\"});}catch{// Silent by design\n}/**\n     * Reload rationale and tested history:\n     * The reload exists so the cookie banner, consent gates, and GTM all converge on the\n     * stored consent in one step. Without reloading, the banner keeps stale in-memory state\n     * for the rest of the page view, so if opened immediately after embed-accept it can still\n     * show Analytics/Marketing as off despite the just-written persisted record.\n     *\n     * A reload was tried earlier and appeared to fail (consent gone after refresh, embed still\n     * blocked). The cause was not the reload itself: only `framerCookiesConsentMode` was being\n     * written, without `framerCookiesDismissed`, so the banner treated the visitor as undecided\n     * and reset categories on fresh load. With both keys written, the grant survives and reload\n     * now achieves the intended convergence.\n     *\n     * Also tested and rejected before the cause was understood:\n     * - Forcing banner remount by changing React key: re-initialised banner and overwrote grant.\n     * - Dispatching a synthetic same-tab `StorageEvent`: banner ignored it.\n     */if(options.reload){window.setTimeout(()=>window.location.reload(),150);}}export function withConsentGate(Component){const Wrapped=/*#__PURE__*/React.forwardRef(function Wrapped(props,ref){const hasConsent=useConsent();const isCanvas=RenderTarget.current()===RenderTarget.canvas;if(!isCanvas&&hasConsent)return null;return /*#__PURE__*/_jsx(Component,{ref:ref,...props});});return Wrapped;}export function withConsentRequired(Component){const Wrapped=/*#__PURE__*/React.forwardRef(function Wrapped(props,ref){const hasConsent=useConsent();const isCanvas=RenderTarget.current()===RenderTarget.canvas;if(!isCanvas&&!hasConsent)return null;return /*#__PURE__*/_jsx(Component,{ref:ref,...props});});return Wrapped;}// Removed overrides:\n// `withOpenCookieSettings` and `withReopenCookieBanner` were removed because the project's\n// Cookie Banner already exposes a supported settings trigger via its own `trigger` property.\n// If a custom control is ever needed, the known working approach is to remove\n// `framerCookiesDismissed` from localStorage and reload so the banner remounts as undecided,\n// but the built-in Cookie Banner trigger should be preferred.\n// Durable grant note:\n// This override writes both `framerCookiesConsentMode` and `framerCookiesDismissed`, which\n// makes the embed-consent grant durable across refreshes in current Framer behavior.\n// It still depends on an undocumented storage contract discovered by observation; if Framer\n// changes either key name or value shape, the symptom will be silent reversion after refresh.\n// If that happens, re-diff localStorage before/after a real banner choice to re-derive the\n// contract. This grant is site-wide for analytics/marketing and intentionally leaves\n// `preferences` unchanged.\n//\n// Behavior split (deliberate):\n// - `withGrantEmbedConsent` reloads so the cookie banner, the consent gates and GTM all\n//   converge on the stored record immediately. Without a reload, the banner keeps stale\n//   internal state for the rest of the page view, so a visitor who opens it straight after\n//   accepting sees Analytics and Marketing still switched off, contradicting what was written.\n// - `withGrantEmbedConsentInPlace` skips the reload, so the embed appears instantly with no\n//   page interruption, at the cost of that stale banner state until the visitor's next page\n//   load. The stored consent record is correct either way — only the banner display lags.\n//\n// Both overrides are in use deliberately: the YouTube embed component uses the reloading\n// version and the Vimeo embed component uses the in-place version, so any inconsistency there\n// is by design rather than an oversight.\nexport function withGrantEmbedConsent(Component){const Wrapped=/*#__PURE__*/React.forwardRef(function Wrapped(props,ref){const handleClick=React.useCallback(event=>{props.onClick?.(event);if(event.defaultPrevented)return;// This override is commonly applied to a Button instance with a `link` prop.\n// If that link is unset/self-referencing, the element's default click action\n// can still navigate/reload and tear down the page before consent persists.\n// This control is intended to act in-place (grant consent), not navigate.\nevent.preventDefault();grantEmbedConsent({reload:true});},[props]);const handleKeyDown=React.useCallback(event=>{props.onKeyDown?.(event);if(event.defaultPrevented)return;if(event.key===\"Enter\"||event.key===\" \"){event.preventDefault();grantEmbedConsent({reload:true});}},[props]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:handleClick,onKeyDown:handleKeyDown});});return Wrapped;}export function withGrantEmbedConsentInPlace(Component){const Wrapped=/*#__PURE__*/React.forwardRef(function Wrapped(props,ref){const handleClick=React.useCallback(event=>{props.onClick?.(event);if(event.defaultPrevented)return;event.preventDefault();grantEmbedConsent({reload:false});},[props]);const handleKeyDown=React.useCallback(event=>{props.onKeyDown?.(event);if(event.defaultPrevented)return;if(event.key===\"Enter\"||event.key===\" \"){event.preventDefault();grantEmbedConsent({reload:false});}},[props]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:handleClick,onKeyDown:handleKeyDown});});return Wrapped;}// Historical note:\n// A remount-based banner-sync override was tried and then removed. Remounting caused\n// Framer's cookie banner to re-initialize and overwrite granted consent with defaults,\n// so the gated video never appeared and the stored record was reverted.\n// A synthetic same-tab StorageEvent dispatch was also tested and removed because the\n// banner did not react to it.\n\nexport const __FramerMetadata__ = {\"exports\":{\"withConsentRequired\":{\"type\":\"reactHoc\",\"name\":\"withConsentRequired\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withGrantEmbedConsentInPlace\":{\"type\":\"reactHoc\",\"name\":\"withGrantEmbedConsentInPlace\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withConsentGate\":{\"type\":\"reactHoc\",\"name\":\"withConsentGate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withGrantEmbedConsent\":{\"type\":\"reactHoc\",\"name\":\"withGrantEmbedConsent\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ConsentGate.map"],"mappings":"A,+MAoB6N,SAASe,EAAgB,EAAM,CAAqE,OAAjEC,IAAQ,IAAoB,OAAOA,GAAQ,UAA6BA,EAAM,KAAK,CAAC,CAAC,YAAY,IAAI,SAAU,CAAC,SAASC,EAAoB,EAAM,CAAC,OAAOD,EAAM,UAAU,QAAS,CAAC,SAASE,EAA6B,EAAI,CAAC,GAAG,CAAC,IAAMC,EAASC,EAAI,aAAa,QAAQC,CAAmB,EAAE,GAAG,CAACF,EAAS,MAAM,CAAC,EAAE,IAAMG,EAAO,KAAK,MAAMH,CAAQ,EAAyE,MAApE,CAACG,GAAQ,OAAOA,GAAS,UAAU,MAAM,QAAQA,CAAM,EAAS,CAAC,EAAUA,CAAO,MAAM,CAAC,MAAM,CAAC,CAAE,CAAC,CAAC,SAASC,EAA4B,EAAI,CAAC,IAAMC,EAAON,EAA6BE,CAAG,EAAE,MAAM,CAAC,UAAUL,EAAgBS,EAAO,SAAS,EAAE,UAAUT,EAAgBS,EAAO,SAAS,EAAE,YAAYT,EAAgBS,EAAO,WAAW,CAAC,CAAE,CAAC,SAASC,EAAgB,EAAM,CAAC,OAAOC,EAAM,WAAWA,EAAM,SAAU,CAAC,SAASC,EAAmB,EAAI,CAA8C,OAAOF,EAAxCF,EAA4BH,CAAgC,CAAC,CAAE,CAAC,SAASQ,GAAY,CAAC,GAAK,CAACC,EAAQC,G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