{"version":3,"file":"Clock.BW9zOh63.mjs","names":["useState","useMemo"],"sources":["https:/framerusercontent.com/modules/AKiwB1FgmAw02ukE4OqX/810i8liFjBwoLA8siaTX/Clock.js"],"sourcesContent":["import{jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect,useMemo}from\"react\";const timeZones=typeof Intl!=\"undefined\"?Intl.supportedValuesOf(\"timeZone\"):[];/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function Clock(props){// Get the current time immediately without causing re-renders\nconst getCurrentTime=()=>{if(props.customTimeZone===\"auto\"){return new Date;}else{return new Date(new Date().toLocaleString(\"en-US\",{timeZone:props.customTimeZone}));}};// State for the clock\nconst[currentTime,setCurrentTime]=useState(getCurrentTime);// Effect to keep the time updated without any stutter\nuseEffect(()=>{const updateClock=()=>setCurrentTime(getCurrentTime());// Update immediately\nupdateClock();// Keep updating every second\nconst timerID=setInterval(updateClock,1e3);return()=>clearInterval(timerID);},[props.customTimeZone]);// Format AM/PM text\nconst ampmText=props.ampmCase===\"uppercase\"?[\"AM\",\"PM\"]:[\"am\",\"pm\"];// Format time\nconst hours=props.is12hour?currentTime.getHours()%12||12:currentTime.getHours();const minutes=currentTime.getMinutes().toString().padStart(2,\"0\");const seconds=props.seconds?`:${currentTime.getSeconds().toString().padStart(2,\"0\")}`:\"\";const ampm=props.is12hour?` ${currentTime.getHours()>=12?ampmText[1]:ampmText[0]}`:\"\";// Memoize time zone abbreviation to avoid unnecessary recalculations\nconst timeZoneAbbreviation=useMemo(()=>{if(!props.timeZone)return\"\";return\" \"+new Intl.DateTimeFormat(\"en-US\",{timeZone:props.customTimeZone===\"auto\"?undefined:props.customTimeZone,timeZoneName:\"short\"}).formatToParts(currentTime).find(part=>part.type===\"timeZoneName\").value;},[props.timeZone,props.customTimeZone,currentTime]);return /*#__PURE__*/_jsxs(\"p\",{style:{color:props.color,userSelect:props.textSelect?\"auto\":\"none\",margin:0,...props.font},children:[props.prefix,hours,\":\",minutes,seconds,ampm,timeZoneAbbreviation,props.suffix]});}// Property Controls\naddPropertyControls(Clock,{customTimeZone:{type:ControlType.Enum,defaultValue:\"auto\",options:[\"auto\",...timeZones],optionTitles:[\"Auto (Local)\",...timeZones],title:\"Time Zone\"},seconds:{type:ControlType.Boolean,defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\"},timeZone:{type:ControlType.Boolean,defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\",title:\"Time Zone Label\"},is12hour:{type:ControlType.Boolean,defaultValue:true,enabledTitle:\"12 Hour\",disabledTitle:\"24 Hour\",title:\"Mode\"},ampmCase:{type:ControlType.Enum,defaultValue:\"uppercase\",options:[\"uppercase\",\"lowercase\"],optionTitles:[\"AM / PM\",\"am / pm\"],title:\"Case\",hidden(props){return!props.is12hour;}},color:{type:ControlType.Color,defaultValue:\"#000\",title:\"Font Color\"},font:{type:\"font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:16,lineHeight:1}},prefix:{type:ControlType.String},suffix:{type:ControlType.String},textSelect:{type:ControlType.Boolean,defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Clock\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Clock.map"],"mappings":"mLAGG,SAAwB,EAAM,EAAM,CACvC,IAAM,MAAuB,EAAM,iBAAiB,OAAe,IAAI,KAAkB,IAAI,KAAK,IAAI,MAAM,CAAC,eAAe,QAAQ,CAAC,SAAS,EAAM,eAAe,CAAC,CAAC,CAChK,CAAC,EAAY,GAAgBA,EAAS,EAAe,CAC1D,MAAc,CAAC,IAAM,MAAgB,EAAe,GAAgB,CAAC,CACrE,GAAa,CACb,IAAM,EAAQ,YAAY,EA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