import{a4 as a,ar as l}from"./index-D92x6h1h.js";const f=300*1e3;function h(e){const d=e.thresholdMs??f;let t=a.getState();const r=a.onStateChange(c=>{c==="connected"&&t==="disconnected"&&e.refetch(),t=c});let n=0,i=!1;const o=typeof document<"u";function s(){document.hidden?(n=Date.now(),i=!0):i&&Date.now()-n>d&&e.refetch()}o&&document.addEventListener("visibilitychange",s),l(()=>{r(),o&&document.removeEventListener("visibilitychange",s)})}export{h as u};
