{"version":3,"file":"InactivityTrigger.ChWH2y9R.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/AfxJiqVniMY7XveQXDrx/1jWGfxwHWsEwog66ckFo/InactivityTrigger.js"],"sourcesContent":["// Invisible component that triggers an event after appearing and not being hovered for X seconds\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Inactivity Trigger\n *\n * @framerIntrinsicWidth 100\n * @framerIntrinsicHeight 100\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function InactivityTrigger(props){const{delay,onTrigger,resetOnHover}=props;const[isHovered,setIsHovered]=useState(false);const timerRef=useRef(null);useEffect(()=>{// Clear any existing timer\nif(timerRef.current!==null){clearTimeout(timerRef.current);}// Only start timer if not hovered (or if resetOnHover is false)\nif(!isHovered||!resetOnHover){timerRef.current=window.setTimeout(()=>{if(onTrigger&&(!isHovered||!resetOnHover)){onTrigger();}},delay*1e3);}return()=>{if(timerRef.current!==null){clearTimeout(timerRef.current);}};},[delay,onTrigger,isHovered,resetOnHover]);const handleMouseEnter=()=>{startTransition(()=>setIsHovered(true));};const handleMouseLeave=()=>{startTransition(()=>setIsHovered(false));};return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",pointerEvents:\"auto\"},onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave});}addPropertyControls(InactivityTrigger,{delay:{type:ControlType.Number,title:\"Delay\",defaultValue:3,min:.1,max:60,step:.1,unit:\"s\"},resetOnHover:{type:ControlType.Boolean,title:\"Reset on Hover\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},onTrigger:{type:ControlType.EventHandler}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"InactivityTrigger\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"100\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicWidth\":\"100\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./InactivityTrigger.map"],"mappings":"8MASG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,QAAM,YAAU,gBAAc,EAAW,CAAC,EAAU,GAAcA,EAAS,EAAK,EAAQ,EAASC,EAAO,IAAI,EAEwO,OAFtO,OACrK,EAAS,UAAU,MAAM,aAAa,EAAS,OAAO,GACtD,CAAC,GAAW,CAAC,KAAc,EAAS,QAAQ,EAAO,eAAe,CAAI,IAAY,CAAC,GAAW,CAAC,IAAe,EAAU,CAAG,EAAE,EAAM,GAAG,OAAa,CAAI,EAAS,UAAU,MAAM,aAAa,EAAS,OAAO,CAAG,GAAI,CAAC,EAAM,EAAU,EAAU,CAAY,CAAC,EAAmK,EAAK,MAAM,CAAC,MAAM,CAAC,SAAS,WAAW,MAAM,OAAO,OAAO,OAAO,cAAc,MAAM,EAAE,iBAA9N,CAAC,MAAoB,EAAa,EAAI,CAAC,CAAE,EAAmN,iBAAtL,CAAC,MAAoB,EAAa,EAAK,CAAC,CAAE,CAAyK,CAAC,CAAE,qBAV9gB,IAA6D,IAAoD,EAU8Z,EAAoB,EAAkB,CAAC,MAAM,CAAC,KAAK,EAAY,OAAO,MAAM,QAAQ,aAAa,EAAE,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,EAAE,aAAa,CAAC,KAAK,EAAY,QAAQ,MAAM,iBAAiB,aAAa,GAAK,aAAa,MAAM,cAAc,IAAI,EAAE,UAAU,CAAC,KAAK,EAAY,YAAY,CAAC,CAAC"}