(()=>{var e={799:()=>{window.WPConsent={displayChecks:[],checksPassed:!0,settingsHooks:[],settingsProcessed:!1,registerDisplayCheck:function(e){this.displayChecks.push(e),this.checksPassed=!1},registerSettingsHook:function(e){this.settingsHooks.push(e),this.settingsProcessed=!1},runDisplayChecks:function(){return 0===this.displayChecks.length?(this.checksPassed=!0,Promise.resolve()):Promise.all(this.displayChecks.map((e=>e()))).then((()=>(this.checksPassed=!0,Promise.resolve()))).catch((e=>(console.error("Error in WPConsent display check:",e),this.checksPassed=!0,Promise.resolve())))},runSettingsHooks:function(){return 0===this.settingsHooks.length?(this.settingsProcessed=!0,Promise.resolve()):Promise.all(this.settingsHooks.map((e=>e(window.wpconsent)))).then((()=>(this.settingsProcessed=!0,Promise.resolve()))).catch((e=>(console.error("Error in WPConsent settings hook:",e),this.settingsProcessed=!0,Promise.resolve())))},acceptAll:function(){const e={};Array.isArray(wpconsent.slugs)&&wpconsent.slugs.forEach((t=>{e[t]=!0})),this.savePreferences(e),this.closePreferences()},checkGPC:function(){if(!wpconsent.respect_gpc||!0!==navigator.globalPrivacyControl)return;const e=this.getCookie("wpconsent_preferences");let t={};if(e)try{t=JSON.parse(e)}catch(e){console.error("WPConsent: Error parsing existing preferences:",e)}if(t.hasOwnProperty("respect_gpc"))return;const n={};wpconsent.slugs.forEach((e=>{const t=this.shadowRoot?.querySelector(`#wpconsent-preferences-modal input[type="checkbox"][id="cookie-service-${e}"]`);t&&t.disabled?n[e]=!0:n[e]=!1})),n.essential=!0,n.respect_gpc=!0,this.savePreferences(n,!0),this.checksPassed=!1},savePreferences:function(e,t=!1){const n=this.getCookie("wpconsent_preferences");let s=!1,o=null;if(n)try{o=JSON.parse(n)}catch(e){console.error("WPConsent: Error parsing existing preferences:",e)}(o&&JSON.stringify(o)!==JSON.stringify(e)||wpconsent.default_allow&&Object.values(e).some((e=>!1===e)))&&(this.clearCookies(),s=!0),wpconsent.respect_gpc&&!t&&o&&o.hasOwnProperty("respect_gpc")&&(e.respect_gpc=!1),this.setCookie("wpconsent_preferences",JSON.stringify(e),wpconsent.consent_duration),this.hideBanner(),this.closePreferences(),this.unlockScripts(e),this.unlockIframes(e),this.showFloatingButtonIfEnabled(),this.updateWordPressConsent(e),window.dispatchEvent(new CustomEvent("wpconsent_consent_saved",{detail:e})),n&&window.dispatchEvent(new CustomEvent("wpconsent_consent_updated",{detail:e})),s&&(Object.defineProperty(document,"cookie",{get:function(){return""},set:function(e){}}),window.location.reload())},showPreferences:function(){const e=this.shadowRoot?.querySelector("#wpconsent-preferences-modal");if(e){e.style.display="flex",this.setupFocusTrap(e);const t=this.shadowRoot?.querySelector("#wpconsent-preferences-title");t&&setTimeout((()=>{t.focus({preventScroll:!0}),this.lastFocusedElement=t}),100);const n=this.getCookie("wpconsent_preferences");if(n)try{const e=JSON.parse(n);this.shadowRoot.querySelectorAll('#wpconsent-preferences-modal input[type="checkbox"]').forEach((t=>{let n=null;n=t.id.startsWith("cookie-category-")?t.id.replace("cookie-category-",""):t.id.startsWith("cookie-service-")?t.id.replace("cookie-service-",""):t.value,n&&n in e&&(t.checked=e[n])}))}catch(e){console.error("Error parsing WPConsent preferences:",e)}}},closePreferences:function(){const e=this.shadowRoot?.querySelector("#wpconsent-preferences-modal");e&&(e.style.display="none",this.removeFocusTrap(),this.previouslyFocusedElement&&(this.previouslyFocusedElement.focus({preventScroll:!0}),this.previouslyFocusedElement=null))},showBanner:function(){if(!wpconsent.enable_consent_banner)return;const e=this.shadowRoot?.querySelector("#wpconsent-banner-holder");e&&(e.classList.add("wpconsent-banner-visible"),this.setupFocusTrap(e))},hideBanner:function(){const e=this.shadowRoot?.querySelector("#wpconsent-banner-holder");e&&(e.classList.remove("wpconsent-banner-visible"),this.removeFocusTrap(),this.previouslyFocusedElement&&(this.previouslyFocusedElement.focus({preventScroll:!0}),this.previouslyFocusedElement=null))},setCookie:function(e,t,n){let s="";if(n>0){const e=new Date;e.setTime(e.getTime()+24*n*60*60*1e3),s="expires="+e.toUTCString()+";"}const o=this.getCookieDomain();document.cookie=e+"="+t+";"+s+o+"path=/"},getCookieDomain:function(){if(wpconsent.enable_shared_consent){const e=window.location.hostname.split(".");if(e.length>=2)return"domain=."+e.slice(-2).join(".")+";"}return""},getCookie:function(e){const t=`; ${document.cookie}`.split(`; ${e}=`);if(2===t.length)return t.pop().split(";").shift()},hasConsent:function(e){const t=this.getCookie("wpconsent_preferences");if(!t)return!1;try{const n=JSON.parse(t);return"essential"===e||!0===n[e]}catch(e){return console.error("Error parsing WPConsent preferences:",e),!1}},shouldUnlockContent:function(e,t,n){return"essential"===n||(wpconsent.manual_toggle_services?!(!t||void 0===e[t])&&e[t]:!0===e[n])},unlockScripts:function(e){document.querySelectorAll('script[type="text/plain"]').forEach((t=>{const n=t.getAttribute("data-wpconsent-category"),s=t.getAttribute("data-wpconsent-name");if(this.shouldUnlockContent(e,s,n)){const e=document.createElement("script");t.getAttributeNames().forEach((n=>{"type"!==n&&e.setAttribute(n,t.getAttribute(n))}));const n=t.getAttribute("data-wpconsent-src");n?e.src=n:e.text=t.text,t.parentNode.replaceChild(e,t)}})),document.dispatchEvent(new CustomEvent("wpconsent_consent_processed",{detail:e}))},unlockIframes:function(e){document.querySelectorAll("iframe[data-wpconsent-src]").forEach((t=>{const n=t.getAttribute("data-wpconsent-category"),s=t.getAttribute("data-wpconsent-name");if(this.shouldUnlockContent(e,s,n)){const e=t.getAttribute("data-wpconsent-src");e&&(t.src=e),t.removeAttribute("data-wpconsent-src"),t.removeAttribute("data-wpconsent-name"),t.removeAttribute("data-wpconsent-category")}})),document.querySelectorAll(".wpconsent-iframe-placeholder").forEach((t=>{const n=t.getAttribute("data-wpconsent-category"),s=t.getAttribute("data-wpconsent-name");if(this.shouldUnlockContent(e,s,n)){const e=t.querySelector(".wpconsent-iframe-thumbnail"),n=t.querySelector(".wpconsent-iframe-overlay-content");e&&e.remove(),n&&n.remove(),t.classList.remove("wpconsent-iframe-placeholder")}}))},init:function(){this.runSettingsHooks().then((()=>{this.initWordPress();const e=document.getElementById("wpconsent-container"),t=document.getElementById("wpconsent-template");if(this.shadowRoot=e.shadowRoot,this.shadowRoot)this.runDisplayChecks().then((()=>{this.processBannerDisplay()}));else{this.shadowRoot=e.attachShadow({mode:"open"});const n=t.content.cloneNode(!0);this.shadowRoot.appendChild(n),t.remove(),this.initializeEventListeners(),this.initializeAccordions(),this.initializeKeyboardHandlers(),this.runDisplayChecks().then((()=>{this.loadExternalCSS(e).then((()=>{this.processBannerDisplay()}))}))}}))},processBannerDisplay:function(){const e=this.getCookie("wpconsent_preferences");if(e){let t={};try{if(t=JSON.parse(e),wpconsent.slugs&&Array.isArray(wpconsent.slugs)&&!wpconsent.slugs.every((e=>t.hasOwnProperty(e))))return this.setCookie("wpconsent_preferences","",-1),this.checkGPC(),void(this.checksPassed&&this.showBanner());this.unlockScripts(t),this.unlockIframes(t)}catch(e){console.error("Error parsing WPConsent preferences:",e)}this.showFloatingButtonIfEnabled()}else if(this.checkGPC(),this.checksPassed&&this.showBanner(),wpconsent.default_allow||!wpconsent.enable_script_blocking){const e={};wpconsent.slugs.forEach((t=>{e[t]=!0})),this.unlockScripts(e),this.unlockIframes(e)}window.dispatchEvent(new CustomEvent("wpconsent_banner_initialized"))},loadExternalCSS:function(e){return new Promise(((t,n)=>{try{const n=`${wpconsent.css_url}?ver=${wpconsent.css_version}`;fetch(n).then((e=>e.text())).then((n=>{const s=document.createElement("style");s.textContent=n,this.shadowRoot.appendChild(s),e.style.display="block",t()})).catch((e=>{console.error("Failed to load WPConsent styles:",e),t()}))}catch(e){console.error("Failed to load WPConsent styles:",e),t()}}))},initializeEventListeners:function(){this.shadowRoot.querySelectorAll(".wpconsent-accept-all").forEach((e=>e.addEventListener("click",(()=>this.acceptAll())))),this.shadowRoot.querySelector("#wpconsent-cancel-all")?.addEventListener("click",(()=>{const e={};wpconsent.slugs.forEach((t=>{const n=this.shadowRoot.querySelector(`#wpconsent-preferences-modal input[type="checkbox"][id="cookie-service-${t}"]`);n&&n.disabled?e[t]=!0:e[t]=!1})),e.essential=!0,this.savePreferences(e)})),this.shadowRoot.querySelector("#wpconsent-banner-close")?.addEventListener("click",(()=>this.hideBanner())),this.shadowRoot.querySelector("#wpconsent-preferences-all")?.addEventListener("click",(()=>this.showPreferences()));const e=this.shadowRoot.querySelector("#wpconsent-consent-floating");e&&e.addEventListener("click",(()=>this.showPreferences())),this.initializeCheckboxListeners(),document.addEventListener("click",(e=>{const t=e.target.closest(".wpconsent-iframe-accept-button");if(t){const e=t.getAttribute("data-category"),n=t.closest(".wpconsent-iframe-placeholder"),s=n?.getAttribute("data-wpconsent-name");if(e){let t={};try{t=JSON.parse(this.getCookie("wpconsent_preferences")||"{}")}catch(e){console.error("Failed to parse wpconsent_preferences cookie:",e)}const n={...t,essential:!0,[e]:!0};s&&(n[s]=!0),this.savePreferences(n)}}})),this.shadowRoot.querySelector(".wpconsent-preferences-header-close")?.addEventListener("click",(()=>this.closePreferences())),this.shadowRoot.querySelector(".wpconsent-save-preferences")?.addEventListener("click",(()=>{const e=this.shadowRoot.querySelectorAll('#wpconsent-preferences-modal input[type="checkbox"]'),t=Array.from(e).filter((e=>e.checked)).map((e=>e.value)),n={};wpconsent.slugs.forEach((e=>{n[e]=t.includes(e)})),n.essential=!0,this.savePreferences(n)})),this.shadowRoot.querySelector(".wpconsent-close-preferences")?.addEventListener("click",(()=>this.closePreferences())),window.addEventListener("wpconsent_consent_saved",(function(e){if("function"!=typeof gtag)return;const t=e.detail;gtag("consent","update",{ad_storage:t.marketing?"granted":"denied",analytics_storage:t.statistics?"granted":"denied",ad_user_data:t.marketing?"granted":"denied",ad_personalization:t.marketing?"granted":"denied",security_storage:"granted",functionality_storage:"granted"})}))},initializeCheckboxListeners:function(){this.shadowRoot.querySelectorAll('#wpconsent-preferences-modal input[type="checkbox"][id^="cookie-category-"]').forEach((e=>{e.addEventListener("change",(e=>{this.handleCategoryCheckboxChange(e.target)}))})),this.shadowRoot.querySelectorAll('#wpconsent-preferences-modal input[type="checkbox"][id^="cookie-service-"]').forEach((e=>{e.addEventListener("change",(e=>{this.handleServiceCheckboxChange(e.target)}))}))},handleCategoryCheckboxChange:function(e){const t=e.id.replace("cookie-category-","");this.shadowRoot.querySelectorAll('#wpconsent-preferences-modal input[type="checkbox"][id^="cookie-service-"]').forEach((n=>{n.closest(`.wpconsent-cookie-category-${t}`)&&(n.checked=e.checked)}))},handleServiceCheckboxChange:function(e){const t=e.closest(".wpconsent-cookie-category");if(!t)return;const n=t.querySelector('input[type="checkbox"][id^="cookie-category-"]');if(!n)return;const s=t.querySelectorAll('input[type="checkbox"][id^="cookie-service-"]');let o=!1;s.forEach((e=>{e.checked&&(o=!0)})),n.checked=o},initializeAccordions(){this.shadowRoot.querySelectorAll(".wpconsent-preferences-accordion-item").forEach((e=>{const t=e.querySelector(".wpconsent-preferences-accordion-header"),n=e.querySelector(".wpconsent-preferences-accordion-content");t&&n&&t.addEventListener("click",(t=>{t.target.closest(".wpconsent-preferences-checkbox-toggle")||this.toggleAccordion(e,n)}))}))},toggleAccordion(e,t){e.classList.contains("active");const n=e.parentElement,s=e.classList.contains("wpconsent-cookie-service");e.classList.contains("wpconsent-cookie-category")?n&&n.querySelectorAll(":scope > .wpconsent-preferences-accordion-item.wpconsent-cookie-category").forEach((t=>{t!==e&&(t.classList.remove("active"),t.querySelectorAll(".wpconsent-cookie-service").forEach((e=>{e.classList.remove("active")})))})):s&&n&&n.querySelectorAll(":scope > .wpconsent-preferences-accordion-item.wpconsent-cookie-service").forEach((t=>{t!==e&&t.classList.remove("active")})),e.classList.toggle("active")},initializeKeyboardHandlers:function(){document.addEventListener("keydown",(e=>{"Tab"===e.key?this.handleTabKey(e):"Escape"===e.key&&this.handleEscapeKey(e)}))},handleEscapeKey:function(e){const t=this.shadowRoot?.querySelector("#wpconsent-preferences-modal"),n=this.shadowRoot?.querySelector("#wpconsent-banner-holder");t&&"flex"===t.style.display?this.closePreferences():n&&n.classList.contains("wpconsent-banner-visible")&&this.hideBanner()},handleTabKey:function(e){const t=this.shadowRoot?.querySelector("#wpconsent-banner-holder"),n=this.shadowRoot?.querySelector("#wpconsent-preferences-modal"),s=t&&t.classList.contains("wpconsent-banner-visible"),o=n&&"flex"===n.style.display;if(!s&&!o)return;const c=o?n:t,r=this.getFocusableElements(c);if(0===r.length)return;e.preventDefault();const i=r[0],a=r[r.length-1];let l;this.lastFocusedElement&&r.includes(this.lastFocusedElement)?l=this.lastFocusedElement:(l=i,this.lastFocusedElement=l);const h=r.indexOf(l);let d;d=e.shiftKey?h<=0?a:r[h-1]:h>=r.length-1?i:r[h+1],d.focus({preventScroll:!0}),this.lastFocusedElement=d},setupFocusTrap:function(e){this.previouslyFocusedElement=document.activeElement,this.lastFocusedElement=null},removeFocusTrap:function(){this.lastFocusedElement=null},setInitialFocus:function(e){const t=this.getFocusableElements(e);t.length>0&&setTimeout((()=>{t[0].focus({preventScroll:!0}),this.lastFocusedElement=t[0]}),100)},getFocusableElements:function(e){return Array.from(e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter((t=>{let n=t;for(;n&&n!==e;){const e=window.getComputedStyle(n);if("none"===e.display||"hidden"===e.visibility||"0"===e.opacity||n.disabled||"true"===n.getAttribute("aria-hidden"))return!1;n=n.parentElement}return!0}))},isElementInContainer:function(e,t){return!(!e||!t)&&(t.shadowRoot?t.shadowRoot.contains(e):t.contains(e))},clearCookies:function(){for(var e=document.cookie.split("; "),t=0;t0;){var s=encodeURIComponent(e[t].split(";")[0].split("=")[0])+"=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain="+n.join(".")+" ;path=",o=location.pathname.split("/");for(document.cookie=s+"/";o.length>0;)document.cookie=s+o.join("/"),o.pop();n.shift()}},initWordPress:function(){window.wp_consent_type=wpconsent.consent_type;let e=new CustomEvent("wp_consent_type_defined");document.dispatchEvent(e)},showFloatingButtonIfEnabled:function(){if(wpconsent.enable_consent_floating){const e=this.shadowRoot?.querySelector("#wpconsent-consent-floating");e&&(e.style.display="block")}},updateWordPressConsent:function(e){"function"==typeof wp_set_consent&&(wp_set_consent("functional","allow"),wp_set_consent("preferences","allow"),wp_set_consent("statistics",e.statistics?"allow":"deny"),wp_set_consent("statistics-anonymous",e.statistics?"allow":"deny"),wp_set_consent("marketing",e.marketing?"allow":"deny"))}},document.addEventListener("DOMContentLoaded",(()=>WPConsent.init()))}},t={};function n(s){var o=t[s];if(void 0!==o)return o.exports;var c=t[s]={exports:{}};return e[s](c,c.exports,n),c.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";n(799)})()})();