{"version":3,"file":"LocalTime.CGcNM6-B.mjs","names":["useRef","useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/qBVwACwBWEa4MaGuLJ0e/X9GPIe7o8xEzZsxFAxD7/LocalTime.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";// Plan & Section — availability line with the designer's local time.\n// \"● Taking commissions for 2027 · Porto 14:06\"\nfunction timeIn(zone,h12,d){try{return new Intl.DateTimeFormat(h12?\"en-US\":\"en-GB\",{hour:h12?\"numeric\":\"2-digit\",minute:\"2-digit\",hour12:h12,timeZone:zone||undefined}).format(d);}catch{return new Intl.DateTimeFormat(\"en-GB\",{hour:\"2-digit\",minute:\"2-digit\",hour12:h12}).format(d);}}/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function LocalTime(props){const{text,city,timeZone,hour12,showTime,color,muted,dotColor,pulse,style}=props;const fam=name=>name?`\"${String(name).replace(/\"/g,\"\")}\", Inter, sans-serif`:\"Inter, sans-serif\";const font={fontFamily:fam(props.family),fontSize:Number(props.fontSize)||15,fontWeight:Number(props.fontWeight)||400,letterSpacing:`${Number(props.tracking)||0}em`,lineHeight:\"1.43em\"};const isStatic=useIsStaticRenderer();const ref=useRef(null);// The time is only known in the visitor's browser, so it fills in after mount.\n// The clock ticks on the minute and only while the line is on screen.\nconst[now,setNow]=useState(null);const[active,setActive]=useState(false);useEffect(()=>{if(isStatic)return;const el=ref.current;let onScreen=true;const update=()=>setActive(onScreen&&document.visibilityState===\"visible\");const io=el&&typeof IntersectionObserver!==\"undefined\"?new IntersectionObserver(([e])=>{onScreen=e.isIntersecting;update();}):null;if(io&&el)io.observe(el);document.addEventListener(\"visibilitychange\",update);update();return()=>{io?.disconnect();document.removeEventListener(\"visibilitychange\",update);};},[isStatic]);useEffect(()=>{if(!showTime)return;setNow(new Date);if(isStatic||!active)return;let id;const tick=()=>{setNow(new Date);id=setTimeout(tick,6e4-Date.now()%6e4+50);};id=setTimeout(tick,6e4-Date.now()%6e4+50);return()=>clearTimeout(id);},[isStatic,showTime,active]);const animate=pulse&&!isStatic&&active;return /*#__PURE__*/_jsxs(\"div\",{ref:ref,style:{...style,display:\"inline-flex\",alignItems:\"center\",gap:10,whiteSpace:\"nowrap\",color,...font},children:[/*#__PURE__*/_jsxs(\"span\",{style:{position:\"relative\",width:8,height:8,flexShrink:0},children:[/*#__PURE__*/_jsx(\"span\",{style:{position:\"absolute\",inset:0,borderRadius:99,background:dotColor}}),animate?/*#__PURE__*/_jsx(\"span\",{className:\"ps-lt-ping\",style:{position:\"absolute\",inset:0,borderRadius:99,background:dotColor}}):null]}),/*#__PURE__*/_jsx(\"span\",{children:text}),showTime?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"span\",{style:{color:muted},children:\"\\xb7\"}),/*#__PURE__*/_jsxs(\"span\",{style:{color:muted},children:[city?city+\" \":\"\",/*#__PURE__*/_jsx(\"span\",{style:{fontVariantNumeric:\"tabular-nums\"},children:now?timeIn(timeZone,hour12,now):\"--:--\"})]})]}):null,animate?/*#__PURE__*/_jsx(\"style\",{children:`@keyframes ps-lt-ping{0%{transform:scale(1);opacity:.6}80%,100%{transform:scale(2.6);opacity:0}}.ps-lt-ping{animation:ps-lt-ping 1.8s cubic-bezier(0,0,.2,1) infinite}@media (prefers-reduced-motion: reduce){.ps-lt-ping{animation:none;opacity:0}}`}):null]});}LocalTime.displayName=\"Local Time\";LocalTime.defaultProps={text:\"Taking commissions for 2027\",city:\"Porto\",timeZone:\"Europe/Lisbon\",hour12:false,showTime:true,color:\"#1B1C1E\",muted:\"#6C6B67\",dotColor:\"#3E8E5A\",pulse:false,family:\"IBM Plex Mono\",fontSize:14,tracking:0,fontWeight:400};addPropertyControls(LocalTime,{text:{type:ControlType.String,title:\"Text\"},showTime:{type:ControlType.Boolean,title:\"Time\",enabledTitle:\"Show\",disabledTitle:\"Hide\"},city:{type:ControlType.String,title:\"City\",hidden:p=>!p.showTime},timeZone:{type:ControlType.String,title:\"Time Zone\",placeholder:\"Europe/Lisbon\",description:\"An IANA zone such as Europe/Berlin or America/New_York.\",hidden:p=>!p.showTime},hour12:{type:ControlType.Boolean,title:\"Clock\",enabledTitle:\"12h\",disabledTitle:\"24h\",hidden:p=>!p.showTime},color:{type:ControlType.Color,title:\"Text Color\"},muted:{type:ControlType.Color,title:\"Muted\"},dotColor:{type:ControlType.Color,title:\"Dot\"},pulse:{type:ControlType.Boolean,title:\"Pulse\"},family:{type:ControlType.String,title:\"Font Family\",description:\"Name of a font your site already uses, e.g. in a text style.\"},fontSize:{type:ControlType.Number,title:\"Font Size\",min:10,max:40,step:1,unit:\"px\"},fontWeight:{type:ControlType.Number,title:\"Font Weight\",min:100,max:900,step:100},tracking:{type:ControlType.Number,title:\"Tracking\",min:-.1,max:.2,step:.005,unit:\"em\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LocalTime\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LocalTime.map"],"mappings":"8MAEA,SAAS,EAAO,EAAK,EAAI,EAAE,CAAC,GAAG,CAAC,OAAO,IAAI,KAAK,eAAe,EAAI,QAAQ,QAAQ,CAAC,KAAK,EAAI,UAAU,UAAU,OAAO,UAAU,OAAO,EAAI,SAAS,GAAM,IAAA,EAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAE,MAAM,CAAC,OAAO,IAAI,KAAK,eAAe,QAAQ,CAAC,KAAK,UAAU,OAAO,UAAU,OAAO,CAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAE,CAAC,CAGtR,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,O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