{"version":3,"file":"ThemeVariants.DR4EIFM0.mjs","names":["useState","_Fragment","__esmMin","init_npm_react_18_3_1","z","window","ce","init_jsx_runtime","_e","init_ssg_sandbox_shims","init_framer_Cb9Z_4vX","ControlType","addPropertyControls","ThemeVariants","isDarkTheme","setIsDarkTheme","updateTheme","currentToggleState","mediaQuery","osThemeChange","layers","props","i","layer","themeLayer","l","init_ThemeVariants"],"sources":["https:/framerusercontent.com/modules/tKcSe7SLIIAlT6NBwcwi/ODSml4tdFDE8ZWrAvwko/ThemeVariants.js"],"sourcesContent":["import{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect,cloneElement}from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function ThemeVariants(props){const[isDarkTheme,setIsDarkTheme]=useState(null);useEffect(()=>{const updateTheme=()=>{// For compatibility with the theme toggle component.\n// If your site does not have a theme toggle, the device theme will be used.\nconst currentToggleState=localStorage.getItem(\"currentToggleState\");// If the toggle theme was found in local storage, use it.\nif(currentToggleState!==null){setIsDarkTheme(currentToggleState===\"dark\");}else{// If the toggle theme was not found in local storage, use the device theme.\nconst mediaQuery=window.matchMedia(\"(prefers-color-scheme: dark)\");setIsDarkTheme(mediaQuery.matches);}};// Event listener for changes in the device theme\nconst osThemeChange=e=>{setIsDarkTheme(e.matches);};// Update the theme when the page loads\nupdateTheme();// Listen for theme changes made by the theme toggle component\nwindow.addEventListener(\"themeChange\",updateTheme);// Listen for changes in the device theme\nconst mediaQuery=window.matchMedia(\"(prefers-color-scheme: dark)\");mediaQuery.addListener(osThemeChange);// Clean up the event listeners when the theme toggle component unmounts\nreturn()=>{window.removeEventListener(\"themeChange\",updateTheme);mediaQuery.removeListener(osThemeChange);};},[]);// Before the theme has been determined, render nothing.\n// This prevents flashing while the page loads.\nif(isDarkTheme===null){return null;}let layers=[props.light[0],props.dark[0]];for(let i=0;i<2;i++){var _props_style,_props_style1;let layer=layers[i];if(layer&&(((_props_style=props.style)===null||_props_style===void 0?void 0:_props_style.width)||((_props_style1=props.style)===null||_props_style1===void 0?void 0:_props_style1.height))){layers[i]=/*#__PURE__*/cloneElement(layer,{style:{...layer.props.style,...props.style}});}}let themeLayer=layers[isDarkTheme?1:0];if(!themeLayer){return /*#__PURE__*/_jsx(\"div\",{style:{minWidth:100,minHeight:100}});}else{return /*#__PURE__*/_jsx(_Fragment,{children:themeLayer});}}ThemeVariants.displayName=\"Theme Variants\";addPropertyControls(ThemeVariants,{light:{type:ControlType.ComponentInstance,title:\"Light\"},dark:{type:ControlType.ComponentInstance,title:\"Dark\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ThemeVariants\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ThemeVariants.map"],"mappings":"A,wMAGG,SAAwBa,EAAc,EAAM,CAAC,GAAK,CAACC,EAAYC,GAAgBf,EAAS,IAAI,EAW/F,GAXiGM,MAAc,CAAC,IAAMU,MAAgB,CAEtI,IAAMC,EAAmB,aAAa,QAAQ,oBAAoB,EAClE,GAAGA,IAAqB,KAAMF,EAAeE,IAAqB,MAAM,MAAO,CAC/E,IAAMC,EAAWb,EAAO,WAAW,8BAA8B,EAAEU,EAAeG,EAAW,OAAO,CAAE,CAAC,EACjGC,EAAc,GAAG,CAACJ,EAAe,EAAE,OAAO,CAAE,EAClDC,EAAY,EACZX,EAAO,iBAAiB,cAAcW,CAAW,EACjD,IAAME,EAAWb,EAAO,WAAW,8BAA8B,EACjE,OADmEa,EAAW,YAAYC,CAAa,MAC7F,CAACd,EAAO,oBAAoB,cAAcW,CAAW,EAAEE,EAAW,eAAeC,CAAa,CAAE,CAAE,EAAE,CAAC,CAAC,EAE7GL,IAAc,KAAM,OAAO,KA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