{"version":3,"file":"ScrollBlurEssential.BN_tg9hc.mjs","names":["useRef","useLayoutEffect","useEffect","__esmMin","init_npm_react_18_3_1","window","init_ssg_sandbox_shims","ce","le","p","c","init_jsx_runtime","de","useMotionValue","animate","init_framer_motion_DhsWWWsN","addPropertyControls","ControlType","RenderTarget","init_framer_DymZktPS","ScrollBlurEssential","props","isCanvas","containerRef","sb","active","idle","controls","useIsoLayoutEffect","node","write","v","unsub","clearIdle","onScroll","FADE_IN","FADE_OUT","opts","gradientDir","direction","layers","step","LAYERS","i","b","BLUR","coverTop","mask","filter","FULL_VERSION_URL","init_ScrollBlurEssential"],"sources":["https:/framerusercontent.com/modules/g0EEw2HBNmjjK4UxgXhQ/8wGq4HgGH68xYmMACpNs/ScrollBlurEssential.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useLayoutEffect,useRef}from\"react\";import{animate,useMotionValue}from\"framer-motion\";// Locked default settings (the paid controls in the full version).\nconst BLUR=12;const FADE_IN={type:\"spring\",stiffness:300,damping:30};const FADE_OUT={type:\"spring\",stiffness:80,damping:26};const LAYERS=6;// Where the \"full version\" link points.\nconst FULL_VERSION_URL=\"https://buy.polar.sh/polar_cl_7CwEW1iCPM4xJVpmRbzgcZkgUnbbNd14Zc2Gl4VIj2M\";// Avoids the SSR warning for useLayoutEffect on Framer's published export.\nconst useIsoLayoutEffect=typeof window!==\"undefined\"?useLayoutEffect:useEffect;/**\n * SCROLL BLUR ESSENTIAL\n *\n * The free version of Scroll Blur. Direction is adjustable; Blur strength and\n * the Fade In/Out transitions are locked to the defaults (those are the paid\n * controls in the full version).\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerIntrinsicWidth 1200\n * @framerIntrinsicHeight 200\n */export default function ScrollBlurEssential(props){const{direction=\"bottom\"}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const containerRef=useRef(null);const sb=useMotionValue(0)// 0..1 blur strength\n;const active=useRef(false)// currently scrolling?\n;const idle=useRef(null);const controls=useRef(null);// Mirror the motion value onto a CSS variable (clamped >= 0 so a spring\n// undershoot can't produce an invalid negative blur radius). On the canvas\n// we hold it at full strength so the blur is visible while editing.\nuseIsoLayoutEffect(()=>{const node=containerRef.current;if(!node)return;const write=v=>node.style.setProperty(\"--sb\",String(Math.max(0,v)));write(sb.get());const unsub=sb.on(\"change\",write);if(isCanvas)sb.set(1);return unsub;},[isCanvas,sb]);useEffect(()=>{if(isCanvas)return;const HOLD_MS=180;const clearIdle=()=>{if(idle.current){clearTimeout(idle.current);idle.current=null;}};const onScroll=()=>{if(!active.current){active.current=true;controls.current=animate(sb,1,FADE_IN);}clearIdle();idle.current=setTimeout(()=>{active.current=false;controls.current=animate(sb,0,FADE_OUT);},HOLD_MS);};const opts={passive:true,capture:true};window.addEventListener(\"scroll\",onScroll,opts);return()=>{window.removeEventListener(\"scroll\",onScroll,opts);clearIdle();if(controls.current)controls.current.stop();};},[isCanvas,sb]);const gradientDir=direction===\"top\"?\"to bottom\":\"to top\";const layers=[];const step=100/LAYERS;for(let i=0;i<LAYERS;i++){const b=BLUR*(i+1)/LAYERS;const coverTop=100-i*step;const fadeStart=Math.max(0,coverTop-step);const mask=`linear-gradient(${gradientDir}, rgba(255,255,255,1) 0%, rgba(255,255,255,1) ${fadeStart}%, rgba(255,255,255,0) ${coverTop}%)`;const filter=`blur(calc(var(--sb, 0) * ${b}px))`;layers.push(/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,backdropFilter:filter,WebkitBackdropFilter:filter,WebkitMaskImage:mask,maskImage:mask}},i));}const containerStyle={position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",pointerEvents:\"none\"};// Canvas-only faint fill so the (otherwise transparent) component is visible\n// and grabbable when dropped. Never shown in preview or on the published site.\nconst placeholderStyle={position:\"absolute\",inset:0,background:\"rgba(138,138,155,0.12)\",borderRadius:6,pointerEvents:\"none\"};return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:containerStyle,children:[layers,isCanvas?/*#__PURE__*/_jsx(\"div\",{style:placeholderStyle}):null]});}ScrollBlurEssential.defaultProps={direction:\"bottom\"};// The Direction arrows are the one free control. Its description carries the\n// upgrade link, so the text sits directly below the arrows in the panel.\naddPropertyControls(ScrollBlurEssential,{direction:{type:ControlType.Enum,title:\"Direction\",options:[\"bottom\",\"top\"],optionTitles:[\"↑\",\"↓\"],displaySegmentedControl:true,defaultValue:\"bottom\",description:`Unlock Blur and Fade In / Out controls — [get the full version →](${FULL_VERSION_URL})`}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollBlurEssential\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"1200\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"200\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollBlurEssential.map"],"mappings":"A,8QAcG,SAAwBoB,EAAoB,EAAM,CAAC,GAAK,CAAC,YAAU,UAAUC,EAAYC,EAASJ,EAAa,QAAQ,IAAIA,EAAa,OAAaK,EAAavB,EAAO,IAAI,EAAQwB,EAAGX,EAAe,CAAC,EACpMY,EAAOzB,EAAO,EAAK,EACnB0B,EAAK1B,EAAO,IAAI,EAAQ2B,EAAS3B,EAAO,IAAI,EAGnD4B,MAAuB,CAAC,IAAMC,EAAKN,EAAa,QAAQ,GAAG,CAACM,EAAK,OAAO,IAAMC,EAAM,GAAGD,EAAK,MAAM,YAAY,OAAO,OAAO,KAAK,IAAI,EAAEE,CAAC,CAAC,CAAC,EAAED,EAAMN,EAAG,IAAI,CAAC,EAAE,IAAMQ,EAAMR,EAAG,GAAG,SAASM,CAAK,EAAwB,OAAnBR,GAASE,EAAG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