{"version":3,"file":"useRelativeTime.cjs","names":["resolveAmbientLocale","relativeTime"],"sources":["../../../../src/server/format/useRelativeTime.ts"],"sourcesContent":["import { relativeTime } from '@intlayer/core/formatters';\nimport { resolveAmbientLocale } from '../ambientLocale';\n\n/**\n * On the server side, hook returning a `relativeTime` formatter bound to the ambient\n * locale: the server context, falling back to the locale carried by the\n * request. A per-call `locale` option still wins.\n *\n * Reimplemented rather than re-exported from `react-intlayer/server/format`:\n * that one takes no locale argument, so there is no way to hand it the ambient\n * locale — it would read the server context alone and format with the default\n * locale on any render the provider did not reach.\n */\nexport const useRelativeTime = () => {\n  const locale = resolveAmbientLocale();\n\n  return (...args: Parameters<typeof relativeTime>) =>\n    relativeTime(args[0], args[1] ?? new Date(), {\n      ...args[2],\n      locale: args[2]?.locale ?? locale,\n    });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAa,wBAAwB;CACnC,MAAM,SAASA,kDAAqB;CAEpC,QAAQ,GAAG,aACTC,wCAAa,KAAK,IAAI,KAAK,sBAAM,IAAI,KAAK,GAAG;EAC3C,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}