{"version":3,"file":"SimpleTimezoneClock.C8juzbc_.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/DsvunnWdHjhwra6lWS43/cOwWfcLmXODeRGEPkHae/SimpleTimezoneClock.js"],"sourcesContent":["// Framer component that displays the local time for a specific area set by the user.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function SimpleTimezoneClock(props){const{timezone=\"My Location\",use24Hour=false,showSeconds=true,showDayOfWeek=false,separator=\":\",textColor=\"#000000\",font,leadingZero=false,textCase=\"normal\",style}=props;const[time,setTime]=useState(\"\");const[timeSegments,setTimeSegments]=useState([]);const isStatic=useIsStaticRenderer();useEffect(()=>{const updateTime=()=>{try{const now=new Date;// Detect visitor's timezone if \"My Location\" is selected\nconst effectiveTimezone=timezone===\"My Location\"?Intl.DateTimeFormat().resolvedOptions().timeZone:timezone;const options={timeZone:effectiveTimezone,hour:\"2-digit\",minute:\"2-digit\",...showSeconds&&{second:\"2-digit\"},hour12:!use24Hour};const formatter=new Intl.DateTimeFormat(\"en-US\",options);const formattedTime=formatter.format(now);// Remove leading zero from hours in 12-hour format if leadingZero is false\nlet processedTime=formattedTime;if(!use24Hour&&!leadingZero){// Remove leading zero from hour (e.g., \"04:31:45 PM\" -> \"4:31:45 PM\")\nprocessedTime=formattedTime.replace(/^0/,\"\");}// Replace colons with custom separator\nconst customTime=processedTime.replace(/:/g,separator);// Parse the time into segments\nconst segments=[];// Add day of week if enabled\nif(showDayOfWeek){const dayOptions={timeZone:effectiveTimezone,weekday:\"short\"};const dayFormatter=new Intl.DateTimeFormat(\"en-US\",dayOptions);let dayOfWeek=dayFormatter.format(now);// Apply text case transformation to day of week\nif(textCase===\"uppercase\"){dayOfWeek=dayOfWeek.toUpperCase();}else if(textCase===\"lowercase\"){dayOfWeek=dayOfWeek.toLowerCase();}segments.push({type:\"day\",content:dayOfWeek});segments.push({type:\"space\",content:\" \"});}// Parse time string into digits and separators\nconst timeWithoutAmPm=customTime.replace(/\\s?(AM|PM|am|pm)$/i,\"\");const ampmMatch=customTime.match(/\\s?(AM|PM|am|pm)$/i);for(let i=0;i<timeWithoutAmPm.length;i++){const char=timeWithoutAmPm[i];if(/\\d/.test(char)){segments.push({type:\"digit\",content:char});}else{segments.push({type:\"separator\",content:char});}}// Add AM/PM if present\nif(ampmMatch){let ampm=ampmMatch[1];// Apply text case transformation to AM/PM\nif(textCase===\"uppercase\"){ampm=ampm.toUpperCase();}else if(textCase===\"lowercase\"){ampm=ampm.toLowerCase();}segments.push({type:\"space\",content:\" \"});segments.push({type:\"ampm\",content:ampm});}startTransition(()=>{setTimeSegments(segments);setTime(customTime);});}catch(error){startTransition(()=>{setTime(\"Invalid timezone\");setTimeSegments([]);});}};updateTime();// Skip interval in static renderer\nif(isStatic)return;const interval=setInterval(updateTime,1e3);return()=>clearInterval(interval);},[timezone,use24Hour,showSeconds,showDayOfWeek,separator,leadingZero,textCase,isStatic]);// If there's an error, show the error message\nif(timeSegments.length===0&&time){return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",display:\"inline-block\",width:\"max-content\",minWidth:\"max-content\",color:textColor,backgroundColor:\"transparent\",...font},children:time});}return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",display:\"inline-block\",width:\"max-content\",minWidth:\"max-content\",color:textColor,backgroundColor:\"transparent\",...font},children:timeSegments.map((segment,index)=>{if(segment.type===\"digit\"){return /*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",width:\"0.6em\",textAlign:\"center\"},children:segment.content},index);}else if(segment.type===\"ampm\"){return /*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",width:\"2em\",textAlign:\"left\"},children:segment.content},index);}else{return /*#__PURE__*/_jsx(\"span\",{children:segment.content},index);}})});}addPropertyControls(SimpleTimezoneClock,{timezone:{type:ControlType.Enum,title:\"Timezone\",defaultValue:\"My Location\",options:[\"My Location\",// Americas\n\"America/New_York\",\"America/Chicago\",\"America/Denver\",\"America/Los_Angeles\",\"America/Anchorage\",\"America/Toronto\",\"America/Vancouver\",\"America/Mexico_City\",\"America/Sao_Paulo\",\"America/Buenos_Aires\",\"America/Santiago\",\"America/Lima\",\"America/Bogota\",\"America/Caracas\",\"America/Panama\",\"America/Costa_Rica\",\"America/Guatemala\",\"America/Havana\",\"America/Jamaica\",\"America/Montevideo\",\"America/La_Paz\",\"America/Guayaquil\",\"America/Asuncion\",// Europe\n\"Europe/London\",\"Europe/Paris\",\"Europe/Berlin\",\"Europe/Madrid\",\"Europe/Rome\",\"Europe/Amsterdam\",\"Europe/Brussels\",\"Europe/Vienna\",\"Europe/Stockholm\",\"Europe/Copenhagen\",\"Europe/Oslo\",\"Europe/Helsinki\",\"Europe/Warsaw\",\"Europe/Prague\",\"Europe/Budapest\",\"Europe/Athens\",\"Europe/Istanbul\",\"Europe/Moscow\",\"Europe/Zurich\",\"Europe/Lisbon\",\"Europe/Dublin\",\"Europe/Kiev\",\"Europe/Bucharest\",\"Europe/Sofia\",\"Europe/Belgrade\",\"Europe/Zagreb\",\"Europe/Luxembourg\",// Asia\n\"Asia/Dubai\",\"Asia/Tokyo\",\"Asia/Shanghai\",\"Asia/Hong_Kong\",\"Asia/Singapore\",\"Asia/Seoul\",\"Asia/Bangkok\",\"Asia/Jakarta\",\"Asia/Manila\",\"Asia/Taipei\",\"Asia/Kolkata\",\"Asia/Karachi\",\"Asia/Dhaka\",\"Asia/Tehran\",\"Asia/Jerusalem\",\"Asia/Riyadh\",\"Asia/Kuwait\",\"Asia/Beirut\",\"Asia/Baghdad\",\"Asia/Kabul\",\"Asia/Tashkent\",\"Asia/Almaty\",\"Asia/Yangon\",\"Asia/Kathmandu\",\"Asia/Colombo\",\"Asia/Kuala_Lumpur\",\"Asia/Ho_Chi_Minh\",\"Asia/Phnom_Penh\",\"Asia/Vientiane\",\"Asia/Ulaanbaatar\",// Pacific\n\"Pacific/Auckland\",\"Australia/Sydney\",\"Australia/Melbourne\",\"Australia/Brisbane\",\"Australia/Perth\",\"Australia/Adelaide\",\"Pacific/Fiji\",\"Pacific/Honolulu\",\"Pacific/Guam\",\"Pacific/Tahiti\",\"Pacific/Port_Moresby\",\"Pacific/Noumea\",\"Pacific/Tongatapu\",\"Pacific/Apia\",// Africa\n\"Africa/Cairo\",\"Africa/Johannesburg\",\"Africa/Lagos\",\"Africa/Nairobi\",\"Africa/Casablanca\",\"Africa/Algiers\",\"Africa/Tunis\",\"Africa/Accra\",\"Africa/Addis_Ababa\",\"Africa/Dar_es_Salaam\",\"Africa/Kampala\",\"Africa/Khartoum\",\"Africa/Kinshasa\",\"Africa/Luanda\",\"Africa/Maputo\",// Atlantic\n\"Atlantic/Reykjavik\",\"Atlantic/Azores\",\"Atlantic/Cape_Verde\",\"Atlantic/Bermuda\",\"Atlantic/Canary\"]},use24Hour:{type:ControlType.Boolean,title:\"24-Hour Format\",defaultValue:false,enabledTitle:\"24h\",disabledTitle:\"12h\"},leadingZero:{type:ControlType.Boolean,title:\"Leading Zero\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\",hidden:({use24Hour})=>use24Hour},showDayOfWeek:{type:ControlType.Boolean,title:\"Show Day\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},showSeconds:{type:ControlType.Boolean,title:\"Show Seconds\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},separator:{type:ControlType.String,title:\"Separator\",defaultValue:\":\",placeholder:\":\"},textCase:{type:ControlType.Enum,title:\"Text Case\",defaultValue:\"normal\",options:[\"normal\",\"uppercase\",\"lowercase\"],optionTitles:[\"Normal\",\"Uppercase\",\"Lowercase\"]},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"16px\",variant:\"Regular\",letterSpacing:\"-0.03em\",lineHeight:\"1em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SimpleTimezoneClock\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SimpleTimezoneClock.map"],"mappings":"gMAIG,SAAwB,EAAoB,EAAM,CAAC,GAAK,CAAC,WAAS,cAAc,YAAU,GAAM,cAAY,GAAK,gBAAc,GAAM,YAAU,IAAI,YAAU,UAAU,OAAK,cAAY,GAAM,WAAS,SAAS,SAAO,EAAW,CAAC,EAAK,GAASA,EAAS,EAAE,EAAO,CAAC,EAAa,GAAiBA,EAAS,CAAC,CAAC,EAAQ,EAAS,EAAoB,EAYrG,OAZuG,MAAc,CAAC,IAAM,MAAe,CAAC,GAAG,CAAC,IAAM,EAAI,IAAI,KACxY,EAAkB,IAAW,cAAc,KAAK,eAAe,CAAC,CAAC,gBAAgB,CAAC,CAAC,SAAS,EAAe,EAAQ,CAAC,SAAS,EAAkB,KAAK,UAAU,OAAO,UAAU,GAAG,GAAa,CAAC,OAAO,SAAS,EAAE,OAAO,CAAC,CAAS,EAAiE,EAAc,IAAzD,KAAK,eAAe,QAAQ,CAAqC,CAAC,CAAC,OAAO,CAAG,EACxU,EAAc,EAAiB,CAAC,GAAW,CAAC,IAChD,EAAc,EAAc,QAAQ,KAAK,EAAE,GAC3C,IAAM,EAAW,EAAc,QAAQ,KAAK,CAAS,EAC/C,EAAS,CAAC,EAChB,GAAG,EAAc,CAAC,IAAM,EAAW,CAAC,SAAS,EAAkB,QAAQ,OAAO,EAAqE,EAAU,IAAtD,KAAK,eAAe,QAAQ,CAAqC,CAAC,CAAC,OAAO,CAAG,EACjL,IAAW,YAAa,EAAU,EAAU,YAAY,EAAW,IAAW,cAAa,EAAU,EAAU,YAAY,GAAG,E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