{"version":3,"file":"Progress_Bar.CaJVi4He.mjs","names":["useState","useRef","remaining"],"sources":["https:/framerusercontent.com/modules/6SakYCGuta6l0D2i689W/kUCXIZBmzxbl68vLRjq3/Progress_Bar.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect,useRef}from\"react\";import{motion,useMotionValue,useTransform,animate}from\"framer-motion\";/**\n * TimeProgressBar\n * A smooth, time-based progress bar for Framer.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight fixed\n */export default function TimeProgressBar({duration=10,autoPlay=true,loop=false,onComplete,trackColor=\"rgba(255,255,255,0.12)\",fillColor=\"#ffffff\",height=2,borderRadius=99,easing=\"linear\",showTimer=false,timerColor=\"rgba(255,255,255,0.4)\",timerFontSize=11,style}){const progress=useMotionValue(0)// 0 → 1\n;const widthPct=useTransform(progress,[0,1],[\"0%\",\"100%\"]);const[isPlaying,setIsPlaying]=useState(false);const[elapsed,setElapsed]=useState(0);const pausedAt=useRef(0);const animRef=useRef(null);const easingMap={linear:\"linear\",easeIn:[.4,0,1,1],easeOut:[0,0,.6,1],easeInOut:[.4,0,.6,1]};function play(from){animRef.current?.stop();const remaining=duration*(1-from);setIsPlaying(true);animRef.current=animate(progress,1,{duration:remaining,ease:easingMap[easing]??\"linear\",onUpdate:v=>setElapsed(v*duration),onComplete:()=>{if(loop){progress.set(0);pausedAt.current=0;play(0);}else{setIsPlaying(false);onComplete?.();}}});}function pause(){animRef.current?.stop();pausedAt.current=progress.get();setIsPlaying(false);}function reset(){animRef.current?.stop();progress.set(0);pausedAt.current=0;setElapsed(0);setIsPlaying(false);}// Start on mount if autoPlay\nuseEffect(()=>{reset();if(autoPlay)play(0);return()=>animRef.current?.stop();},[duration,loop,autoPlay,easing])// restart when props change\n;const handleClick=()=>{isPlaying?pause():play(pausedAt.current);};const remaining=Math.max(0,duration-elapsed);const mins=Math.floor(remaining/60);const secs=Math.floor(remaining%60);const timeLabel=mins>0?`${mins}:${String(secs).padStart(2,\"0\")}`:`${secs}s`;return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",display:\"flex\",flexDirection:\"column\",gap:8,cursor:\"pointer\",userSelect:\"none\",...style},onClick:handleClick,title:isPlaying?\"Pausar\":\"Play\",children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",height,borderRadius,background:trackColor,overflow:\"hidden\"},children:/*#__PURE__*/_jsx(motion.div,{style:{position:\"absolute\",top:0,left:0,height:\"100%\",borderRadius,background:fillColor,width:widthPct}})}),showTimer&&/*#__PURE__*/_jsxs(\"div\",{style:{fontSize:timerFontSize,color:timerColor,fontFamily:\"'SF Mono', 'Fira Code', 'Roboto Mono', monospace\",letterSpacing:\"0.04em\",display:\"flex\",justifyContent:\"space-between\"},children:[/*#__PURE__*/_jsxs(\"span\",{children:[Math.round(elapsed),\"s\"]}),/*#__PURE__*/_jsx(\"span\",{children:timeLabel})]})]});}TimeProgressBar.defaultProps={duration:10,autoPlay:true,loop:false,trackColor:\"rgba(255,255,255,0.12)\",fillColor:\"#ffffff\",height:2,borderRadius:99,easing:\"linear\",showTimer:false,timerColor:\"rgba(255,255,255,0.4)\",timerFontSize:11};addPropertyControls(TimeProgressBar,{duration:{type:ControlType.Number,title:\"Duration (s)\",defaultValue:10,min:1,max:3600,step:1,displayStepper:true},autoPlay:{type:ControlType.Boolean,title:\"Auto Play\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},easing:{type:ControlType.Enum,title:\"Easing\",defaultValue:\"linear\",options:[\"linear\",\"easeIn\",\"easeOut\",\"easeInOut\"],optionTitles:[\"Linear\",\"Ease In\",\"Ease Out\",\"Ease In Out\"]},fillColor:{type:ControlType.Color,title:\"Fill Color\",defaultValue:\"#ffffff\"},trackColor:{type:ControlType.Color,title:\"Track Color\",defaultValue:\"rgba(255,255,255,0.12)\"},height:{type:ControlType.Number,title:\"Height\",defaultValue:2,min:1,max:40,step:1,displayStepper:true},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:99,min:0,max:99,step:1},showTimer:{type:ControlType.Boolean,title:\"Show Timer\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},timerColor:{type:ControlType.Color,title:\"Timer Color\",defaultValue:\"rgba(255,255,255,0.4)\",hidden(props){return!props.showTimer;}},timerFontSize:{type:ControlType.Number,title:\"Timer Size\",defaultValue:11,min:8,max:24,step:1,hidden(props){return!props.showTimer;}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TimeProgressBar\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Progress_Bar.map"],"mappings":"uQAMG,SAAwB,EAAgB,CAAC,WAAS,GAAG,WAAS,GAAK,OAAK,GAAM,aAAW,aAAW,yBAAyB,YAAU,UAAU,SAAO,EAAE,eAAa,GAAG,SAAO,SAAS,YAAU,GAAM,aAAW,wBAAwB,gBAAc,GAAG,SAAO,CAAC,IAAM,EAAS,EAAe,EAAE,CAClS,EAAS,EAAa,EAAS,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAM,CAAC,EAAQ,GAAYA,EAAS,EAAE,CAAO,EAASC,EAAO,EAAE,CAAO,EAAQA,EAAO,KAAK,CAAO,EAAU,CAAC,OAAO,SAAS,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,EAAK,EAAK,CAAC,EAAQ,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