{"version":3,"file":"WithLoopingRightDigit.Chl6eBDn.mjs","names":["useState","useMemo"],"sources":["https:/framerusercontent.com/modules/ZspkkMqOeCWUQPpicuUm/883kJK1AELT3fH9bQSOy/WithLoopingRightDigit.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{forwardRef,startTransition,useEffect,useMemo,useState}from\"react\";import{useIsStaticRenderer}from\"framer\";import{AnimatePresence,motion}from\"framer-motion\";// User request: Create a Framer code override export for an existing canvas RichText text layer named something like withLoopingRightDigit. Keep wrapped layer editable and preserve typography/layout/color. Default visible value is 32. Every 2 seconds loop through: 32, 33, 34, 33, 34, 35, 36, 34, 33, 32. Only right digit animates, left digit stays visually stable as 3. Use subtle blur and opacity transition, no large movement, no stop condition. Safe for preview/browser, clean timers, avoid hydration issues.\nconst LOOP_SEQUENCE=[32,33,34,33,34,35,36,34,33,32];const STEP_MS=4e3;const SWAP_DURATION_S=.16;const SHIFT_Y_PX=5;const LOOP_SEQUENCE_132=[132,133,134,133,134,135,136,134,133,132];const DIGIT_STYLE={fontFamily:\"Inter, sans-serif\",fontWeight:500,fontSize:\"15px\",lineHeight:\"1.2em\",fontStyle:\"normal\",fontVariantNumeric:\"tabular-nums\",color:\"inherit\"};function createLoopingRightDigitOverride(Component,sequence,stablePrefix){return /*#__PURE__*/forwardRef((props,ref)=>{const isStaticRenderer=useIsStaticRenderer();const[index,setIndex]=useState(0);useEffect(()=>{if(isStaticRenderer)return;if(typeof window===\"undefined\")return;const intervalId=window.setInterval(()=>{startTransition(()=>{setIndex(prev=>(prev+1)%sequence.length);});},STEP_MS);return()=>{window.clearInterval(intervalId);};},[isStaticRenderer]);const fallbackValue=sequence[0]??0;const value=sequence[index]??fallbackValue;const previousIndex=(index-1+sequence.length)%sequence.length;const previousValue=sequence[previousIndex]??fallbackValue;const rightDigit=useMemo(()=>String(value).slice(-1),[value]);const previousRightDigit=useMemo(()=>String(previousValue).slice(-1),[previousValue]);const direction=useMemo(()=>{const current=Number(rightDigit);const previous=Number(previousRightDigit);if(current>previous)return 1;if(current<previous)return-1;return 0;},[rightDigit,previousRightDigit]);const incomingY=direction>0?-SHIFT_Y_PX:direction<0?SHIFT_Y_PX:0;const outgoingY=direction>0?SHIFT_Y_PX:direction<0?-SHIFT_Y_PX:0;return /*#__PURE__*/_jsx(Component,{ref:ref,...props,style:{...props.style},children:/*#__PURE__*/_jsxs(\"span\",{style:{display:\"inline-flex\",alignItems:\"baseline\",color:\"inherit\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",...DIGIT_STYLE},children:stablePrefix}),/*#__PURE__*/_jsx(AnimatePresence,{mode:\"wait\",initial:false,children:/*#__PURE__*/_jsx(motion.span,{initial:{opacity:.35,filter:\"blur(1.4px)\",y:incomingY},animate:{opacity:1,filter:\"blur(0px)\",y:0},exit:{opacity:.35,filter:\"blur(1.4px)\",y:outgoingY},transition:{duration:SWAP_DURATION_S,ease:\"easeOut\"},style:{display:\"inline-block\",...DIGIT_STYLE,minWidth:\"1ch\",textAlign:\"left\"},children:rightDigit},`${index}-${rightDigit}`)})]})});});}export function withLoopingRightDigit(Component){return createLoopingRightDigitOverride(Component,LOOP_SEQUENCE,\"3\");}export function withLoopingRightDigit132(Component){return createLoopingRightDigitOverride(Component,LOOP_SEQUENCE_132,\"13\");}\nexport const __FramerMetadata__ = {\"exports\":{\"withLoopingRightDigit\":{\"type\":\"reactHoc\",\"name\":\"withLoopingRightDigit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLoopingRightDigit132\":{\"type\":\"reactHoc\",\"name\":\"withLoopingRightDigit132\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WithLoopingRightDigit.map"],"mappings":"6QAC+V,SAAS,EAAgC,EAAU,EAAS,EAAa,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,IAAM,EAAiB,EAAoB,EAAO,CAAC,EAAM,GAAUA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