{"version":3,"file":"StaggerReveal.Cu6525MJ.mjs","names":["useRef","useLayoutEffect","useEffect"],"sources":["https:/framerusercontent.com/modules/gvEeg763oQ7YAMhLmL8Y/3SMLiejEThlG8U1zYWC3/StaggerReveal.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useLayoutEffect,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";const useIsoLayoutEffect=typeof window!==\"undefined\"?useLayoutEffect:useEffect;/**\n * Reveals the cards of a group one by one when the group scrolls into view.\n * Works with regular stacks, grids and CMS collection lists.\n * Place it right after the card container (or inside it) — it renders nothing.\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function StaggerReveal(props){const{target=\"Previous sibling\",step=.12,duration=.9,distance=28,threshold=.15}=props;const ref=useRef(null);useIsoLayoutEffect(()=>{if(typeof window===\"undefined\")return;if(RenderTarget.current()===RenderTarget.canvas)return;if(window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches)return;const marker=ref.current;if(!marker)return;// Framer wraps code components in their own container element, so climb out of it first\nlet anchor=marker;while(anchor.parentElement&&anchor.parentElement.children.length===1&&!anchor.previousElementSibling){anchor=anchor.parentElement;}const container=target===\"Parent\"?anchor.parentElement:anchor.previousElementSibling;if(!container)return;const getItems=()=>Array.from(container.children).filter(el=>el!==anchor&&getComputedStyle(el).position!==\"absolute\");// Hide with filter/translate instead of opacity/transform, so Framer hover effects\n// (which animate opacity and transform) never pick up a hidden start value.\nconst hide=el=>{el.style.filter=\"opacity(0)\";el.style.translate=`0 ${distance}px`;};const show=el=>{el.style.filter=\"\";el.style.translate=\"\";};let items=getItems();items.forEach(hide);let played=false;const play=()=>{if(played)return;played=true;items=getItems();items.forEach((el,i)=>{const anim=el.animate([{filter:\"opacity(0)\",translate:`0 ${distance}px`},{filter:\"opacity(1)\",translate:\"0 0\"}],{duration:duration*1e3,delay:i*step*1e3,easing:\"cubic-bezier(0.22, 1, 0.36, 1)\",fill:\"backwards\"});show(el);anim.onfinish=()=>anim.cancel();});};const inView=()=>{const r=container.getBoundingClientRect();const vh=window.innerHeight||document.documentElement.clientHeight;return r.top<vh*(1-Math.min(threshold,.9))&&r.bottom>0;};const check=()=>{if(played)return;if(inView())play();else if(container.getBoundingClientRect().bottom<0){played=true;getItems().forEach(show);}};let observer=null;if(\"IntersectionObserver\"in window){observer=new IntersectionObserver(entries=>{if(entries.some(e=>e.isIntersecting))check();},{threshold:[0,threshold]});observer.observe(container);}window.addEventListener(\"scroll\",check,{passive:true});document.addEventListener(\"visibilitychange\",check);const raf=requestAnimationFrame(check);// safety net: never leave cards hidden\nconst fallback=window.setTimeout(()=>{if(!played&&(document.visibilityState!==\"visible\"||inView()))play();},2500);return()=>{observer?.disconnect();window.removeEventListener(\"scroll\",check);document.removeEventListener(\"visibilitychange\",check);cancelAnimationFrame(raf);window.clearTimeout(fallback);getItems().forEach(show);};},[target,step,duration,distance,threshold]);return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{position:\"relative\",width:0,height:0,pointerEvents:\"none\",...props.style}});}addPropertyControls(StaggerReveal,{target:{type:ControlType.Enum,title:\"Target\",options:[\"Previous sibling\",\"Parent\"],defaultValue:\"Previous sibling\"},step:{type:ControlType.Number,title:\"Stagger\",defaultValue:.12,min:0,max:.5,step:.01,unit:\"s\"},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:.9,min:.2,max:2,step:.05,unit:\"s\"},distance:{type:ControlType.Number,title:\"Distance\",defaultValue:28,min:0,max:80,step:1,unit:\"px\"},threshold:{type:ControlType.Number,title:\"Threshold\",defaultValue:.15,min:0,max:1,step:.05}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"StaggerReveal\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# source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