{"version":3,"file":"DealCountdown.BcndwTLX.mjs","names":["React.useState","React.useEffect","_jsxs","_jsx","__esmMin","_e","p","c","init_jsx_runtime","ce","init_npm_react_18_3_1","addPropertyControls","init_framer_BWzg2IRg","ControlType","DealCountdown","props","deadline","numberColor","labelColor","numberSize","labelSize","direction","unitGap","endText","variant","serif","style","now","setNow","t","end","parts","ended","s","d","h","m","n","css","NUMFONT","FONT","LABELS","label","i","init_DealCountdown"],"sources":["https:/framerusercontent.com/modules/qbAZhMxVJ4ctmOMny5N0/k6Yw4zmL0Af8rp1t6cuM/DealCountdown.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";const FONT='\"Inter\", \"Inter Placeholder\", system-ui, -apple-system, sans-serif';const LABELS=[\"DAYS\",\"HOURS\",\"MINUTES\",\"SECONDS\"];/**\n * Counts down to an absolute moment (ISO date with timezone), so every visitor sees the same remaining time.\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function DealCountdown(props){const{deadline,numberColor,labelColor,numberSize,labelSize,direction,unitGap,endText,variant,serif,style}=props;const[now,setNow]=React.useState(null);React.useEffect(()=>{setNow(Date.now());const t=setInterval(()=>setNow(Date.now()),1e3);return()=>clearInterval(t);},[]);const end=new Date(deadline).getTime();let parts=[\"--\",\"--\",\"--\",\"--\"];let ended=false;if(now!==null&&!isNaN(end)){let s=Math.max(0,Math.floor((end-now)/1e3));ended=s===0;const d=Math.floor(s/86400);s-=d*86400;const h=Math.floor(s/3600);s-=h*3600;const m=Math.floor(s/60);s-=m*60;parts=[d,h,m,s].map(n=>String(n).padStart(2,\"0\"));}const css=\"@import url('https://fonts.googleapis.com/css2?family=Inter:wght@500;700&family=Instrument+Serif&display=swap');\";const NUMFONT=serif?\"'Instrument Serif', Georgia, serif\":FONT;if(ended){return /*#__PURE__*/_jsxs(\"div\",{style:{fontFamily:FONT,fontWeight:700,fontSize:numberSize,color:numberColor,whiteSpace:\"nowrap\",...style},children:[/*#__PURE__*/_jsx(\"style\",{children:css}),endText]});}if(variant===\"cells\"){return /*#__PURE__*/_jsxs(\"div\",{\"aria-label\":\"Time left\",style:{display:\"flex\",alignItems:\"stretch\",gap:unitGap,fontFamily:FONT,whiteSpace:\"nowrap\",...style},children:[/*#__PURE__*/_jsx(\"style\",{children:css}),LABELS.map((label,i)=>/*#__PURE__*/_jsxs(\"div\",{style:{minWidth:Math.round(numberSize*1.75),display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",gap:Math.round(numberSize*.16),padding:Math.round(numberSize*.28)+\"px \"+Math.round(numberSize*.22)+\"px \"+Math.round(numberSize*.24)+\"px\",borderRadius:12,border:\"1px solid rgba(240,206,120,.32)\",background:\"linear-gradient(180deg, rgba(255,236,180,.07), rgba(255,236,180,.015))\",boxShadow:\"inset 0 1px 0 rgba(255,240,200,.08)\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{color:numberColor,fontFamily:NUMFONT,fontWeight:serif?400:700,fontSize:numberSize,lineHeight:1,fontVariantNumeric:\"tabular-nums\",letterSpacing:serif?\"0\":\"-0.02em\"},children:parts[i]}),/*#__PURE__*/_jsx(\"span\",{style:{color:labelColor,fontWeight:500,fontSize:labelSize,letterSpacing:\"0.18em\",lineHeight:1},children:label})]},label))]});}return /*#__PURE__*/_jsxs(\"div\",{\"aria-label\":\"Time left\",style:{display:\"flex\",alignItems:\"center\",gap:unitGap,fontFamily:FONT,whiteSpace:\"nowrap\",...style},children:[/*#__PURE__*/_jsx(\"style\",{children:css}),LABELS.map((label,i)=>/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:direction===\"column\"?\"column\":\"row\",alignItems:\"center\",gap:direction===\"column\"?3:4,padding:\"4px 0\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{color:numberColor,fontWeight:700,fontSize:numberSize,letterSpacing:\"-0.02em\",lineHeight:1,fontVariantNumeric:\"tabular-nums\"},children:parts[i]}),/*#__PURE__*/_jsx(\"span\",{style:{color:labelColor,fontWeight:500,fontSize:labelSize,letterSpacing:\"0.1em\",lineHeight:1},children:label})]},label))]});}DealCountdown.defaultProps={deadline:\"2026-12-01T05:00:00Z\",numberColor:\"#140F06\",labelColor:\"#140F06\",numberSize:14,labelSize:8,direction:\"row\",unitGap:10,endText:\"Offer ended\",variant:\"plain\",serif:false};addPropertyControls(DealCountdown,{deadline:{type:ControlType.String,title:\"Deadline (ISO)\"},numberColor:{type:ControlType.Color,title:\"Number\"},labelColor:{type:ControlType.Color,title:\"Label\"},numberSize:{type:ControlType.Number,title:\"Number Size\",min:8,max:64},labelSize:{type:ControlType.Number,title:\"Label Size\",min:6,max:32},direction:{type:ControlType.Enum,title:\"Label\",options:[\"row\",\"column\"],optionTitles:[\"Right\",\"Below\"]},unitGap:{type:ControlType.Number,title:\"Gap\",min:0,max:40},endText:{type:ControlType.String,title:\"End Text\"},variant:{type:ControlType.Enum,title:\"Style\",options:[\"plain\",\"cells\"],optionTitles:[\"Plain\",\"Cells\"]},serif:{type:ControlType.Boolean,title:\"Serif Numbers\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DealCountdown\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DealCountdown.map"],"mappings":"A,wLAIG,SAAwBc,EAAcC,EAAM,CAAC,GAAK,CAACC,WAASC,cAAYC,aAAWC,aAAWC,YAAUC,YAAUC,UAAQC,UAAQC,UAAQC,QAAMC,SAAOX,EAAW,CAACY,EAAIC,GAAQ5B,EAAe,IAAI,EAAEC,MAAoB,CAAC2B,EAAO,KAAK,IAAI,CAAC,EAAE,IAAMC,EAAE,gBAAgBD,EAAO,KAAK,IAAI,CAAC,EAAE,GAAG,EAAE,UAAU,cA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