{"version":3,"file":"ProgressLine.TGCAjLRI.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/k3jTjSFje3zRgl14vdo5/SN62pkU0oEslnazHwFQM/ProgressLine.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerIntrinsicWidth 300\n * @framerIntrinsicHeight 1\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n *\n * @framerDisableUnlink\n **/export function ProgressLine({direction=\"horizontal\",delay=0,lineColor=\"#000000\",triggerOnVisibility=true,replay=false,transition}){const[animate,setAnimate]=useState(\"start\");const[hasAnimated,setHasAnimated]=useState(false);const ref=useRef(null);const handleVisibility=entries=>{const[entry]=entries;if(entry.isIntersecting){if(!triggerOnVisibility||replay||!hasAnimated){setTimeout(()=>setAnimate(\"end\"),delay*1e3);setHasAnimated(true);}}else if(replay&&triggerOnVisibility){setAnimate(\"start\");}};useEffect(()=>{const observer=new IntersectionObserver(handleVisibility,{threshold:.1});if(ref.current)observer.observe(ref.current);return()=>observer.disconnect();},[triggerOnVisibility,replay,delay]);useEffect(()=>{if(!triggerOnVisibility){setTimeout(()=>setAnimate(\"end\"),delay*1e3);}},[triggerOnVisibility,delay]);const resolvedTransition={...transition,delay};const variants={start:{width:direction===\"horizontal\"?\"0%\":\"100%\",height:direction===\"vertical\"?\"0%\":\"100%\",transition:resolvedTransition},end:{width:\"100%\",height:\"100%\",transition:resolvedTransition}};return /*#__PURE__*/_jsx(motion.div,{ref:ref,style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(motion.div,{variants:variants,initial:\"start\",animate:animate,style:{position:\"absolute\",top:0,left:0,backgroundColor:lineColor,width:direction===\"horizontal\"?\"0%\":\"100%\",height:direction===\"vertical\"?\"0%\":\"100%\"}})});}addPropertyControls(ProgressLine,{direction:{type:ControlType.SegmentedEnum,title:\"Direction\",options:[\"horizontal\",\"vertical\"],defaultValue:\"horizontal\"},delay:{type:ControlType.Number,title:\"Delay (s)\",min:0,step:.1,defaultValue:0,displayStepper:true},lineColor:{type:ControlType.Color,title:\"Line Color\",defaultValue:\"#000000\"},triggerOnVisibility:{type:ControlType.Boolean,title:\"Trigger on Visibility\",defaultValue:false},replay:{type:ControlType.Boolean,title:\"Replay Animation\",defaultValue:true},transition:{type:ControlType.Transition,title:\"Transition\",defaultValue:{duration:1,ease:\"easeOut\"},description:\"\\n Made by [*Anagram*](https://anagram.supply/)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"ProgressLine\":{\"type\":\"reactComponent\",\"name\":\"ProgressLine\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"300\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"1\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProgressLine.map"],"mappings":"oOAQI,SAAgB,EAAa,CAAC,YAAU,aAAa,QAAM,EAAE,YAAU,UAAU,sBAAoB,GAAK,SAAO,GAAM,cAAY,CAAC,GAAK,CAAC,EAAQ,GAAYA,EAAS,QAAQ,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAAO,EAAIC,EAAO,KAAK,CAAO,EAAiB,GAAS,CAAC,GAAK,CAAC,GAAO,EAAW,EAAM,gBAAmB,CAAC,GAAqB,GAAQ,CAAC,KAAa,eAAe,EAAW,MAAM,CAAC,EAAM,IAAI,CAAC,EAAe,GAAK,EAAW,GAAQ,GAAqB,EAAW,QAAQ,EAAI,MAAc,CAAC,IAAM,EAAS,IAAI,qBAAqB,EAAiB,CAAC,UAAU,GAAG,CAAC,CAA8C,OAA1C,EAAI,SAAQ,EAAS,QAAQ,EAAI,QA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