{"version":3,"file":"Examples.zEcbakyM.mjs","names":["useStore","useState","useState","useRef"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/28rXvpPsrum7FH6cMELS/1jCAazZw1EGHjrG5Nu5D/Utils.js","https:/framer.com/m/framer/utils.js@^0.9.0","https:/framerusercontent.com/modules/RHYbKzlbk0IhSQbL9tIt/OeweWdbBVf2qQO2RzDTx/Examples.js"],"sourcesContent":["import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map","/*\n * createStore (framer/store@1.0.1)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js\"\n","export const centerContent = {\n    display: \"flex\",\n    justifyContent: \"center\",\n    alignItems: \"center\"\n};\nexport const autoSizingText = {\n    width: \"max-content\",\n    wordBreak: \"break-word\",\n    overflowWrap: \"break-word\",\n    overflow: \"hidden\",\n    whiteSpace: \"pre-wrap\",\n    flexShrink: 0\n};\nexport const defaultContainerStyles = {\n    ...centerContent,\n    overflow: \"hidden\"\n};\nexport const containerStyles = defaultContainerStyles;\nexport const randomColor = ()=>\"#\" + Math.floor(Math.random() * 16777215).toString(16)\n;\n\nexport const __FramerMetadata__ = {\"exports\":{\"centerContent\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"containerStyles\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"autoSizingText\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"defaultContainerStyles\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"randomColor\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}}}}\n//# sourceMappingURL=./Utils.map","/*\n * Utils (framer/utils@0.9.0)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/28rXvpPsrum7FH6cMELS/1jCAazZw1EGHjrG5Nu5D/Utils.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef,useState}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{randomColor}from\"https://framer.com/m/framer/utils.js@^0.9.0\";// Learn more: https://www.framer.com/developers/overrides/\nconst useStore=createStore({background:\"#0099FF\"});const revealOffset=24;const hiddenOffset=-120;function assignRef(ref,value){if(!ref)return;if(typeof ref===\"function\"){ref(value);return;}ref.current=value;}function clamp(value,min=0,max=1){return Math.min(max,Math.max(min,value));}function lerp(start,end,progress){return start+(end-start)*progress;}function findNestedVideo(root){if(!root)return null;if(root instanceof HTMLVideoElement)return root;return root.querySelector(\"video\");}function findHeroSentinel(){return document.querySelector('[data-framer-name=\"HeroSentinel\"]')||document.querySelector('[data-framer-name=\"Hero\"]');}function tryPlayVideo(video){const playPromise=video.play();if(playPromise&&typeof playPromise.catch===\"function\"){playPromise.catch(()=>{});}}export function withRotate(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{rotate:90},transition:{duration:2}});});}export function withHover(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,whileHover:{scale:1.05}});});}export function withRandomColor(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{background:store.background},onClick:()=>{setStore({background:randomColor()});}});});}export function withShowOnScrollUpMobile(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[visible,setVisible]=useState(true);const lastScrollY=useRef(0);const ticking=useRef(false);useEffect(()=>{if(typeof window===\"undefined\")return;const update=()=>{ticking.current=false;const nextY=window.scrollY||window.pageYOffset||0;const nearTop=nextY<=revealOffset;const scrollingUp=nextY<lastScrollY.current;setVisible(nearTop||scrollingUp);lastScrollY.current=nextY;};const onScroll=()=>{if(ticking.current)return;ticking.current=true;window.requestAnimationFrame(update);};update();window.addEventListener(\"scroll\",onScroll,{passive:true});window.addEventListener(\"resize\",onScroll);window.addEventListener(\"orientationchange\",onScroll);return()=>{window.removeEventListener(\"scroll\",onScroll);window.removeEventListener(\"resize\",onScroll);window.removeEventListener(\"orientationchange\",onScroll);};},[]);const baseAnimate=props.animate&&typeof props.animate===\"object\"&&!Array.isArray(props.animate)?props.animate:{};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,initial:false,animate:{...baseAnimate,y:visible?0:hiddenOffset,opacity:visible?1:0},transition:{duration:.28,ease:[.22,1,.36,1]},style:{...props.style,pointerEvents:!visible?\"none\":props.style?.pointerEvents,willChange:\"transform, opacity\"}});});}export function withFixedHeroVideoScene(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const rootRef=useRef(null);const[scene,setScene]=useState({visible:true,y:0,scale:1.04});useEffect(()=>{if(typeof window===\"undefined\")return;let frame=0;let mutationObserver=null;let intersectionObserver=null;const syncScene=()=>{frame=0;const sentinel=findHeroSentinel();const video=findNestedVideo(rootRef.current);if(!sentinel)return;const rect=sentinel.getBoundingClientRect();const viewportHeight=window.innerHeight||1;const totalDistance=Math.max(rect.height-viewportHeight,1);const progress=clamp(-rect.top/totalDistance);const active=rect.bottom>0&&rect.top<viewportHeight;setScene({visible:active,y:0,scale:lerp(1.04,1,progress)});if(!video)return;if(document.hidden||!active){video.pause();return;}const playPromise=video.play();if(playPromise&&typeof playPromise.catch===\"function\"){playPromise.catch(()=>{});}};const requestSync=()=>{if(frame)return;frame=window.requestAnimationFrame(syncScene);};requestSync();if(\"IntersectionObserver\"in window){intersectionObserver=new IntersectionObserver(()=>{requestSync();});const sentinel=findHeroSentinel();if(sentinel)intersectionObserver.observe(sentinel);}if(rootRef.current&&\"MutationObserver\"in window){mutationObserver=new MutationObserver(()=>requestSync());mutationObserver.observe(rootRef.current,{childList:true,subtree:true});}window.addEventListener(\"scroll\",requestSync,{passive:true});window.addEventListener(\"resize\",requestSync);window.addEventListener(\"orientationchange\",requestSync);document.addEventListener(\"visibilitychange\",requestSync);return()=>{if(frame)window.cancelAnimationFrame(frame);mutationObserver?.disconnect();intersectionObserver?.disconnect();window.removeEventListener(\"scroll\",requestSync);window.removeEventListener(\"resize\",requestSync);window.removeEventListener(\"orientationchange\",requestSync);document.removeEventListener(\"visibilitychange\",requestSync);};},[]);const baseAnimate=props.animate&&typeof props.animate===\"object\"&&!Array.isArray(props.animate)?props.animate:{};return /*#__PURE__*/_jsx(Component,{ref:node=>{rootRef.current=node;assignRef(ref,node);},...props,initial:false,animate:{...baseAnimate,opacity:scene.visible?1:0,y:0,scale:scene.scale},transition:{duration:.08,ease:\"linear\"},style:{...props.style,pointerEvents:\"none\",willChange:\"transform, opacity\",transformOrigin:\"center center\"}});});}export function withLazyLoadVideo(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const rootRef=useRef(null);useEffect(()=>{if(typeof window===\"undefined\")return;const root=rootRef.current;const video=findNestedVideo(root);if(!root||!video)return;let hasPrepared=false;video.preload=\"none\";video.pause();const ensureReady=()=>{if(hasPrepared)return;hasPrepared=true;video.preload=\"metadata\";video.load();};const observer=new IntersectionObserver(([entry])=>{if(entry.isIntersecting){ensureReady();if(!document.hidden){tryPlayVideo(video);}return;}video.pause();},{root:null,rootMargin:\"300px 0px\",threshold:.01});const onVisibilityChange=()=>{if(document.hidden){video.pause();return;}const rect=root.getBoundingClientRect();const inRange=rect.top<window.innerHeight+300&&rect.bottom>-300;if(inRange){ensureReady();tryPlayVideo(video);}};observer.observe(root);document.addEventListener(\"visibilitychange\",onVisibilityChange);return()=>{observer.disconnect();document.removeEventListener(\"visibilitychange\",onVisibilityChange);video.pause();};},[]);return /*#__PURE__*/_jsx(Component,{ref:node=>{rootRef.current=node;assignRef(ref,node);},...props});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withLazyLoadVideo\":{\"type\":\"reactHoc\",\"name\":\"withLazyLoadVideo\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFixedHeroVideoScene\":{\"type\":\"reactHoc\",\"name\":\"withFixedHeroVideoScene\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withShowOnScrollUpMobile\":{\"type\":\"reactHoc\",\"name\":\"withShowOnScrollUpMobile\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Examples.map"],"mappings":"8MAA8E,SAAgB,EAAY,EAAO,CACjH,IAAM,EAAU,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAG,EAAO,CAAC,CAAC,CAAC,CAClD,EAAa,GAAU,CAC1B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAU,MAAM,EAAE,EAAU,MAAM,OAAO,OAAO,CAAC,GAAG,EAAU,MAAM,GAAG,EAAS,CAAC,EAChI,EAAW,OAAO,GAAS,SAAS,OAAO,OAAO,CAAC,GAAG,EAAO,CAAC,CAAC,EAC7D,EAAa,IAAI,IACjB,EAAc,GAAU,CAC3B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAW,EAAE,EAAW,OAAO,GAAW,SAAS,OAAO,OAAO,CAAC,GAAG,EAAW,GAAG,EAAS,CAAC,CAAC,EACjJ,EAAa,QAAQ,GAAQ,EAAO,EAAW,CAAC,EAChD,SAASA,GAAU,CACnB,GAAK,CAAC,EAAM,GAAUC,EAAS,EAAW,CAK1C,OAHA,OACA,EAAa,IAAI,EAAS,KAAW,EAAa,OAAO,EAAS,EAAG,EAAE,CAAC,CACrE,GAAgB,GAAG,IAAM,GAAgB,CAAO,CAAC,EAAU,MAAM,EAAa,EAC3E,CAAC,EAAM,EAAc,CAAG,OAAOD,mBAfC,IAAwC,iCEAjE,EAAgB,CACzB,QAAS,OACT,eAAgB,SAChB,WAAY,SACf,CAWG,CADA,GAAG,EACO,qBEdmF,SAAS,EAAU,EAAI,EAAM,CAAK,KAAW,IAAG,OAAO,GAAM,WAAW,CAAC,EAAI,EAAM,CAAC,OAAQ,EAAI,QAAQ,GAAO,SAAS,EAAM,EAAM,EAAI,EAAE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