1import{a as d}from"./chunk-5FWKMTUW.js";import{A as g,D as C,E as u,F as _,u as s,x as a,y as h,z as m}from"./chunk-VJGBCIFP.js";import"./chunk-XCPXRTXT.js";import{f as r}from"./chunk-XJLSI5BW.js";import{a as c,b as l}from"./chunk-ZOYOJ6FT.js";import"./chunk-6KHOHYTW.js";var n=class{constructor(e){this.element=e,this._init()}_init(){this.warningMessage=this.element.querySelector(".message--warning"),this._setupRadioButton(),this._checkConsentForWarningMessage(),r(()=>{this._checkConsentForWarningMessage()})}_setupRadioButton(){this.radios=this.element.querySelectorAll('input[type="radio"]');let e=this._getCookieValue()||m;(this.radios||[]).forEach(t=>{t.checked=t.value===e,t.addEventListener("change",o=>{if(o.target.checked){let i=o.target.value;this._setColorScheme(i),C(i),this._trackColorSchemeChange(o.target)}})})}_checkConsent({consentCallback:e=null,consentDeniedCallback:t=null}){g().then(o=>{o?e&&e():t&&t()}).catch(o=>{s(o)})}_setColorScheme(e){this._checkConsent({consentCallback:this._setCookie.bind(this,e)}),h()&&a(e).catch(t=>{s(t),console.warn("Failed to save colorScheme via API",t)}),this._updateHtmlClass(e),u(e),_(e)}_getCookieValue(){return c("colorScheme")}_setCookie(e){l("colorScheme",e,{expires:3650,secure:(window.lclClientConfig||{}).env!=="development"})}_checkConsentForWarningMessage(){this._checkConsent({consentDeniedCallback:this._toggleConsentWarning.bind(this,!0),consentCallback:this._toggleConsentWarning.bind(this,!1)})}_toggleConsentWarning(e=!0){this.element.classList.toggle("warning",e)}_updateHtmlClass(e){let t=document.querySelector("html");t&&(t.classList.remove("color-scheme--auto","color-scheme--light","color-scheme--dark"),e&&t.classList.add(`color-scheme--${e}`))}_trackColorSchemeChange(e){let t=e.value;d({element:this.element,eventName:"color-scheme-toggle",data:{event:"color scheme interaction toggle",eventParam
1s:{category:"color scheme"},engagement:{type:"toggle",component:{name:t}}}})}};export{n as default}; 2//# sourceMappingURL=color-scheme-toggle-module-KDWYY6TZ.js.map
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.