1import{r as l,s as I}from"./index-C7rjTsh5.js";let t=null,y=0;const S=60*1e3,w=15*1e3;let s=S;const p=0;function v(){return t===null?new Date:new Date(Date.now()+t)}async function u(){try{const e=Date.now(),{data:n,error:c}=await I.rpc("get_server_time");if(c){console.error("Error fetching server time:",c);return}const o=Date.now()-e,r=e+o/2;t=new Date(n).getTime()-r,y=Date.now(),console.log(`[ServerTime] Synced. Offset: ${t}ms (${(t/1e3).toFixed(1)}s), RTT: ${o}ms`)}catch(e){console.error("Error syncing server time:",e)}}async function h(){return await u(),t!==null}function m(e){const n=e<3e5?w:S;n!==s&&(s=n,console.log(`[ServerTime] Sync interval updated to ${n/1e3}s (time left: ${Math.round(e/1e3)}s)`))}function N(e){const[n,c]=l.useState(t!==null),[i,o]=l.useState(s),r=l.useRef(null);return l.useEffect(()=>{(t===null||Date.now()-y>s)&&u().then(()=>c(!0));const a=()=>{if(e){const T=typeof e=="string"?new Date(e):e,d=v(),g=T.getTime()-d.getTime();m(g),s!==i&&o(s)}};(()=>{r.current&&clearInterval(r.current),a(),r.current=setInterval(()=>{u().then(()=>{a()})},s)})();const f=()=>{document.visibilityState==="visible"&&(console.log("[ServerTime] Tab visible, re-syncing..."),u().then(()=>{c(!0),a()}))};return document.addEventListener("visibilitychange",f),()=>{r.current&&clearInterval(r.current),document.removeEventListener("visibilitychange",f)}},[e,i]),{getServerTime:v,isSynced:n,offset:t,forceSyncServerTime:h,safetyBufferMs:p,updateSyncFrequency:m,currentSyncInterval:i}}export{m as a,h as f,v as g,N as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.