{"version":3,"file":"NativeTextMidpoint.bLS_AaQ4.mjs","names":["React.useRef","React.useState","React.useCallback","React.useMemo"],"sources":["https:/framerusercontent.com/modules/H8NSluUx5AuoWFY16kIX/3qEhIJqh8vswvtLtRRV1/NativeTextMidpoint.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{useIsStaticRenderer}from\"framer\";import{useReducedMotion}from\"framer-motion\";// Trigger adapter only. Framer still owns tokenisation, text, styles and tween.\n// Keep the native effect mounted and waiting on an empty target until this\n// element reaches 88% of the viewport height (12% above the bottom). No remount or text rewriting.\nexport function withNativeTextMidpoint(Component){return /*#__PURE__*/React.forwardRef(function NativeTextMidpoint(props,forwardedRef){const root=React.useRef(null);const waiting=React.useRef(null);const[ready,setReady]=React.useState(false);const isStatic=useIsStaticRenderer();const reduced=useReducedMotion();const ref=React.useCallback(node=>{root.current=node;if(typeof forwardedRef===\"function\")forwardedRef(node);else if(forwardedRef)forwardedRef.current=node;},[forwardedRef]);React.useEffect(()=>{if(ready||isStatic||reduced||!root.current)return;const node=root.current;let observer;const connect=()=>{observer?.disconnect();observer=new IntersectionObserver(entries=>{if(entries.some(entry=>entry.isIntersecting)){setReady(true);observer?.disconnect();}},{root:null,rootMargin:`0px 0px -${Math.round(window.innerHeight*.12)}px 0px`,threshold:0});observer.observe(node);};connect();window.addEventListener(\"resize\",connect);return()=>{observer?.disconnect();window.removeEventListener(\"resize\",connect);};},[ready,isStatic,reduced]);const effect=React.useMemo(()=>{if(isStatic||reduced)return undefined;if(!props.effect)return props.effect;return{...props.effect,trigger:\"onScrollTarget\",threshold:0,target:{ref:ready?root:waiting}};},[props.effect,ready,isStatic,reduced]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref,effect:effect});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withNativeTextMidpoint\":{\"type\":\"reactHoc\",\"name\":\"withNativeTextMidpoint\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"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