{"version":3,"file":"LocalSleepInCountdown.xEtvPdHJ.mjs","names":["useMemo","useCallback","useState"],"sources":["https:/framerusercontent.com/modules/Pcasmxs7zf6XC8UdA35w/V4R56xpvRINuKUY7SocC/LocalSleepInCountdown.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{startTransition,useCallback,useEffect,useMemo,useState}from\"react\";function getRemainingTime(target){const now=new Date;const diff=Math.max(0,target.getTime()-now.getTime());const totalSeconds=Math.floor(diff/1e3);const days=Math.floor(totalSeconds/86400);const hours=Math.floor(totalSeconds%86400/3600);const minutes=Math.floor(totalSeconds%3600/60);const seconds=totalSeconds%60;return{days,hours,minutes,seconds,isComplete:diff<=0};}/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function LocalSleepInCountdown(props){const{targetYear,targetMonth,targetDay,targetHour,targetMinute,showSeconds,accentColor,textColor,surfaceColor,borderColor,radius,compact,pulse,daysLabel,hoursLabel,minutesLabel,secondsLabel}=props;const targetDate=useMemo(()=>{return new Date(targetYear,targetMonth-1,targetDay,targetHour,targetMinute,0);},[targetYear,targetMonth,targetDay,targetHour,targetMinute]);const computeRemaining=useCallback(()=>getRemainingTime(targetDate),[targetDate]);const[remaining,setRemaining]=useState(()=>computeRemaining());useEffect(()=>{startTransition(()=>{setRemaining(computeRemaining());});if(typeof window===\"undefined\")return;const intervalId=window.setInterval(()=>{startTransition(()=>{setRemaining(computeRemaining());});},1e3);return()=>window.clearInterval(intervalId);},[computeRemaining]);const units=useMemo(()=>{const base=[{key:\"days\",value:remaining.days,label:daysLabel},{key:\"hours\",value:remaining.hours,label:hoursLabel},{key:\"minutes\",value:remaining.minutes,label:minutesLabel}];if(showSeconds){base.push({key:\"seconds\",value:remaining.seconds,label:secondsLabel});}return base;},[remaining.days,remaining.hours,remaining.minutes,remaining.seconds,daysLabel,hoursLabel,minutesLabel,secondsLabel,showSeconds]);const numberFontSize=compact?18:28;const labelFontSize=compact?8:10;const gap=compact?6:10;const padding=compact?\"7px 6px\":\"10px 12px\";const pulseScale=pulse&&!remaining.isComplete&&remaining.seconds%2===0?1:.985;const pulseOpacity=pulse&&!remaining.isComplete&&remaining.seconds%2===0?1:.95;return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",display:\"flex\",flexDirection:\"row\",alignItems:\"stretch\",justifyContent:\"flex-start\",gap,width:\"100%\",minWidth:0},\"aria-live\":\"polite\",role:\"status\",children:units.map(unit=>{const displayValue=unit.value.toString().padStart(2,\"0\");return /*#__PURE__*/_jsxs(\"div\",{style:{flex:1,minWidth:compact?0:60,background:surfaceColor,border:`1px solid ${borderColor}`,borderRadius:radius,padding,display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",boxSizing:\"border-box\",transform:`scale(${pulseScale})`,opacity:pulseOpacity,transition:\"transform 260ms ease, opacity 260ms ease\",overflow:\"hidden\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{color:textColor,fontSize:numberFontSize,lineHeight:1,fontWeight:700,letterSpacing:\"-0.03em\",whiteSpace:\"nowrap\"},children:displayValue}),/*#__PURE__*/_jsx(\"div\",{style:{marginTop:5,color:accentColor,fontSize:labelFontSize,lineHeight:1,fontWeight:700,textTransform:\"uppercase\",letterSpacing:\"0.08em\",whiteSpace:\"nowrap\"},children:unit.label})]},unit.key);})});}addPropertyControls(LocalSleepInCountdown,{targetYear:{type:ControlType.Number,title:\"Year\",defaultValue:2026,min:2024,max:2100,step:1},targetMonth:{type:ControlType.Number,title:\"Month\",defaultValue:7,min:1,max:12,step:1},targetDay:{type:ControlType.Number,title:\"Day\",defaultValue:11,min:1,max:31,step:1},targetHour:{type:ControlType.Number,title:\"Hour\",defaultValue:6,min:0,max:23,step:1},targetMinute:{type:ControlType.Number,title:\"Minute\",defaultValue:0,min:0,max:59,step:1},showSeconds:{type:ControlType.Boolean,title:\"Seconds\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\"},accentColor:{type:ControlType.Color,title:\"Accent\",defaultValue:\"#2E6BFF\"},textColor:{type:ControlType.Color,title:\"Numbers\",defaultValue:\"#0F1A3D\"},surfaceColor:{type:ControlType.Color,title:\"Surface\",defaultValue:\"#FFFBF4\"},borderColor:{type:ControlType.Color,title:\"Border\",defaultValue:\"#E9DFC9\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:12,min:0,max:32,step:1},compact:{type:ControlType.Boolean,title:\"Compact\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},pulse:{type:ControlType.Boolean,title:\"Pulse\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},daysLabel:{type:ControlType.String,title:\"Days Label\",defaultValue:\"Days\"},hoursLabel:{type:ControlType.String,title:\"Hours Label\",defaultValue:\"Hours\"},minutesLabel:{type:ControlType.String,title:\"Minutes Label\",defaultValue:\"Mins\"},secondsLabel:{type:ControlType.String,title:\"Seconds Label\",defaultValue:\"Secs\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LocalSleepInCountdown\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LocalSleepInCountdown.map"],"mappings":"sNAAuL,SAAS,EAAiB,EAAO,CAAC,IAAM,EAAI,IAAI,KAAW,EAAK,KAAK,IAAI,EAAE,EAAO,SAAS,CAAC,EAAI,SAAS,CAAC,CAAO,EAAa,KAAK,MAAM,EAAK,IAAI,CAAwK,MAAM,CAAC,KAAnK,KAAK,MAAM,EAAa,MAAM,CAA0I,MAA7H,KAAK,MAAM,EAAa,MAAM,KAAK,CAAgG,QAAjF,KAAK,MAAM,EAAa,KAAK,GAAG,CAAyD,QAA1C,EAAa,GAAqC,WAAW,GAAM,EAAE,CAGniB,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