{"version":3,"file":"EdgeBlur.CSJr9qHm.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/TDiYfuGKte1yJHS75ta4/rqTX0oPwWRm62XV3Z4Rl/EdgeBlur.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useState}from\"react\";import{createPortal}from\"react-dom\";function band(side,height,blur,tint,visible,fadeIn,fadeOut,zIndex){const dir=side===\"top\"?\"to bottom\":\"to top\";// Three stacked layers = progressive blur (strong at the edge, none\n// towards the centre).\nconst layers=[1,.55,.25].map((f,i)=>{const stop=Math.round(100*(.35+i*.25));const s={position:\"absolute\",inset:0,backdropFilter:`blur(${Math.max(blur*f,0)}px)`,WebkitBackdropFilter:`blur(${Math.max(blur*f,0)}px)`,maskImage:`linear-gradient(${dir}, black 0%, transparent ${stop}%)`,WebkitMaskImage:`linear-gradient(${dir}, black 0%, transparent ${stop}%)`};return /*#__PURE__*/_jsx(\"div\",{style:s},i);});const wrap={position:\"fixed\",left:0,right:0,[side]:0,height,pointerEvents:\"none\",zIndex,opacity:visible?1:0,transition:`opacity ${visible?fadeIn:fadeOut}s ease`,background:tint?`linear-gradient(${dir}, ${tint}, transparent)`:undefined};return /*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":\"true\",style:wrap,children:layers},side);}// Render next to the navbar so \"below the navbar\" always holds.\nfunction findHost(){const nav=document.querySelector(\"nav\");let e=nav;while(e&&e!==document.body){if(getComputedStyle(e).position===\"fixed\"&&e.parentElement)return e.parentElement;e=e.parentElement;}return document.body;}/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function EdgeBlur(props){const{mode,topHeight,bottomHeight,blur,tint,fadeIn,fadeOut,idle,zIndex}=props;const always=mode!==\"scroll\";const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[host,setHost]=useState(null);const[scrolling,setScrolling]=useState(false);const[atTop,setAtTop]=useState(true);const[atBottom,setAtBottom]=useState(false);useEffect(()=>{if(isCanvas||typeof window===\"undefined\")return;setHost(findHost());if(always)return;let timer=0;let first=true;const onScroll=()=>{const y=window.scrollY;const max=document.documentElement.scrollHeight-window.innerHeight;setAtTop(y<20);setAtBottom(y>max-20);if(first){first=false;return;}setScrolling(true);window.clearTimeout(timer);timer=window.setTimeout(()=>setScrolling(false),Math.max(idle||.35,.1)*1e3);};onScroll();window.addEventListener(\"scroll\",onScroll,{passive:true});return()=>{window.removeEventListener(\"scroll\",onScroll);window.clearTimeout(timer);};},[isCanvas,idle,always]);if(isCanvas){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",border:\"1px dashed rgba(136,85,255,.6)\",borderRadius:4}});}if(!host)return null;const showTop=always||scrolling&&!atTop;const showBottom=always||scrolling&&!atBottom;const t=tint&&!/rgba\\([^)]*,\\s*0\\)$/.test(tint)?tint:\"\";return /*#__PURE__*/createPortal(/*#__PURE__*/_jsxs(_Fragment,{children:[band(\"top\",topHeight,blur,t,showTop,fadeIn,fadeOut,zIndex),band(\"bottom\",bottomHeight,blur,t,showBottom,fadeIn,fadeOut,zIndex)]}),host);}EdgeBlur.defaultProps={mode:\"always\",topHeight:160,bottomHeight:160,blur:12,tint:\"rgba(0, 0, 0, 0)\",fadeIn:.25,fadeOut:.6,idle:.35,zIndex:9};addPropertyControls(EdgeBlur,{mode:{type:ControlType.Enum,title:\"Show\",options:[\"always\",\"scroll\"],optionTitles:[\"Always\",\"While scrolling\"],displaySegmentedControl:true,defaultValue:\"always\"},topHeight:{type:ControlType.Number,title:\"Top\",defaultValue:160,min:0,max:600,unit:\"px\"},bottomHeight:{type:ControlType.Number,title:\"Bottom\",defaultValue:160,min:0,max:600,unit:\"px\"},blur:{type:ControlType.Number,title:\"Blur\",defaultValue:12,min:0,max:40,unit:\"px\"},tint:{type:ControlType.Color,title:\"Tint\",defaultValue:\"rgba(0, 0, 0, 0)\",description:\"Optional soft colour at the edges. Transparent = blur only.\"},fadeIn:{type:ControlType.Number,title:\"Fade in\",defaultValue:.25,min:0,max:2,step:.05,unit:\"s\",hidden:p=>p.mode!==\"scroll\"},fadeOut:{type:ControlType.Number,title:\"Fade out\",defaultValue:.6,min:0,max:3,step:.05,unit:\"s\",hidden:p=>p.mode!==\"scroll\"},idle:{type:ControlType.Number,title:\"Hide after\",defaultValue:.35,min:.1,max:3,step:.05,unit:\"s\",description:\"Seconds without scrolling before the bands fade out.\",hidden:p=>p.mode!==\"scroll\"},zIndex:{type:ControlType.Number,title:\"Z index\",defaultValue:9,min:0,max:100,description:\"Keep it lower than the navbar (10).\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"EdgeBlur\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./EdgeBlur.map"],"mappings":"kOAA0N,SAAS,EAAK,EAAK,EAAO,EAAK,EAAK,EAAQ,EAAO,EAAQ,EAAO,CAAC,IAAM,EAAI,IAAO,MAAM,YAAY,SAE1T,EAAO,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,IAAM,EAAK,KAAK,MAAM,KAAK,IAAI,EAAE,IAAI,EAA0R,OAAoB,EAAK,MAAM,CAAC,MAAM,CAArT,SAAS,WAAW,MAAM,EAAE,eAAe,QAAQ,KAAK,IAAI,EAAK,EAAE,CAAC,EAAE,KAAK,qBAAqB,QAAQ,KAAK,IAAI,EAAK,EAAE,CAAC,EAAE,KAAK,UAAU,mBAAmB,EAAI,0BAA0B,EAAK,IAAI,gBAAgB,mBAAmB,EAAI,0BAA0B,EAAK,GAA2C,CAAC,EAAE,CAAC,CAAE,CAAC,EAA8O,OAAoB,EAAK,MAAM,CAAC,cAAc,OAAO,MAAM,CA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