import{d as a}from"./differenceInSeconds-NQ4PDo0z.js";import{e as u,r as f}from"./index-DjCrtoJM.js";function p(r){const t=a(new Date,r);return t<60?"<1m":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:t<604800?`${Math.floor(t/86400)}d ago`:t<2592e3?`${Math.floor(t/604800)}w ago`:t<31536e3?`${Math.floor(t/2592e3)}mo ago`:`${Math.floor(t/31536e3)}y ago`}function g(r){if(r==null||r==="")return null;const t=r instanceof Date?r.getTime():Date.parse(r);return Number.isFinite(t)?t:null}function h(r,t){const e=t-r;return e>0?e:0}function M(r){if(r<60)return`${r.toFixed(1)}s`;const t=Math.round(r%60*10)/10,e=t>=60?1:0;return`${Math.floor(r/60)+e}m ${(e?0:t).toFixed(1)}s`}const s=new Map;function i(r){let t=s.get(r);return t||(t={tick:0,subscribers:new Set,intervalId:null},s.set(r,t)),t}function l(r,t){const e=i(r);return e.subscribers.add(t),e.intervalId===null&&(e.intervalId=setInterval(()=>{e.tick+=1;for(const n of e.subscribers)n()},r)),()=>{e.subscribers.delete(t),e.subscribers.size===0&&e.intervalId!==null&&(clearInterval(e.intervalId),e.intervalId=null)}}function $(r){const t=u.c(3),e=r===void 0?6e4:r;let n,o;return t[0]!==e?(n=c=>l(e,c),o=()=>i(e).tick,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),f.useSyncExternalStore(n,o,m)}function m(){return 0}export{M as a,h as c,p as f,g as t,$ as u};
