{"version":3,"file":"Countdown.DFx5uhz1.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/Va8z6KqvKG08tEGM2mfB/nrZfuPpUXYbGVgD8sNan/Countdown.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function Countdown({fontSize,fontFamily,fontColor,fontWeight,displayDays,displayHours,displayMinutes,displaySeconds,endDate,endTime,endMessage,labelDays,labelHours,labelMinutes,labelSeconds}){const[timeLeft,setTimeLeft]=useState(calculateTimeLeft());useEffect(()=>{const timer=setTimeout(()=>{setTimeLeft(calculateTimeLeft());},1e3);return()=>clearTimeout(timer);});function calculateTimeLeft(){const difference=+new Date(`${endDate}T${endTime}`)-+new Date;let timeLeft={};if(difference>0){timeLeft={days:displayDays?Math.floor(difference/(1e3*60*60*24)):null,hours:displayHours?Math.floor(difference/(1e3*60*60)%24):null,minutes:displayMinutes?Math.floor(difference/1e3/60%60):null,seconds:displaySeconds?Math.floor(difference/1e3%60):null};}return timeLeft;}const labels={days:labelDays,hours:labelHours,minutes:labelMinutes,seconds:labelSeconds};const timerComponents=[];Object.keys(timeLeft).forEach(interval=>{if(timeLeft[interval]==null)return;timerComponents.push(/*#__PURE__*/_jsxs(\"span\",{style:{display:\"flex\",alignItems:\"center\",flexDirection:\"column\"},children:[timeLeft[interval],/*#__PURE__*/_jsx(\"span\",{style:{fontSize:`${fontSize/2.5}px`},children:labels[interval]})]},interval));});return /*#__PURE__*/_jsx(\"div\",{style:{fontSize,fontFamily,color:fontColor,fontWeight,display:\"flex\",gap:\"20px\"},children:timerComponents.length?timerComponents:/*#__PURE__*/_jsx(\"span\",{children:endMessage})});}addPropertyControls(Countdown,{fontSize:{type:ControlType.Number,unit:\"px\",defaultValue:30},fontFamily:{type:ControlType.String,defaultValue:\"Inter\"},fontColor:{type:ControlType.Color,defaultValue:\"black\"},fontWeight:{type:ControlType.Enum,defaultValue:400,options:[\"normal\",\"bold\",\"bolder\",\"lighter\",100,200,300,400,500,600,700,800,900]},displayDays:{type:ControlType.Boolean,defaultValue:true},displayHours:{type:ControlType.Boolean,defaultValue:true},displayMinutes:{type:ControlType.Boolean,defaultValue:true},displaySeconds:{type:ControlType.Boolean,defaultValue:true},endDate:{type:ControlType.String,defaultValue:\"2025-12-31\",description:\"YYYY-MM-DD\"},endTime:{type:ControlType.String,defaultValue:\"00:00:00\",description:\"HH:MM:SS\"},endMessage:{type:ControlType.String,defaultValue:\"\\xa1Tiempo agotado!\"},labelDays:{type:ControlType.String,defaultValue:\"D\\xedas\"},labelHours:{type:ControlType.String,defaultValue:\"Horas\"},labelMinutes:{type:ControlType.String,defaultValue:\"Minutos\"},labelSeconds:{type:ControlType.String,defaultValue:\"Segundos\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Countdown\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Countdown.map"],"mappings":"wLAAmJ,SAAwB,EAAU,CAAC,WAAS,aAAW,YAAU,aAAW,cAAY,eAAa,iBAAe,iBAAe,UAAQ,UAAQ,aAAW,YAAU,aAAW,eAAa,gBAAc,CAAC,GAAK,CAAC,EAAS,GAAaA,EAAS,EAAkB,CAAC,EAAE,MAAc,CAAC,IAAM,EAAM,eAAe,CAAC,EAAY,EAAkB,CAAC,CAAE,EAAE,GAAG,EAAE,UAAU,aAAa,CAAK,CAAE,CAAC,EAAE,SAAS,GAAmB,CAAC,IAAM,EAAY,IAAI,KAAK,GAAG,EAAQ,GAAG,GAAS,EAAE,CAAC,IAAI,KAAS,EAAS,CAAC,EAAgR,OAA3Q,EAAW,IAAG,EAAS,CAAC,KAAK,EAAY,KAAK,MAAM,GAAY,IAAI,GAAG,GAAG,GAAG,EAAE,KAAK,MAAM,EAAa,KAAK,MAAM,GAAY,IAAI,GAAG,IAAI,EAAE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