{"version":3,"file":"ThemeImage.CpJoQ370.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/twkElCx5N93bpiAoAj9Y/qgsSX2Elgzfz4wGc2NZW/ThemeImage.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect}from\"react\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ThemeImage(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(\"theme\");// If the toggle theme was found in local storage, use it.\nif(currentToggleState!==null){setIsDarkTheme(currentToggleState===\"dark\");}else{// If the theme toggle 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;}// Once the theme is determined, render the image corresponding to the theme.\nconst imageSrc=isDarkTheme?props.dark:props.light;return /*#__PURE__*/_jsx(\"img\",{src:imageSrc?imageSrc.src:\"\",alt:imageSrc?imageSrc.alt:\"\",style:{width:\"100%\",height:\"100%\",objectFit:props.sizing,borderRadius:props.radiusIsMixed?`${props.topLeft}px ${props.topRight}px ${props.bottomRight}px ${props.bottomLeft}px`:`${props.radius}px`}});}ThemeImage.displayName=\"Theme Image\";addPropertyControls(ThemeImage,{light:{type:ControlType.ResponsiveImage},dark:{type:ControlType.ResponsiveImage},sizing:{type:ControlType.Enum,defaultValue:\"cover\",options:[\"cover\",\"contain\",\"fill\"],optionTitles:[\"Fill\",\"Fit\",\"Stretch\"]},radius:{type:ControlType.FusedNumber,defaultValue:0,toggleKey:\"radiusIsMixed\",toggleTitles:[\"All\",\"Individual\"],valueKeys:[\"topLeft\",\"topRight\",\"bottomRight\",\"bottomLeft\"],valueLabels:[\"TL\",\"TR\",\"BR\",\"BL\"],min:0,description:\"*Note:* Theming may not work properly on the canvas or preview.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ThemeImage\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ThemeImage.map"],"mappings":"+LAGG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,EAAY,GAAgBA,EAAS,KAAK,CAW7F,GAX8F,MAAc,CAAC,IAAM,MAAgB,CAEnI,IAAM,EAAmB,aAAa,QAAQ,QAAQ,CAEa,EADhE,IAAqB,KACP,EAAO,WAAW,+BAA+B,CAA2B,QADhD,IAAqB,OACmC,EAC/F,EAAc,GAAG,CAAC,EAAe,EAAE,QAAQ,EACjD,GAAa,CACb,EAAO,iBAAiB,cAAc,EAAY,CAClD,IAAM,EAAW,EAAO,WAAW,+BAA+B,CAClE,OADmE,EAAW,YAAY,EAAc,KAC9F,CAAC,EAAO,oBAAoB,cAAc,EAAY,CAAC,EAAW,eAAe,EAAc,GAAK,EAAE,CAAC,CAE9G,IAAc,KAAM,OAAO,KAC9B,IAAM,EAAS,EAAY,EAAM,KAAK,EAAM,MAAM,OAAoB,EAAK,MAAM,CAAC,IAAI,EAAS,EAAS,IAAI,GAAG,IAAI,EAAS,EAAS,IAAI,GAAG,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