{"version":3,"file":"shared-lib.Z95ZyIm5.mjs","names":["useState","Children"],"sources":["https:/framerusercontent.com/modules/EZNlGM3CSxRzZ0t1JHRL/IFmPnQrqKQJto8XWihEQ/FrameSwitcher.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,startTransition,Children,isValidElement,cloneElement}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion}from\"framer-motion\";FrameSwitcher.displayName=\"Frame Switcher\";/**\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function FrameSwitcher(props){const{lightFrame,darkFrame,crossfade=true,crossfadeTransition={duration:.3},style}=props;const[isDarkMode,setIsDarkMode]=useState(false);const[isInitialized,setIsInitialized]=useState(false);const isStatic=useIsStaticRenderer();const fillWidth=style?.width===\"100%\";const fillHeight=style?.height===\"100%\";const hasLight=Children.count(lightFrame)>0;const hasDark=Children.count(darkFrame)>0;const stretch=node=>{if(node==null)return node;if(Array.isArray(node))return node.map(stretch);return Children.map(node,child=>{if(!/*#__PURE__*/isValidElement(child))return child;const childStyle=child.props?.style;return /*#__PURE__*/cloneElement(child,{style:{...childStyle||{},...fillWidth?{width:\"100%\"}:{},...fillHeight?{height:\"100%\"}:{},...fillWidth||fillHeight?{flex:1,alignSelf:\"stretch\"}:{}}});});};useEffect(()=>{if(typeof window===\"undefined\")return;const updateTheme=theme=>{let isDark=false;// First check localStorage for theme set by ThemeSwitcher\nconst storedTheme=localStorage.getItem(\"theme\");if(storedTheme){isDark=storedTheme===\"dark\";}else if(theme){isDark=theme===\"dark\";}else{// Fallback to system preference\nconst mediaQuery=window.matchMedia(\"(prefers-color-scheme: dark)\");isDark=mediaQuery.matches;}startTransition(()=>{setIsDarkMode(isDark);setIsInitialized(true);});};// Initialize theme\nupdateTheme();// Listen for custom theme change events from ThemeSwitcher\nconst handleThemeChange=()=>{const storedTheme=localStorage.getItem(\"theme\");updateTheme(storedTheme||undefined);};window.addEventListener(\"themeChange\",handleThemeChange);// Also listen for system theme changes as fallback\nconst mediaQuery=window.matchMedia(\"(prefers-color-scheme: dark)\");const handleChange=e=>{// Only update if no theme is stored (user hasn't manually set theme)\nconst storedTheme=localStorage.getItem(\"theme\");if(!storedTheme){updateTheme(e.matches?\"dark\":\"light\");}};mediaQuery.addEventListener(\"change\",handleChange);return()=>{window.removeEventListener(\"themeChange\",handleThemeChange);mediaQuery.removeEventListener(\"change\",handleChange);};},[]);const showLight=!isDarkMode;const shouldAnimate=crossfade&&!isStatic&&isInitialized;const lightOpacity=showLight?1:0;const darkOpacity=showLight?0:1;const activeFrame=showLight?lightFrame:darkFrame;return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:fillWidth?\"100%\":\"max-content\",height:fillHeight?\"100%\":\"max-content\",minWidth:5,minHeight:5,overflow:fillHeight?\"hidden\":\"visible\",...style},children:[!fillHeight&&fillWidth&&/*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":true,style:{width:fillWidth?\"100%\":\"max-content\",height:\"max-content\",minWidth:5,minHeight:5,visibility:\"hidden\",pointerEvents:\"none\",display:\"flex\"},children:/*#__PURE__*/_jsx(\"div\",{style:{width:fillWidth?\"100%\":\"max-content\",height:\"max-content\",minWidth:5,minHeight:5,display:\"flex\"},children:stretch(activeFrame)})}),!fillWidth&&fillHeight&&/*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":true,style:{width:\"max-content\",height:fillHeight?\"100%\":\"max-content\",minWidth:5,minHeight:5,visibility:\"hidden\",pointerEvents:\"none\",display:\"flex\"},children:/*#__PURE__*/_jsx(\"div\",{style:{width:\"max-content\",height:fillHeight?\"100%\":\"max-content\",minWidth:5,minHeight:5,display:\"flex\"},children:stretch(activeFrame)})}),!fillWidth&&!fillHeight&&/*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":true,style:{width:\"max-content\",height:\"max-content\",minWidth:5,minHeight:5,visibility:\"hidden\",pointerEvents:\"none\",display:\"flex\"},children:/*#__PURE__*/_jsx(\"div\",{style:{width:\"max-content\",height:\"max-content\",minWidth:5,minHeight:5,display:\"flex\"},children:activeFrame})}),/*#__PURE__*/_jsxs(\"div\",{style:{position:fillHeight?\"absolute\":\"absolute\",inset:0,display:\"grid\"},children:[/*#__PURE__*/_jsx(motion.div,{style:{gridArea:\"1 / 1\",pointerEvents:showLight?\"auto\":\"none\",display:\"flex\",opacity:shouldAnimate?undefined:lightOpacity,visibility:shouldAnimate?\"visible\":showLight?\"visible\":\"hidden\"},initial:false,animate:shouldAnimate?{opacity:lightOpacity}:undefined,transition:shouldAnimate?crossfadeTransition:{duration:0},\"aria-hidden\":!showLight,children:/*#__PURE__*/_jsx(\"div\",{style:{width:fillWidth?\"100%\":\"max-content\",height:fillHeight?\"100%\":\"max-content\",minWidth:5,minHeight:5,display:\"flex\"},children:hasLight?stretch(lightFrame):null})}),/*#__PURE__*/_jsx(motion.div,{style:{gridArea:\"1 / 1\",pointerEvents:showLight?\"none\":\"auto\",display:\"flex\",opacity:shouldAnimate?undefined:darkOpacity,visibility:shouldAnimate?\"visible\":showLight?\"hidden\":\"visible\"},initial:false,animate:shouldAnimate?{opacity:darkOpacity}:undefined,transition:shouldAnimate?crossfadeTransition:{duration:0},\"aria-hidden\":showLight,children:/*#__PURE__*/_jsx(\"div\",{style:{width:fillWidth?\"100%\":\"max-content\",height:fillHeight?\"100%\":\"max-content\",minWidth:5,minHeight:5,display:\"flex\"},children:hasDark?stretch(darkFrame):null})})]})]});}addPropertyControls(FrameSwitcher,{lightFrame:{type:ControlType.ComponentInstance,title:\"Light Frame\"},darkFrame:{type:ControlType.ComponentInstance,title:\"Dark Frame\",description:\"For accurate results, preview in the browser.\"},crossfade:{type:ControlType.Boolean,title:\"Crossfade\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},crossfadeTransition:{type:ControlType.Transition,title:\"Crossfade Transition\",hidden:({crossfade})=>!crossfade}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FrameSwitcher\",\"slots\":[\"lightFrame\",\"darkFrame\"],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FrameSwitcher.map"],"mappings":"uRAIG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,aAAW,YAAU,YAAU,GAAK,sBAAoB,CAAC,SAAS,EAAE,EAAE,SAAO,EAAW,CAAC,EAAW,GAAeA,EAAS,EAAK,EAAO,CAAC,EAAc,GAAkBA,EAAS,EAAK,EAAQ,EAAS,EAAoB,EAAQ,EAAU,GAAO,QAAQ,OAAa,EAAW,GAAO,SAAS,OAAa,EAASC,EAAS,MAAM,CAAU,EAAE,EAAQ,EAAQA,EAAS,MAAM,CAAS,EAAE,EAAQ,EAAQ,GAAU,GAAM,KAAY,EAAQ,MAAM,QAAQ,CAAI,EAAS,EAAK,IAAI,CAAO,EAASA,EAAS,IAAI,EAAK,GAAO,CAAC,GAAG,CAAc,EAAe,CAAK,EAAE,OAAO,EAAM,IAAM,EAAW,EAAM,OAAO,MAAM,OAAoB,EAAa,EAAM,CAAC,MAAM,CAAC,GAAG,GAAY,CAAC,EAAE,GAAG,EAAU,CAAC,MAAM,MAAM,EAAE,CAAC,EAAE,GAAG,EAAW,CAAC,OAAO,MAAM,EAAE,CAAC,EAAE,GAAG,GAAW,EAAW,CAAC,KAAK,EAAE,UAAU,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,EAAI,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAY,GAAO,CAAC,IAAI,EAAO,GACt6B,EAAY,aAAa,QAAQ,OAAO,EAAE,AACmB,EADhB,EAAoB,IAAc,OAAgB,EAAc,IAAQ,OAC1G,EAAO,WAAW,8BAAgD,CAAC,CAAC,QAAS,MAAoB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