{"version":3,"file":"Countdown.CLV6x0Ah.mjs","names":["useState","timeLeft"],"sources":["https:/framerusercontent.com/modules/HnLLXCUjRavoXVdLDugY/dDCAHcYLbiXI3PgceGTM/XOGxNtvsA.js","https:/framerusercontent.com/modules/cYbYz5Kjkd7hupF8Jhvd/gFbiqLIxPJdHXo9lGvEH/Countdown.js"],"sourcesContent":["// Generated by Framer (06534cb)\nimport{fontStore}from\"framer\";fontStore.loadFonts([\"GF;Geist-500\",\"GF;Geist-700\"]);export const fonts=[{explicitInter:true,fonts:[{family:\"Geist\",source:\"google\",style:\"normal\",url:\"https://fonts.gstatic.com/s/geist/v1/gyBhhwUxId8gMGYQMKR3pzfaWI_RruM4mJPby1QNtA.woff2\",weight:\"500\"},{family:\"Geist\",source:\"google\",style:\"normal\",url:\"https://fonts.gstatic.com/s/geist/v1/gyBhhwUxId8gMGYQMKR3pzfaWI_Re-Q4mJPby1QNtA.woff2\",weight:\"700\"}]}];export const css=['.framer-JG0RN .framer-styles-preset-ly49yt:not(.rich-text-wrapper), .framer-JG0RN .framer-styles-preset-ly49yt.rich-text-wrapper p { --framer-font-family: \"Geist\", \"Geist Placeholder\", sans-serif; --framer-font-family-bold: \"Geist\", \"Geist Placeholder\", sans-serif; --framer-font-open-type-features: normal; --framer-font-size: 14px; --framer-font-style: normal; --framer-font-style-bold: normal; --framer-font-variation-axes: normal; --framer-font-weight: 500; --framer-font-weight-bold: 700; --framer-letter-spacing: -0.03em; --framer-line-height: 1.2em; --framer-paragraph-spacing: 20px; --framer-text-alignment: start; --framer-text-color: var(--token-6c9f0706-c7df-4374-b4b0-8bf4d4d75293, #ffffff); --framer-text-decoration: none; --framer-text-stroke-color: initial; --framer-text-stroke-width: initial; --framer-text-transform: none; }'];export const className=\"framer-JG0RN\";\nexport const __FramerMetadata__ = {\"exports\":{\"fonts\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"className\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"css\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","// © Framer University. All rights reserved.\n// Distribution without written consent is prohibited.\nimport{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,spacerSize,displayDays,displayHours,displayMinutes,displaySeconds,endDate,endTime,endMessage}){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){const time={d:Math.floor(difference/(1e3*60*60*24)),h:Math.floor(difference/(1e3*60*60)%24),m:Math.floor(difference/(1e3*60)%60),s:Math.floor(difference/1e3%60)};timeLeft={days:displayDays?time.d:null,hours:displayHours?time.h:null,minutes:displayMinutes?time.m:null,seconds:displaySeconds?time.s:null};}return timeLeft;}const timerComponents=[];Object.keys(timeLeft).forEach((interval,index,arr)=>{if(timeLeft[interval]!==null){timerComponents.push(/*#__PURE__*/_jsxs(\"span\",{style:{display:\"flex\",alignItems:\"center\",flexDirection:\"column\"},children:[timeLeft[interval],/*#__PURE__*/_jsx(\"span\",{style:{fontSize:`${fontSize/1.8}px`},children:interval.toLowerCase()})]},interval));// Add spacer except after the last element\nif(index<arr.length-1){timerComponents.push(/*#__PURE__*/_jsx(\"span\",{style:{margin:`0 ${spacerSize}px`,fontSize,fontFamily,color:fontColor,fontWeight},children:\"|\"},`spacer-${interval}`));}}});return /*#__PURE__*/_jsx(\"div\",{style:{fontSize,fontFamily,color:fontColor,fontWeight,display:\"flex\",alignItems:\"center\"},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]},spacerSize:{type:ControlType.Number,unit:\"px\",defaultValue:10},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:\"2023-04-25\",description:\"YYYY-MM-DD\"},endTime:{type:ControlType.String,defaultValue:\"00:00:00\",description:\"HH:MM:SS\"},endMessage:{type:ControlType.String,defaultValue:\"Time's up!\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Countdown\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Countdown.map"],"mappings":"wTAC8B,EAAU,UAAU,CAAC,eAAe,eAAe,EAAe,EAAM,CAAC,CAAC,cAAc,GAAK,MAAM,CAAC,CAAC,OAAO,QAAQ,OAAO,SAAS,MAAM,SAAS,IAAI,wFAAwF,OAAO,MAAM,CAAC,CAAC,OAAO,QAAQ,OAAO,SAAS,MAAM,SAAS,IAAI,wFAAwF,OAAO,MAAM,CAAC,CAAC,CAAC,CAAc,EAAI,CAAC,60BAA60B,CAAc,EAAU,kBCC3pC,SAAwB,EAAU,CAAC,WAAS,aAAW,YAAU,aAAW,aAAW,cAAY,eAAa,iBAAe,iBAAe,UAAQ,UAAQ,aAAW,CAAC,CAAC,GAAK,CAAC,EAAS,EAAY,CAACA,EAAS,KAAqB,MAAc,CAAC,IAAM,EAAM,eAAe,CAAC,EAAY,IAAsB,EAAC,KAAK,UAAU,aAAa,EAAQ,GAAE,SAAS,GAAmB,CAAC,IAAM,EAAY,IA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