import{r as f,t as w,e as l,f as d}from"./index-VDTWCae_.chunk.mjs";import{i as n,b as v,m as p,w as T,o as h,n as D}from"./dav-D-0Zsvk_.chunk.mjs";import{t as a}from"./video-B2Zidy_E.chunk.mjs";f(w);const S={long:l("a few seconds ago"),short:l("seconds ago"),narrow:l("sec. ago")};function M(r=Date.now(),s={}){let e;const i=n(()=>new Date(a(r))),m=n(()=>{const{language:o,relativeTime:t,ignoreSeconds:g}=a(s);return{...o&&{language:o},...t&&{relativeTime:t},ignoreSeconds:g?S[t||"long"]:!1}}),u=p("");T(()=>c());function c(){if(u.value=d(i.value,m.value),a(s).update!==!1){const o=Math.abs(Date.now()-new Date(a(r)).getTime()),t=o>12e4||m.value.ignoreSeconds?Math.min(o/60,18e5):1e3;e=window.setTimeout(c,t)}}return h(()=>e&&window.clearTimeout(e)),D(u)}function x(r,s){const e=n(()=>({locale:v(),format:{dateStyle:"short",timeStyle:"medium"},...a(s)})),i=n(()=>new Intl.DateTimeFormat(e.value.locale,e.value.format));return n(()=>i.value.format(a(r)))}export{M as a,x as u};
//# sourceMappingURL=useFormatDateTime-BREnR9qx.chunk.mjs.map
