{"version":3,"file":"GridFlowBackground.DE3FSib0.mjs","names":["useRef","useState","useMemo"],"sources":["https:/framerusercontent.com/modules/nYTmrCdjJmWKVH6Qy2Qr/ZOBz9KKSY71isdmjEAdJ/GridFlowBackground.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView}from\"framer-motion\";import{startTransition,useEffect,useMemo,useRef,useState}from\"react\";function mulberry32(seed){let a=seed>>>0;return function rand(){a|=0;a=a+1831565813|0;let t=Math.imul(a^a>>>15,1|a);t=t+Math.imul(t^t>>>7,61|t)^t;return((t^t>>>14)>>>0)/4294967296;};}function clamp(n,min,max){return Math.max(min,Math.min(max,n));}/**\n * Grid Flow Background\n *\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 400\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function GridFlowBackground(props){const{backgroundColor,gridColor,gridSize,gridLineWidth,flowEnabled,flowColors,flowCount,flowThickness,flowOpacity,flowMinDuration,flowMaxDuration,flowMinDelay,flowMaxDelay,seed,style}=props;const containerRef=useRef(null);const isInView=useInView(containerRef,{amount:.1});const isStatic=useIsStaticRenderer();const[size,setSize]=useState({width:0,height:0});useEffect(()=>{const win=typeof globalThis!==\"undefined\"?globalThis:undefined;if(!win)return;const el=containerRef.current;if(!el)return;const update=()=>{const rect=el.getBoundingClientRect();const w=Math.max(0,rect.width||0);const h=Math.max(0,rect.height||0);startTransition(()=>setSize({width:w,height:h}));};update();let ro=null;const ResizeObserverCtor=win.ResizeObserver;if(typeof ResizeObserverCtor===\"function\"){ro=new ResizeObserverCtor(()=>update());ro.observe(el);}else{win.addEventListener(\"resize\",update);}return()=>{if(ro)ro.disconnect();else win.removeEventListener(\"resize\",update);};},[]);const safeGridSize=Math.max(6,Math.round(gridSize||24));const safeGridLineWidth=clamp(gridLineWidth||1,1,6);const flows=useMemo(()=>{if(!flowEnabled)return[];if(!Number.isFinite(size.width)||!Number.isFinite(size.height))return[];if(size.width<=2||size.height<=2)return[];if(!Array.isArray(flowColors)||flowColors.length===0)return[];const rand=mulberry32(Math.floor(seed||1));const count=clamp(Math.floor(flowCount||0),0,40);const maxLinesX=Math.max(1,Math.floor(size.width/safeGridSize)+1);const maxLinesY=Math.max(1,Math.floor(size.height/safeGridSize)+1);const minDur=Math.max(.2,flowMinDuration||2.5);const maxDur=Math.max(minDur,flowMaxDuration||6);const minDel=Math.max(0,flowMinDelay||0);const maxDel=Math.max(minDel,flowMaxDelay||2);const out=[];for(let i=0;i<count;i++){const direction=rand()<.5?\"horizontal\":\"vertical\";const lineIndex=direction===\"horizontal\"?Math.floor(rand()*maxLinesY):Math.floor(rand()*maxLinesX);const c=flowColors[Math.floor(rand()*flowColors.length)]??\"#8855FF\";const dur=minDur+rand()*(maxDur-minDur);const del=minDel+rand()*(maxDel-minDel);const thick=Math.max(1,Math.round((flowThickness||2)*(.8+rand()*.6)))||2;const op=clamp((flowOpacity||.9)*(.65+rand()*.6),0,1);out.push({id:`${direction}-${lineIndex}-${i}`,direction,lineIndex,thickness:thick,color:c,duration:dur,delay:del,opacity:op});}return out;},[flowColors,flowCount,flowEnabled,flowMaxDelay,flowMaxDuration,flowMinDelay,flowMinDuration,flowOpacity,flowThickness,safeGridSize,seed,size.height,size.width]);const backgroundStyle=useMemo(()=>{const s={position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",backgroundColor,backgroundImage:`\nlinear-gradient(to right, ${gridColor} ${safeGridLineWidth}px, transparent ${safeGridLineWidth}px),\nlinear-gradient(to bottom, ${gridColor} ${safeGridLineWidth}px, transparent ${safeGridLineWidth}px)\n`.trim(),backgroundSize:`${safeGridSize}px ${safeGridSize}px`,backgroundPosition:\"0 0\"};return s;},[backgroundColor,gridColor,safeGridLineWidth,safeGridSize]);const shouldAnimate=flowEnabled&&!isStatic&&isInView;return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...backgroundStyle,...style},children:flows.map(f=>{const top=f.direction===\"horizontal\"?f.lineIndex*safeGridSize:0;const left=f.direction===\"vertical\"?f.lineIndex*safeGridSize:0;const common={position:\"absolute\",pointerEvents:\"none\",opacity:f.opacity,top,left,width:f.direction===\"horizontal\"?\"100%\":`${f.thickness}px`,height:f.direction===\"horizontal\"?`${f.thickness}px`:\"100%\",transform:f.direction===\"horizontal\"?`translateY(-${f.thickness/2}px)`:`translateX(-${f.thickness/2}px)`,backgroundRepeat:\"no-repeat\",backgroundSize:f.direction===\"horizontal\"?\"200% 100%\":\"100% 200%\",backgroundImage:f.direction===\"horizontal\"?`linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 44%, ${f.color} 50%, rgba(0,0,0,0) 56%, rgba(0,0,0,0) 100%)`:`linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 44%, ${f.color} 50%, rgba(0,0,0,0) 56%, rgba(0,0,0,0) 100%)`,filter:\"blur(0.2px)\",willChange:shouldAnimate?\"background-position\":undefined};if(!shouldAnimate){return /*#__PURE__*/_jsx(\"div\",{style:{...common,backgroundPosition:\"50% 50%\"}},f.id);}return /*#__PURE__*/_jsx(motion.div,{style:common,initial:{backgroundPosition:f.direction===\"horizontal\"?\"-100% 50%\":\"50% -100%\"},animate:{backgroundPosition:f.direction===\"horizontal\"?\"100% 50%\":\"50% 100%\"},transition:{duration:f.duration,ease:\"linear\",repeat:Infinity,delay:f.delay}},f.id);})});}addPropertyControls(GridFlowBackground,{backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},gridColor:{type:ControlType.Color,title:\"Grid\",defaultValue:\"#EEEEEE\"},gridSize:{type:ControlType.Number,title:\"Grid Size\",defaultValue:24,min:6,max:80,step:1,unit:\"px\"},gridLineWidth:{type:ControlType.Number,title:\"Line Width\",defaultValue:1,min:1,max:6,step:1,unit:\"px\"},flowEnabled:{type:ControlType.Boolean,title:\"Flow\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},flowColors:{type:ControlType.Array,title:\"Flow Colors\",control:{type:ControlType.Color,title:\"Color\",defaultValue:\"#8855FF\"},maxCount:6,defaultValue:[\"#8855FF\",\"#FF5588\",\"#0099FF\"],hidden:({flowEnabled})=>!flowEnabled},flowCount:{type:ControlType.Number,title:\"Flow Count\",defaultValue:6,min:0,max:40,step:1,hidden:({flowEnabled})=>!flowEnabled},flowThickness:{type:ControlType.Number,title:\"Flow Thickness\",defaultValue:2,min:1,max:10,step:1,unit:\"px\",hidden:({flowEnabled})=>!flowEnabled},flowOpacity:{type:ControlType.Number,title:\"Flow Opacity\",defaultValue:.9,min:0,max:1,step:.05,hidden:({flowEnabled})=>!flowEnabled},flowMinDuration:{type:ControlType.Number,title:\"Min Duration\",defaultValue:2.5,min:.2,max:20,step:.1,unit:\"s\",hidden:({flowEnabled})=>!flowEnabled},flowMaxDuration:{type:ControlType.Number,title:\"Max Duration\",defaultValue:6,min:.2,max:30,step:.1,unit:\"s\",hidden:({flowEnabled})=>!flowEnabled},flowMinDelay:{type:ControlType.Number,title:\"Min Delay\",defaultValue:0,min:0,max:10,step:.1,unit:\"s\",hidden:({flowEnabled})=>!flowEnabled},flowMaxDelay:{type:ControlType.Number,title:\"Max Delay\",defaultValue:2,min:0,max:10,step:.1,unit:\"s\",hidden:({flowEnabled})=>!flowEnabled},seed:{type:ControlType.Number,title:\"Seed\",defaultValue:1,min:1,max:99999,step:1,hidden:({flowEnabled})=>!flowEnabled}});GridFlowBackground.displayName=\"GridFlowBackground\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GridFlowBackground\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\",\"framerIntrinsicHeight\":\"400\",\"framerIntrinsicWidth\":\"600\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GridFlowBackground.map"],"mapp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