{"version":3,"file":"CountdownTimer.BnOanLEw.mjs","names":["useState","useRef","useCallback","useMemo"],"sources":["https:/framerusercontent.com/modules/qaE1vi0dWZHnT5qHQ8CL/21GfF0BEfmvhKjUZs8s5/CountdownTimer.js"],"sourcesContent":["// Update CountdownTimer for announcement-bar countdown display with optional unit labels, separators, compact spacing controls, and label positioning while preserving existing behavior and controls.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef,useMemo,useCallback,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";function getTimeLeft(dateString){if(!dateString)return{total:0,days:0,hours:0,minutes:0,seconds:0};const now=new Date().getTime();const target=new Date(dateString).getTime();const diff=Math.max(0,target-now);const seconds=Math.floor(diff/1e3%60);const minutes=Math.floor(diff/(1e3*60)%60);const hours=Math.floor(diff/(1e3*60*60)%24);const days=Math.floor(diff/(1e3*60*60*24));return{total:diff,days,hours,minutes,seconds};}function parseSimpleBoldLabel(input){if(!input)return[];const tokenRegex=/(<\\/?(?:strong|b)>)/gi;const tokens=input.split(tokenRegex);const parts=[];let isBold=false;for(const token of tokens){const lower=token.toLowerCase();if(lower===\"<strong>\"||lower===\"<b>\"){isBold=true;continue;}if(lower===\"</strong>\"||lower===\"</b>\"){isBold=false;continue;}if(token.length>0){parts.push({text:token,bold:isBold});}}return parts;}/**\n * Responsive Countdown Timer\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function CountdownTimer(props){const{targetDate,label,completionMessage,font,fontFamilyText,fontWeightNumber,labelFontWeightNumber,timerFontSize,labelFontSize,fontColor,backgroundColor,borderRadius,showUnitLabels,dayLabel,hourLabel,minuteLabel,secondLabel,separator,timerDirection,labelPosition,contentGap,itemGap,paddingY,paddingX,style}=props;const resolvedFontFamily=fontFamilyText&&fontFamilyText.trim()?fontFamilyText:font.fontFamily;const resolvedFontWeight=Number.isFinite(fontWeightNumber)?fontWeightNumber:font.fontWeight;const[timeLeft,setTimeLeft]=useState(getTimeLeft(targetDate));const intervalRef=useRef(null);const updateTimeLeft=useCallback(()=>{startTransition(()=>setTimeLeft(getTimeLeft(targetDate)));},[targetDate]);useEffect(()=>{if(!targetDate)return;if(typeof window===\"undefined\")return;if(intervalRef.current)clearInterval(intervalRef.current);updateTimeLeft();intervalRef.current=window.setInterval(updateTimeLeft,1e3);return()=>{if(intervalRef.current)clearInterval(intervalRef.current);};},[targetDate,updateTimeLeft]);const isComplete=timeLeft.total<=0;const timerStyle={display:\"flex\",gap:itemGap,flexDirection:timerDirection===\"horizontal\"?\"row\":\"column\",flexWrap:\"nowrap\",whiteSpace:\"nowrap\",fontSize:timerFontSize,color:fontColor,fontWeight:resolvedFontWeight,fontFamily:resolvedFontFamily,lineHeight:font.lineHeight,letterSpacing:font.letterSpacing,textAlign:font.textAlign,justifyContent:\"center\",alignItems:\"center\",width:\"100%\",minWidth:0,maxWidth:\"100%\",fontVariantNumeric:\"tabular-nums\"};const units=useMemo(()=>[{value:timeLeft.days,label:dayLabel},{value:timeLeft.hours,label:hourLabel},{value:timeLeft.minutes,label:minuteLabel},{value:timeLeft.seconds,label:secondLabel}],[timeLeft.days,timeLeft.hours,timeLeft.minutes,timeLeft.seconds,dayLabel,hourLabel,minuteLabel,secondLabel]);const parsedLabelParts=useMemo(()=>parseSimpleBoldLabel(label),[label]);const labelElement=label&&labelPosition!==\"hidden\"?/*#__PURE__*/_jsx(\"span\",{style:{...font,display:\"block\",color:fontColor,fontFamily:resolvedFontFamily,fontWeight:labelFontWeightNumber,fontSize:labelFontSize,opacity:.8,textAlign:\"center\",lineHeight:font.lineHeight,margin:0,maxWidth:\"100%\",whiteSpace:\"normal\",overflowWrap:\"anywhere\",wordBreak:\"break-word\"},children:parsedLabelParts.map((part,index)=>/*#__PURE__*/_jsx(\"span\",{style:{fontFamily:resolvedFontFamily,color:fontColor,fontWeight:part.bold?800:labelFontWeightNumber},children:part.text},`${part.text}-${index}`))}):null;return /*#__PURE__*/_jsxs(\"div\",{style:{...style,position:\"relative\",background:backgroundColor,borderRadius,padding:`${paddingY}px ${paddingX}px`,display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",minWidth:0,maxWidth:\"100%\",width:\"100%\",boxSizing:\"border-box\",gap:contentGap},children:[labelPosition===\"above\"?labelElement:null,isComplete?/*#__PURE__*/_jsx(\"span\",{style:{...font,color:fontColor,fontFamily:resolvedFontFamily,fontWeight:resolvedFontWeight,fontSize:timerFontSize,textAlign:\"center\"},children:completionMessage}):/*#__PURE__*/_jsx(\"div\",{style:timerStyle,\"aria-live\":\"polite\",role:\"timer\",children:units.map((unit,index)=>/*#__PURE__*/_jsxs(\"span\",{style:{display:\"inline-flex\",alignItems:\"center\",gap:itemGap},children:[/*#__PURE__*/_jsx(TimeBlock,{value:unit.value,unitLabel:unit.label,showUnitLabels:showUnitLabels,font:font,fontColor:fontColor,fontFamily:resolvedFontFamily,fontWeight:resolvedFontWeight,timerFontSize:timerFontSize}),index<units.length-1?/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{opacity:.8},children:separator}):null]},`${unit.label}-${index}`))}),labelPosition===\"below\"?labelElement:null]});}function TimeBlock({value,unitLabel,showUnitLabels,font,fontColor,fontFamily,fontWeight,timerFontSize}){return /*#__PURE__*/_jsxs(\"span\",{style:{display:\"inline-flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",minWidth:24,lineHeight:1},children:[/*#__PURE__*/_jsx(\"span\",{style:{fontVariantNumeric:\"tabular-nums\",fontWeight,fontFamily},children:String(value).padStart(2,\"0\")}),showUnitLabels?/*#__PURE__*/_jsx(\"span\",{style:{...font,color:fontColor,fontFamily,fontWeight,fontSize:Math.max(10,timerFontSize*.35),opacity:.75,lineHeight:1},children:unitLabel}):null]});}addPropertyControls(CountdownTimer,{targetDate:{type:ControlType.Date,title:\"Target Date\",displayTime:true,defaultValue:new Date(Date.now()+24*60*60*1e3).toJSON()},label:{type:ControlType.String,title:\"Timer Label\",defaultValue:\"Countdown to Launch\"},completionMessage:{type:ControlType.String,title:\"Completion Message\",defaultValue:\"Time's up!\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"32px\",variant:\"Bold\",letterSpacing:\"-0.01em\",lineHeight:\"1.1em\"}},fontFamilyText:{type:ControlType.String,title:\"Font Family\",defaultValue:\"Instrument Sans\"},fontWeightNumber:{type:ControlType.Number,title:\"Font Weight\",defaultValue:700,min:100,max:900,step:100},labelFontWeightNumber:{type:ControlType.Number,title:\"Label Weight\",defaultValue:400,min:100,max:900,step:100},timerFontSize:{type:ControlType.Number,title:\"Timer Size\",defaultValue:24,min:8,max:120},labelFontSize:{type:ControlType.Number,title:\"Label Size\",defaultValue:18,min:8,max:120},fontColor:{type:ControlType.Color,title:\"Font Color\",defaultValue:\"#000000\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:64},showUnitLabels:{type:ControlType.Boolean,title:\"Show Units\",defaultValue:true},dayLabel:{type:ControlType.String,title:\"Day Label\",defaultValue:\"Day\"},hourLabel:{type:ControlType.String,title:\"Hour Label\",defaultValue:\"Hour\"},minuteLabel:{type:ControlType.String,title:\"Minute Label\",defaultValue:\"Minute\"},secondLabel:{type:ControlType.String,title:\"Second Label\",defaultValue:\"Second\"},separator:{type:ControlType.String,title:\"Separator\",defaultValue:\":\"},timerDirection:{type:ControlType.Enum,title:\"Direction\",defaultValue:\"horizontal\",options:[\"horizontal\",\"vertical\"],optionTitles:[\"Horizontal\",\"Vertical\"],displaySegmentedControl:true},labelPosition:{type:ControlType.Enum,title:\"Label Position\",defaultValue:\"above\",options:[\"above\",\"below\",\"hidden\"],optionTitles:[\"Above\",\"Below\",\"Hidden\"],displaySegmentedControl:true},contentGap:{type:ControlType.Number,title:\"Content Gap\",defaultValue:4,min:0,max:32},itemGap:{type:ControlType.Number,title:\"Item Gap\",defaultValue:4,min:0,max:24},paddingY:{type:ControlType.Number,title:\"Padding Y\",defaultValue:6,min:0,max:24},paddingX:{type:ControlType.Number,title:\"Padding X\",defaultValue:10,min:0,max:48}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountdownTimer\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CountdownTimer.map"],"mappings":"6NAC8L,SAAS,EAAY,EAAW,CAAC,GAAG,CAAC,EAAW,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,IAAM,EAAI,IAAI,MAAM,CAAC,SAAS,CAAO,EAAO,IAAI,KAAK,EAAW,CAAC,SAAS,CAAO,EAAK,KAAK,IAAI,EAAE,EAAO,EAAI,CAAO,EAAQ,KAAK,MAAM,EAAK,IAAI,GAAG,CAAO,EAAQ,KAAK,MAAM,GAAM,IAAI,IAAI,GAAG,CAAO,EAAM,KAAK,MAAM,GAAM,IAAI,GAAG,IAAI,GAAG,CAA4C,MAAM,CAAC,MAAM,EAAK,KAAlD,KAAK,MAAM,GAAM,IAAI,GAAG,GAAG,IAAI,CAAwB,QAAM,UAAQ,UAAQ,CAAE,SAAS,EAAqB,EAAM,CAAC,GAAG,CAAC,EAAM,MAAM,EAAE,CAA0C,IAAM,EAAO,EAAM,MAA3C,wBAA4D,CAAO,EAAM,EAAE,CAAK,EAAO,GAAM,IAAI,IAAM,KAAS,EAAO,CAAC,IAAM,EAAM,EAAM,aAAa,CAAC,GAAG,IAAQ,YAAY,IAAQ,MAAM,CAAC,EAAO,GAAK,SAAU,GAAG,IAAQ,aAAa,IAAQ,OAAO,CAAC,EAAO,GAAM,SAAa,EAAM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